I am trying to create a 'JCL' using DFSORT, and subsequently routing it to INTRDR for submission.
The point I'm stuck at is, when the same JCL is required to be submitted by modifying a sequence number - say JCL1 is submitted for file set-1, JCL2 is submitted for file set-2 and so on going on till 'n' file sets; in all cases, JCL remains same, only file set number is changing. This number is being set through the parameter 'SEG' in the JCL.
To achieve this, the SORT step can be repeated 'n' times modifying the value of 'n' (through SEG) each time and this would do the trick; but the drawback is it'd create redundant JCL statements (in the original JCL where the sub-JCLs are being created).
Is it possible to achieve this repetition logic in a single DFSORT step; please note that a seperate/individual JCL is required to be submitted for each file set; depending on the file set number, which goes from '0' to 'n'; value of 'n' will be given by the user submitting the JCL.
Any guidance is much appreciated.
Thank you.
Current SORT card coded is as below:
// SET SEG='0',
// LIBRARY1='(XXXX.XXXX.XXXX),',
// LIBRARY2='XXXX.XXXX.XXXX),',
// MEMLIB='XXXX'
//*
//STEP001 EXEC PGM=SORT,COND=(0,NE),
// PARM=('JP1"&SEG",JP2"&LIBRARY1",JP3"&LIBRARY2",JP4"&MEMLI
// B"')
//SYSOUT DD SYSOUT=*
//SYMNOUT DD SYSOUT=*
//SORTIN DD DUMMY,DCB=(RECFM=FB,LRECL=80)
//SORTOUT DD SYSOUT=(A,INTRDR)
//SYSIN DD *
SORT FIELDS=COPY
OUTFIL REMOVECC,NODETAIL,
HEADER1=('//JOB',JP1,
C' JOB ''',C'XXXX''',C',''',C'XXXX''',C',',/,
'//',8X,C'CLASS=X,MSGCLASS=X,',/,
'//',8X,C'MSGLEVEL=(1,1),NOTIFY=&SYSUID,',/,
'//',8X,C'REGION=0M',/,
'//*',/,
'//PROCLIB JCLLIB ORDER=',JP2,/,
'//',11X,C' ',JP3,/,
'//*',/,
'//SYMBOLIC INCLUDE MEMBER=',JP4,/,
'//*',/,
'//TESTXXXX ',C'EXEC XXXXX,',/,
'//',12X,C'SEG=',JP1,C',',/,
'//*')
/*
// LIBRARY1='(XXXX.XXXX.XXXX),',
// LIBRARY2='XXXX.XXXX.XXXX),',
// MEMLIB='XXXX'
//*
//STEP001 EXEC PGM=SORT,COND=(0,NE),
// PARM=('JP1"&SEG",JP2"&LIBRARY1",JP3"&LIBRARY2",JP4"&MEMLI
// B"')
//SYSOUT DD SYSOUT=*
//SYMNOUT DD SYSOUT=*
//SORTIN DD DUMMY,DCB=(RECFM=FB,LRECL=80)
//SORTOUT DD SYSOUT=(A,INTRDR)
//SYSIN DD *
SORT FIELDS=COPY
OUTFIL REMOVECC,NODETAIL,
HEADER1=('//JOB',JP1,
C' JOB ''',C'XXXX''',C',''',C'XXXX''',C',',/,
'//',8X,C'CLASS=X,MSGCLASS=X,',/,
'//',8X,C'MSGLEVEL=(1,1),NOTIFY=&SYSUID,',/,
'//',8X,C'REGION=0M',/,
'//*',/,
'//PROCLIB JCLLIB ORDER=',JP2,/,
'//',11X,C' ',JP3,/,
'//*',/,
'//SYMBOLIC INCLUDE MEMBER=',JP4,/,
'//*',/,
'//TESTXXXX ',C'EXEC XXXXX,',/,
'//',12X,C'SEG=',JP1,C',',/,
'//*')
/*