We are taking the tape backup of a master file on daily basis by simply doing the MOD. At the end of the month, we will have one file with each day of the file in it i.e. Jan tape file will have 31 days data. This file contains Header and many details records. So a typical backup file would appear as follows..
HDR...
DTL...
DTL...
DTL...
HDR...
DTL...
DTL...
HDR...
DTL...
and so on.
The requirement now is to extract specific day's file from this tape backup. Lets say, we need 3rd day's file in that month, then we should extract the 3rd header and the respective detail records. How can we achieve this using JCL?
. . . . . .
// EXPORT SYMLIST=*
// SET DAYNUM=22
//. . . . . . . .
//SELGROUP EXEC PGM=SORT
//. . . . .
//SYSIN DD *,SYMBOLS=EXECSYS
INREC IFTHEN=(WHEN=GROUP,BEGIN=(1,3,CH,EQ,C'HDR'),PUSH=(1000:ID=5))
SORT FIELDS=COPY
OUTFIL INCLUDE=(1000,5,ZD,EQ,&DAYNUM), choose the group by day number
BUILD=(1,nnnn) truncate to the original record size
END
//*