I have 5 input files. each file is having a header record which contains date. date is in (mm/dd/yyyy) format.
now i have to compare this date(of each file) with previous day's date in JCL. Only if all 5 dates are equal to previous day's date, then continue to execute next steps. Else should skip all the subsequent steps.
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 *
//SORTOUT DD DSN=TEMP.M4J6060.RUNDATE(+1), CREATE RUNDATE
//SYSIN DD *
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
this card will be fed into next step as ddname SYMNAMES
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.
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)
Note that z/OS DFSORT V1R5 PTF UK90007 and DFSORT R14 PTF UK90006 (April, 2006) now provide built-in functions for relative dates like the current date - 1 day or the current date + 30 days. See the following for complete details on using past date constants and future date constants.