/* REXX GENSAR A special-purpose tool for generating control statements for SARBCH. Written by Frank Clarke, HAS, Inc. */ signal on syntax tv = "" hmsg = "" arg parms "((" opts optl = Length(opts) /* how long ? */ if optl > 0 then, /* exists ? */ if Right(opts,1) = ")" then, /* last char is close-paren ? */ opts = Left(opts,optl-1) /* clip trailing paren */ parse var opts "TRACE" tv . if tv ^= "" then interpret "TRACE" tv if parms = "" then call HELP if Word(parms,1) = "?" then call HELP job = KEYWD(job) report = KEYWD(report) gen = KEYWD(gen) seq = KEYWD(seq) if parms ^= "" then do hmsg = "Unrecognized parms:" parms call HELP end if job = "" & report = "" then do hmsg = "Either JOB or REPORT must be specified." call HELP end if job ^= "" & report ^= "" then do hmsg = "JOB and REPORT are mutually exclusive." call HELP end if gen = "" then do hmsg = "GEN is required." call HELP end jobid = Strip(job||report) "NEWSTACK" queue "/LOAD ID="jobid queue " GEN="gen if seq ^= "" then, queue " SEQ="seq queue " DDNAME=WRITE" "EXECIO * DISKW $OUT (FINIS" "DELSTACK" exit /*-------------------------------------------------------------------*/ HELP: /*@ */ address TSO "CLEAR" if hmsg ^= "" then do say hmsg say "" end say " " say " GENSAR is a special-purpose tool for generating control " say " statements for SARBCH. " say " " say " Syntax: GENSAR < parms > < <((> options > " say " " say " may be any combination of: " say " JOB jobname " say " REPORT reportname " say " GEN generation-number " say " SEQ sequence-number " say " except that a) either JOB or REPORT must be specified" say " (but not both), and b) GEN is required. It is " say " wise (but not neccessary) to specify SEQ. " say " " exit /*@ HELP */ /*-------------------------------------------------------------------*/ KEYWD: Procedure expose, /*@ */ kw parms arg kw . if Wordpos(kw,parms) = 0 then, kw_val = "" else, if Wordpos(kw,parms) = 1 then, kwa = kw" " else kwa = " "kw" " parse var parms . value(kwa) kw_val . if kw_val <> "" then parms = Delword(parms,Wordpos(value(kw),parms),2) return kw_val /*@ KEYWD */ /*-------------------------------------------------------------------*/ SWITCH: /*@ */ arg kw . sw_val = Wordpos(value(kw),parms) > 0 if sw_val then parms = Delword(parms,Wordpos(value(kw),parms),1) return sw_val /*@ SWITCH */ /*-------------------------------------------------------------------*/ SYNTAX: /*@ */ errormsg = "REXX error" rc "in line" sigl":" errortext(rc) say errormsg say sourceline(sigl) trace "?r" nop exit /*@ SYNTAX */