The below JCL generates the GDG version and it will be the input of STEP02 jcl ,It is our internal JCL which has to send the output file to the different region with help of mailbox(ADCDEF11 : mailbox name).The producing output file will be a Flatfile(RECFM-FB,LRECL-88) with incremantal of last qulafier.
//step01 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SORTIN DD DSN=ti.te.test1.current(0),
// DISP=SHR
//SORTOUT DD DSN=hi.lo.test1.out(+1),UNIT=sysda,
// DISP=(NEW,CATLG,DELETE),SPACE=(TRK,(15,15),RLSE),
// DCB=(RECFM=FB,LRECL=88,BLKSIZE=0)
//*
//SYSIN DD *
INCLUDE COND=(11,7,CH,EQ,C'accesso')
sort fields=copy
//*
//* COPY OUTPUT TO mailNET FILE(MAILBOX: ABCDEF11)
//*
//step02 EXEC PGM=SENDPGM,PARM='ABCDEF11'
//SYSPRINT DD SYSOUT=*
//INFILE DD DSN=hi.lo.test1.out(+1),DISP=(OLD,KEEP)
//*
//SYSOUT DD SYSOUT=*
//SORTIN DD DSN=ti.te.test1.current(0),
// DISP=SHR
//SORTOUT DD DSN=hi.lo.test1.out(+1),UNIT=sysda,
// DISP=(NEW,CATLG,DELETE),SPACE=(TRK,(15,15),RLSE),
// DCB=(RECFM=FB,LRECL=88,BLKSIZE=0)
//*
//SYSIN DD *
INCLUDE COND=(11,7,CH,EQ,C'accesso')
sort fields=copy
//*
//* COPY OUTPUT TO mailNET FILE(MAILBOX: ABCDEF11)
//*
//step02 EXEC PGM=SENDPGM,PARM='ABCDEF11'
//SYSPRINT DD SYSOUT=*
//INFILE DD DSN=hi.lo.test1.out(+1),DISP=(OLD,KEEP)
//*
The output file seems like that..keep going the incremental of last qualifier
FLAT.TEST.ABCDEF11.N0005
FLAT.TEST.ABCDEF11.N0006
FLAT.TEST.ABCDEF11.N0007
FLAT.TEST.ABCDEF11.N0008
FLAT.TEST.ABCDEF11.N0009
FLAT.TEST.ABCDEF11.N0006
FLAT.TEST.ABCDEF11.N0007
FLAT.TEST.ABCDEF11.N0008
FLAT.TEST.ABCDEF11.N0009
My question is how to copy the records to another outputfile from the latest version of the mailbox produced flatfile.
The New JCL has to pick the latest generated file directly and to copy the output file(for this case,input is : FLAT.TEST.ABCDEF11.N0009);
So JCL has to compare the all mailbox filename(Not a records) with each other,then only we come to know the latest file.
Thanks;