Page 1 of 1

Comparing Date with current date

Posted: Sat Feb 11, 2012 8:14 pm
by nareshv_99
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 ?

Posted: Tue Feb 14, 2012 12:08 am
by Frank Yaeger
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)             
/*

Posted: Mon Feb 20, 2012 9:59 pm
by nareshv_99
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.

Posted: Tue Feb 21, 2012 12:15 am
by Frank Yaeger
RC8 was added to DFSORT's ICETOOL in Nov, 2010.

Posted: Tue Feb 21, 2012 3:35 pm
by Anuj Dhawan
Thanks Frank, that was needed.