David Eisenberg wrote:
[excerpts from original post:
WRITENR ===>
READ L
DO &K=1 TO &LENGTH(&L)
IF &SUBSTR(&K,&L)=A THEN SET &X=&X OPTA
ELSE IF &SUBSTR(&K,&L)=B THEN SET &X=&X OPTB
ELSE IF &SUBSTR(&K,&L)=C THEN SET &X=&X OPTC
END
WRITE &X
.
.
.
The problem: I want each of the tokens in the generated string to be
preceded by a double-ampersand. E.g., if the user enters "ACB", I want X to
be set to "&&OPTA &&OPTC &&OPTB".
---------------------
Follow up to my original post: the ampersands seem to have nailed me even in
my previous message. To clarify (I hope this shows up correctly): if the user
enters
ABC
the CLIST should produce
&&OPTA &&OPTB &&OPTC
I.e., two ampersand characters concatenated to the relevant string (e.g.,
OPTA), followed by a blank, then the same thing repeated for the next input
character, etc.
I'm sorry for any confusion!
David
OK, I'll have a go.
Option 1: use &STR:
IF &SUBSTR(&K,&L)=A THEN SET X=&STR(&&OPTA)
-- note: do not need the & on the left hand side
of an assignment; makes it easier to read --
Option 2: use &SYSNSUB:
IF &SUBSTR(&K,&L)=A THEN SET X=&SYSNSUB(0,&&OPTA)
Try 'em; see if either (or both) don't give you what
I think your after.
<ad>
We're one of the few companies around still teaching
CLIST, so if you have to code or maintain CLISTs and
have only had OJT, consider scheduling our 3 day
class "TSO CLIST Programming in z/OS"; this is also
the only place I know where you can get any hands on
training in the TSO EDIT command. Details at:
http://www.trainersfriend.com/TSO_Clist_REXX_Dialog_Mgr/a650descrpt.htm
</ad>
Kind regards,
-Steve Comstock
The Trainer's Friend, Inc.
303-393-8716
http://www.trainersfriend.com
z/OS Application development made easier
* Our classes include
+ How things work
+ Programming examples with realistic applications
+ Starter / skeleton code
+ Complete working programs
+ Useful utilities and subroutines
+ Tips and techniques
----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to [EMAIL PROTECTED] with the message: GET IBM-MAIN INFO
Search the archives at http://bama.ua.edu/archives/ibm-main.html