Dan
Great idea, this seems to do the job but may need a bit more work.
/*REXX*/
/* */
/* The purpose of this is to enable every member of a PDS */
/* so be submitted in order. */
/* Run it like this */
/* TSO EXEC 'MY.EXEC(SUBNEXT)' 'TEST.JCL :' */
/* */
/* The : means start at the first member, specify the actual */
/* member name to start at the member after that */
/* TSO EXEC 'MY.EXEC(SUBNEXT)' 'TEST.JCL MEMBER01' */
/* will submit MEMBER02. */
/* */
/* To start using a batch job just use the JCL queued below. */
/* */
/* It reads in a JCL member adds a return code check as the */
/* last step and then submits it. */
/* When it runs at the end of the submitted job it MAY then */
/* submit the next job automatically. */
/* */
ARG pds_name mem_name
if pds_name = '' then pull pds_name
if mem_name = '' then pull mem_name
pds_name = strip(pds_name)
mem_name = strip(mem_name)
say 'input PDS name =' pds_name
say 'input member name =' mem_name
the_pds = "'"pds_name"'"
X = OUTTRAP('ML.')
"LISTDS "the_pds" MEMBERS"
X = OUTTRAP('OFF')
if mem_name = ':' then new_mem = strip(ML.7) /* get first member */
else do
mo_re = '0'
new_mem = ''
DO N = 7 TO ML.0
if mo_re = '1' then do /* got last member name */
new_mem = strip(ML.N) /* then get this as next */
leave /* exit loop */
end
if ML.N = mem_name then mo_re = '1'
END
end
if new_mem = '' then do
say 'no more member names'
exit
end
say 'new member name =' new_mem
PDSIN = "'"pds_name"("||new_mem||")'"
say 'allocating INFILE to' PDSIN
"ALLOC FILE(INFILE) DSN("PDSIN") SHR"
if rc /= 0 then do
say 'alloc rc = ' rc
exit
end
"EXECIO * DISKR INFILE (STEM INREC. FINIS"
DO I = 1 TO INREC.0 /* read all the lines of the member */
QUEUE INREC.I /* and queue them */
END
"FREE FILE(INFILE)"
Queue "//CHECKRC EXEC PGM=IKJEFT01,DYNAMNBR=20,COND=(0,NE) "
Queue "//SYSTSIN DD * "
Queue " EXEC 'MY.EXEC(SUBNEXT)' "
Queue " " pds_name " "
Queue " " new_mem " "
Queue "//SYSTSPRT DD SYSOUT=* "
Queue "ZZ"
"SUBMIT * END(ZZ)"
EXIT
----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to [email protected] with the message: INFO IBM-MAIN