Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

Date compare in JCL

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
View previous topic :: :: View next topic  
Author Message
punter

New User


Joined: 15 Mar 2006
Posts: 1

PostPosted: Wed Mar 15, 2006 2:43 pm    Post subject: Date compare in JCL
Reply with quote

hi all,

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.
Back to top
View user's profile Send private message

manyone

New User


Joined: 09 Mar 2006
Posts: 9

PostPosted: Wed Mar 15, 2006 11:44 pm    Post subject:
Reply with quote

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)
//
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Moderator


Joined: 15 Feb 2005
Posts: 7130
Location: San Jose, CA

PostPosted: Thu Mar 16, 2006 1:57 am    Post subject:
Reply with quote

punter,

The following Smart DFSORT Trick shows how to include records using relative dates:

http://www.ibm.com/servers/storage/support/software/sort/mvs/tricks/srtmst03.html#t7r
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Moderator


Joined: 15 Feb 2005
Posts: 7130
Location: San Jose, CA

PostPosted: Thu May 11, 2006 4:59 am    Post subject:
Reply with quote

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.

www.ibm.com/servers/storage/support/software/sort/mvs/peug/
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts member list compare jzhardy TSO/ISPF 6 Fri May 12, 2017 3:18 pm
No new posts Validate date and numeric fields and ... Rick Silvers DFSORT/ICETOOL 6 Thu May 11, 2017 6:51 pm
No new posts LISTIDR compiled date/time jerryte IBM Tools 3 Thu Apr 20, 2017 7:37 pm
No new posts SUBSTR for Date functions Shaheen Shaik DB2 4 Thu Apr 06, 2017 2:14 pm
No new posts Compare two files and subtract values ameetmund DFSORT/ICETOOL 7 Fri Mar 31, 2017 3:35 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us