Comparing Date with current date

In this Mainframe Forum - You can post your queries on DFSORT, ICETOOL , SyncSort & JCL Utilities

Moderators: Frank Yaeger, Moderator Group

Post Reply
nareshv_99
Member
Posts: 25
Joined: Sun Feb 05, 2012 10:59 pm
Location: Bangalore

Comparing Date with current date

Post by nareshv_99 » Sat Feb 11, 2012 8:14 pm

Hi All,
I have below requirement
I have a flat file it contains YYYY-MM-DD in the header record (1st record of the file and starts at col. 2). I have to compare this date filed with current date and set the RC=8 if they are not equal.

can it be done using SORT card ?

User avatar
Frank Yaeger
Moderator
Posts: 812
Joined: Sat Feb 18, 2006 5:45 am
Location: San Jose, CA
Contact:

Post by Frank Yaeger » Tue Feb 14, 2012 12:08 am

You can use a DFSORT/ICETOOL job like the following to do what you asked for:

Code: Select all

//S1 EXEC PGM=ICETOOL                           
//TOOLMSG DD SYSOUT=*                           
//SYMNAMES DD *                                 
CURDATE,S'&YR4.-&MON.-&DAY'                     
//SYMNOUT DD SYSOUT=*                           
//DFSMSG DD SYSOUT=*                            
//IN DD *                                       
H2012-02-13                                     
D RECORD 01                                     
D RECORD 02                                     
D RECORD 03                                     
//TOOLIN DD *                                   
COUNT FROM(IN) RC8 NOTEMPTY USING(CTL1)         
//CTL1CNTL DD *                                 
  OPTION STOPAFT=1                              
  INCLUDE COND=(2,10,CH,EQ,CURDATE)             
/*
Frank Yaeger - DFSORT Development Team (IBM) - yaeger@us.ibm.com
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
=> DFSORT/MVS is on the Web at http://www.ibm.com/storage/dfsort

nareshv_99
Member
Posts: 25
Joined: Sun Feb 05, 2012 10:59 pm
Location: Bangalore

Post by nareshv_99 » Mon Feb 20, 2012 9:59 pm

Thanks Frank!

below piece of code also worked for me

//S1 EXEC PGM=ICETOOL
//TOOLMSG DD SYSOUT=*
//DFSMSG DD SYSOUT=*
//IN DD *
H2012-02-13
D RECORD 01
D RECORD 02
D RECORD 03
//TOOLIN DD *
COUNT FROM(IN) RC4 EMPTY USING(CTL1)
//CTL1CNTL DD *
OPTION STOPAFT=1
INCLUDE COND=(2,10,CH,EQ,DATE1(-))
/*


this gives RC=4 if the date is not matching with current date and gives RC=0 if matches.

could you clarify if we could set RC=8 using COUNT?
i think we can set RC 0,4,12 but not 8.

User avatar
Frank Yaeger
Moderator
Posts: 812
Joined: Sat Feb 18, 2006 5:45 am
Location: San Jose, CA
Contact:

Post by Frank Yaeger » Tue Feb 21, 2012 12:15 am

RC8 was added to DFSORT's ICETOOL in Nov, 2010.
Frank Yaeger - DFSORT Development Team (IBM) - yaeger@us.ibm.com
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
=> DFSORT/MVS is on the Web at http://www.ibm.com/storage/dfsort

Anuj Dhawan
Moderator
Posts: 1625
Joined: Sat Aug 09, 2008 9:02 am
Location: Mumbai, India

Post by Anuj Dhawan » Tue Feb 21, 2012 3:35 pm

Thanks Frank, that was needed.
Regards,
Anuj

Post Reply

FREE TUTORIALS

Tutorials
Free tutorials from mainframegurukul
  • JCL Tutorial
    Covers all important JCL concepts.
  • Cobol Tutorial
    This tutorials covers all Cobol Topics from STRING to COMP-3.
  • DB2 Tutorial
    DB2 Tutorial focuses on DB2 COBOL Programming.
  • SORT Tutorial
    This Tutorial covers all important aspects of DFSORT with examples
  • CICS Tutorial
    This CICS tutorial covers CICS concepts and CICS Basics, CICS COBOL Programming.
Interview
Mainframe Interview questions



Other References
Mainframe Tools and others