I don't think your code looks too bad.

Elegance is somewhat in the mind of the beholder. Some thoughts, which may
make things better or worse, depending on your point of view:

- You've got more quotes in there than you need. You could just say
VARCMD1 = "F $SCHED,VAR(DB2TNAME,''"||STRIP(DSN)||"'')"

- You could define some of your syntactical elements as constants, e.g.,
kDblApost = "''"  /* I like "k" as a prefix for constants; YMMV */
Or
kEndCmd = "'')"
or
kEndCmd = "'') '"

- You could define some of the constant parts of your command as constants,
e.g., kFSKED = "F $SCHED,VAR(DB2T" or even kFSKED = "' F $SCHED,VAR(DB2T"

- Don't forget that Rexx concatenates without an operator, so "X"||"Y" is
more simply (more clearly? Up to you.) as "X""Y"

- I also like an explicit ADDRESS statement but again, diff'rent strokes for
diff'rent folks.

Charles

P.S. None of the above is tested. The concepts are right, but I may have
made a typo or a logical slip.

-----Original Message-----
From: IBM Mainframe Discussion List [mailto:[EMAIL PROTECTED] On Behalf
Of Tim Hare
Sent: Friday, November 17, 2006 11:51 AM
To: [email protected]
Subject: Friday question: in search of Rexx elegance?

I'm trying to construct some modify commands in AF/Operator, unfortunately 
the product for which the commands are being issued requires single quotes 
around some operands... Here's what I did:

VARCMD1 = "F $SCHED,VAR(DB2TNAME,"||"''"||STRIP(DSN)||"'')" 
VARCMD2 = "F $SCHED,VAR(DB2TRBAS,"||"''"||STRIP(STARTRBA)||"'')"
VARCMD3 = "F $SCHED,VAR(DB2TRBAE,"||"''"||STRIP(ENDRBA)||"'')" 
"OPER '" VARCMD1 "'" 
"OPER '" VARCMD2 "'" 
"OPER '" VARCMD3 "'" 

----------------------------------------------------------------------
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

Reply via email to