Page 1 of 1

Compare the date with current date.

PostPosted: Tue Dec 02, 2008 8:17 pm
by bodhi
Hello All,

I have to compare a header date of the file with the current date through JCL.Header date format is YY/MM/DD.Please adivce.I have to do this with JCL ONLY.

Thanks
Bodhi

Re: Compare the date with current date.

PostPosted: Tue Dec 02, 2008 9:10 pm
by ranga_subham
Hi,

Please show the sample records.

Thanks.

Re: Compare the date with current date.

PostPosted: Tue Dec 02, 2008 10:16 pm
by Alissa Margulies
bodhi wrote:I have to compare a header date of the file with the current date

Your request is not clear. What do you want in the output? Please show some sample input and output records.

Re: Compare the date with current date.

PostPosted: Tue Dec 02, 2008 10:30 pm
by bodhi
Hello,

Let me put my request in this way. I need to compare the header date which is the first record of the dataset to the current date(system date).I want to do this so that always new/current date file processed through the system and if the date is not equal to system date then the job must abend and aviod the processing of wrong file.

The date format is YY/MM/DD.

Thanks

Re: Compare the date with current date.

PostPosted: Wed Dec 03, 2008 12:04 am
by Alissa Margulies
Assuming the date field is in position 1-8, you can code the following step prior to your job:
//SORT1 EXEC PGM=SORT,PARM='CENTWIN=80,NULLOUT=RC4' 
//SORTIN  DD DSN=INPUT.FILE,DISP=SHR
//SORTOUT DD SYSOUT=*         
//SYSOUT  DD SYSOUT=*                               
//SYSIN   DD *                                       
   INREC FIELDS=(1,2,4,2,7,2)                         
   SORT FIELDS=COPY,STOPAFT=1                         
   OUTFIL INCLUDE=(1,6,Y2T,EQ,Y'DATE1') 
/*

If the header date matches the current system date, you should get RC=0. However, if it does not match, a RC=4 should be produced.

Then you can code COND=(0,NE,SORT1) on the EXEC statement of the following step(s). This instructs the next STEP to only execute if SORT1 got a RC=0. If SORT1 did not get a RC=0, then the following step(s) will be bypassed.

Re: Compare the date with current date.

PostPosted: Wed Dec 03, 2008 3:40 pm
by ranga_subham
Hi,

I was trying out below code but got "WER251A INCLUDE/OMIT INVALID LENGTH". :shock:

//STEP0001 EXEC PGM=ICEMAN,PARM='CENTWIN=80,NULLOUT=RC4'
//SORTOUT  DD SYSOUT=*                                 
//SYSOUT   DD SYSOUT=*                                 
//SORTIN   DD *                                         
20081103                                               
20081203                                               
20081303                                               
20081403                                               
20081503                                               
//SYSIN    DD *                                         
 SORT FIELDS=COPY                                       
 INCLUDE COND=(1,8,Y2T,EQ,Y'DATE1')                     
/*                                                     
//*                                                     


Would you please let me know where I was going wrong :?:

Thank you.

Re: Compare the date with current date.

PostPosted: Wed Dec 03, 2008 3:51 pm
by ranga_subham
Hi,

I got my mistake and corrected the SYSIN to get the results :D

//SYSIN    DD *                   
 SORT FIELDS=COPY                 
 INCLUDE COND=(3,6,Y2T,EQ,Y'DATE1')
/*                                 


Sorry for the confusion 8-)

Re: Compare the date with current date.

PostPosted: Thu Dec 04, 2008 1:12 am
by Alissa Margulies
Thanks for letting us know you were able to resolve the issue.

Re: Compare the date with current date.

PostPosted: Fri Dec 05, 2008 11:38 pm
by bodhi
Hi Alissa,

Thank you for the help. This is exactly the same which i am looking for.One more request could you please let me know is there is any onlin book from where i can brush up my knowledge on SORT utility.

Thank you
Bodhi

Re: Compare the date with current date.

PostPosted: Sat Dec 06, 2008 12:31 am
by Alissa Margulies
Bodhi,

Contact me offline at alissa.margulies@syncsort.com or send me a private message. You will just need to provide me with your SyncSort license information (company name, CPU serial number, and corporate email address) and I can send you a pdf version of the manuals.