manyone
New User
Joined: 09 Mar 2006 Posts: 9
|
|
|
|
here's a DFSORT solution (tested). (i removed the sortwks and i added dots to indent control cards)
assume at start of day you run this job
//SORT0 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SORTMSG DD SYSOUT=*
//SORTIN DD *
DUMMY CARD
//SORTOUT DD DSN=TEMP.M4J6060.RUNDATE(+1), CREATE RUNDATE
// UNIT=TEMP,DISP=(,CATLG,DELETE),
// SPACE=(TRK,(1,1),RLSE)
//SYSIN DD *
..INREC FIELDS=(DATE1)
..SORT FIELDS=COPY
//*
at end of job, rundate(0) will contain today as yyyymmdd, and rundate(-1) will contain yesterday
convert yesterdays run date to a record which looks like
RUNDATE,'2006-03-14'
this card will be fed into next step as ddname SYMNAMES
//SORT1 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SORTMSG DD SYSOUT=*
//* YESTERDAYS RUNDATE
//SORTIN DD DISP=SHR,DSN=TEMP.M4J6060.RUNDATE(-1)
//SORTOUT DD DSN=TEMP.M4J6060.W2.DATA(+1), SYMNAMES
// UNIT=TEMP,DISP=(,CATLG,DELETE),
// SPACE=(TRK,(1,1),RLSE)
//SYSIN DD *
..SORT FIELDS=COPY
..OUTFIL OUTREC=(C'RUNDATE,''',5,2,C'-',7,2,C'-',1,4,C'''',80:X)
//*
read the first record of input file (W4.DATA in example) and reformat date as yyyymmdd into V1.DATA if it does NOT match yesterday (ie. if header date matches yesterday, it will NOT be written); create similar step for remaining files to create V2, V3, V4, etc.
//SORT2 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SORTMSG DD SYSOUT=*
//SYMNAMES DD DISP=SHR,DSN=TEMP.M4J6060.W2.DATA
//SORTIN DD DISP=SHR,DSN=TEMP.M4J6060.W4.DATA
//SORTOUT DD DSN=TEMP.M4J6060.V1.DATA(+1), UNMATCHD HDR
// UNIT=TEMP,DISP=(,CATLG,DELETE),
// RECFM=FB,LRECL=80,BLKSIZE=0,
// SPACE=(TRK,(1,1),RLSE)
//SORTWK01 DD UNIT=SYSDA,SPACE=(CYL,(10,20))
//SORTWK02 DD UNIT=SYSDA,SPACE=(CYL,(10,20))
//SORTWK03 DD UNIT=SYSDA,SPACE=(CYL,(10,20))
//SORTWK04 DD UNIT=SYSDA,SPACE=(CYL,(10,20))
//SORTWK05 DD UNIT=SYSDA,SPACE=(CYL,(10,20))
//SYSIN DD *
..SORT FIELDS=COPY,STOPAFT=1
..OUTFIL INCLUDE=(1,10,CH,NE,RUNDATE),OUTREC=(1,80)
//*
attempt to print the contents of the CONCATENATION of ALL header dates. if file is empty, this returns COND=4. if file is empty, all header dates matched yesterday
//PRINT1 EXEC PGM=IDCAMS
//SYSPRINT DD SYSOUT=*
//INPFILE DD DISP=SHR,DSN=TEMP.M4J6060.V1.DATA
// DD DISP=SHR,DSN=TEMP.M4J6060.V2.DATA (as needed)
//SYSIN DD *
..PRINT IFILE(INPFILE) COUNT(1)
// |
|