I got frustrated at the inability to test anything other than return
codes the like with JCL IF. Maybe I'm re-inventing the wheel here, but I
wrote a little Rexx script that reduced my frustration.
INTERP interprets the value of its argument and returns the result as
its return code. So you can for example say
//INT1 EXEC PGM=INTERP,PARM='&DSP = SHR'
// IF INT1.RC = 1 THEN
whatever you want to do if &DSP was "SHR".
// ENDIF
It should handle Rexx expressions up to 100 characters of any
complexity, with parentheses, numeric calculations, etc., that return
either a truth (1 or 0) or numeric result.
Here is how to execute it if you don't have the Rexx compiler:
//INT1 EXEC PGM=IRXJCL,PARM='INTERP &DSP = SHR '
//SYSEXEC DD DSN=your.rexx.library,DISP=SHR
Here is the Rexx source code:
/* Interp: Rexx to set return code by interpreting parm */
/* Returns the value obtained by interpreting its argument, with the
following special values:
4095 = Rexx Syntax error
4094 = Non-numeric result
4093 = Result out of range 0 to 4095 */
Signal On Syntax Name SyntaxErr
Interpret "ttt =" Arg(1)
If Datatype(ttt) \= "NUM" Then Exit 4094
If ttt <= 4095 & ttt >= 0 Then Exit ttt
Exit 4093
SyntaxErr:
Exit 4095
I hereby place this code in the public domain. Feedback appreciated.
Charles Mills
----------------------------------------------------------------------
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