Page 1 of 1

To compare Timestamp(26 Chars)

PostPosted: Tue Jan 20, 2009 10:46 pm
by praveen_nayak17
Could anyone help me get records which have timestamp(26 characters) greater than 7 days from a file which contains records having timestamp as one of the fields????
Sample field value for timestamp is 2009-01-20-12-00-00-00000

Re: To compare Timestamp(26 Chars)

PostPosted: Wed Jan 21, 2009 1:29 am
by dick scherrer
Hello and welcome to the forum,

To do what you want, use either an INCLUDE or an OMIT.

Re: To compare Timestamp(26 Chars)

PostPosted: Wed Jan 21, 2009 1:56 am
by Alissa Margulies
praveen_nayak17,

Just to clarify, do you want records that have a timestamp/date field which is more than 7 days from the current system date, meaning over a week old?

If this is the case, then the following sort job will give you the desired output:
//SORT1 EXEC PGM=SORT                   
//SORTIN DD *     
2009-01-20-12-00-00-00000   
2009-01-04-12-00-00-00000
2008-12-20-12-00-00-00000   
2009-01-18-12-00-00-00000   
2008-06-10-12-00-00-00000   
2009-01-13-12-00-00-00000   
//SORTOUT DD SYSOUT=*     
//SYSOUT DD SYSOUT=*     
//SYSIN DD *                               
   SORT FIELDS=COPY                           
   INCLUDE COND=(1,10,CH,LT,&DATE1(-)-7)     
/*     

The following records will be included in the output:
2009-01-04-12-00-00-00000
2008-12-20-12-00-00-00000
2008-06-10-12-00-00-00000

Re: To compare Timestamp(26 Chars)

PostPosted: Fri Jan 23, 2009 12:12 am
by praveen_nayak17
Hi Alissa Margulies

Thank you very much...you have understood my query.