Let's see if this meets your needs:
The FOO110 exec:
/* Rexx */
/* Written Heisei 25.11.21 by Akatsukami-sama */
trace o
seq = 0
sig = x2c("E69989A3A3859540C88589A2858940F2F54BF1F14BF2F140")
sig = sig || x2c("82A840C19281A3A2A49281948960A2819481")
uid = userid()
address ispexec "TBCREATE TADSN NAMES (DSN SEQ) NOWRITE REPLACE"
"EXECIO 1 DISKR TULIN"
do while (rc=0)
seq = seq + 1
pull dsn .
address ispexec "TBADD TADSN"
"EXECIO 1 DISKR TULIN"
end
address ispexec "FTOPEN TEMP"
address ispexec "FTINCL SAG"
address ispexec "FTCLOSE"
address ispexec "VGET ZTEMPF"
"SUBMIT '"ztempf"'"
The SAG skeleton:
//&UID.S JOB ,SYNCSORT,CLASS=S,MSGCLASS=1,
// REGION=0M,SCHENV=JOB@ANY
//*
//********************************************************************
//STEP21 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
)DOT TADSN
)IF &SEQ = 1 THEN )DO
//SORTIN DD DSN=&DSN,DISP=SHR
)ENDDO
)ELSE )DO
// DD DSN=&DSN,DISP=SHR
)ENDDO
)ENDDOT
//SORTOUT DD DSN=&&CONSOL,DISP=(NEW,PASS)
//SYSIN DD *
SORT FIELDS=COPY
/*
//*
//STEP22 EXEC PGM=P2
//* this step uses the consolidated data set created in STEP21
When this job
//FOOISPF JOB ,'Generic ISPF',CLASS=S,MSGCLASS=1,SCHENV=JOB@ANY,
// REGION=0M
//*
//STEP11 EXEC PGM=IEBGENER
//SYSPRINT DD SYSOUT=*
//SYSUT1 DD *
FOO.BAR1
FOO.BAR2
FOO.BAR3
//SYSUT2 DD DSN=FOO.FOO,DISP=OLD
//*
//STEP12 EXEC ISPFB,
// DYNAMNBR=25
//ISPPROF DD DSN=&PROF,DISP=(,DELETE),UNIT=TEMPDISK,
// SPACE=(CYL,(2,1,2)),DCB=(RECFM=FB,LRECL=80,BLKSIZE=8880)
//SYSPRINT DD SYSOUT=*
//SYSTSPRT DD SYSOUT=*,
// DCB=(RECFM=FBA,LRECL=133,BLKSIZE=0,DSORG=PS)
//ISPFILE DD DSN=FOO.TOOLS.CNTL,DISP=SHR
//SYSPROC DD DSN=FOO.WORK.CLIST,DISP=SHR
//ISPLLIB DD DSN=FOO.WORK.LOAD,DISP=SHR
//ISPSLIB DD DSN=FOO.WORK.SKELS,DISP=SHR
//ISPTLIB DD DSN=FOO.ISP.ISPTLIB,DISP=SHR
//TULIN DD DSN=FOO.FOO,DISP=SHR
//SYSTSIN DD *
ISPSTART CMD(%FOO110)
is run, the following JCL is fabricated and submitted.
//FOOS JOB ,SYNCSORT,CLASS=S,MSGCLASS=1,
// REGION=0M,SCHENV=JOB@ANY
//*
//********************************************************************
//STEP21 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SORTIN DD DSN=FOO.BAR1,DISP=SHR
// DD DSN=FOO.BAR2,DISP=SHR
// DD DSN=FOO.BAR3,DISP=SHR
//SORTOUT DD DSN=&CONSOL,DISP=(NEW,PASS)
//SYSIN DD *
SORT FIELDS=COPY
/*
//*
//STEP22 EXEC PGM=P2
//* this step uses the consolidated data set created in STEP21
"You have sat too long for any good you have been doing lately ... Depart, I say; and let us have done with you. In the name of God, go!" -- what I say to a junior programmer at least once a day