[Date Prev][Date Next][Thread Prev][Thread Next]
[Author Index]
[Date Index]
[Thread Index]
[SQR-USERS Info]
[SQRUG Home Page]
Hard-coded values and instr() command
- Subject: Hard-coded values and instr() command
- From: Jason Penney <jasonpenney@YAHOO.COM>
- Date: Fri, 15 Jan 1999 14:04:02 -0800
I have a list of jobcodes that I'm hardcoding into my SQR use in an
evaluate statement. Instead of using the EVALUATE command, however, I
decided to see if I could use instr() to do the same thing. (I wanted
the hardcoded list to be easy to update later.) I made it work, but it
was quirky, so I thought I'd share.
Basically, I replaced this:
EVALUATE &jobcode
WHEN='MM'
WHEN='MA'
WHEN='VA'
DO mgr_stuff
END-EVALUATE
with this:
(at beginning of program)
#DEFINE mgr_codes 'MM''MA''VA'
(inside procedure)
IF INSTR({mgr_codes},&jobcode,1) > 0
DO mgr_stuff
END-IF
The quirky thing is the substitution variable. I tried several
delimiters for the jobcode list and only the one above worked.
Examples of variables that resulted in instr() syntax errors:
#DEFINE mgr_codes 'MM','MA','VA'
#DEFINE mgr_codes 'MM';'MA';'VA'
#DEFINE mgr_codes 'MM'-'MA'-'VA'
#DEFINE mgr_codes 'MM'MA'VA'
#DEFINE mgr_codes ''MM''MA''VA''
So, the only way I've made it work is to have one quote at the
beginning of the list and double quotes between each value. Anybody
know why?
Jason Penney
jasonpenney@yahoo.com
SRC Inc.
www.srcinc.com
_________________________________________________________
DO YOU YAHOO!?
Get your free @yahoo.com address at http://mail.yahoo.com