Page 1 of 1

Compare x(26) Timestamp using Sort JCL

PostPosted: Mon Jul 01, 2013 3:12 pm
by sganja
Hi All,

There is an input PS file containing records with Timestamp X(26) - DB2 Timestamp. I am trying to filter out the records which are 24 hours old.

Eg:2013-06-27-00.18.57.018696

Approach 1
Writing JCL with SORT to compare timestamp with current system time and filtering out the recods.I am using SORT util to compare and filter the records but not getting desired results.

Is SORT can be used to compare X(26) timestamp or not ?

Thanks,

Re: Compare x(26) Timestamp using Sort JCL

PostPosted: Mon Jul 01, 2013 5:11 pm
by Robert Sample
Your post is remarkably lacking in important details, such as:

- which SORT product are you using?
- what command(s) are you using in your SORT product?
- what results are you getting, and what results do you think you should be getting?

Re: Compare x(26) Timestamp using Sort JCL

PostPosted: Mon Jul 01, 2013 5:48 pm
by sganja
Hi Robert,
I am using simple SORT and following is the code. I am trying to Filter the records which are 24 hours OLD from Current TIME.
While using Date1 and Date2 able to filter with Date only but TIME is not considering in it. I am trying to use DATE4 and DATE5.

Is there any other way other than using SORT.

'//STEP010 EXEC PGM=SORT,REGION=0M
//SORTIN DD DSN=ABC.INFILE,DISP=SHR
//SORTOUT DD DSN=ABC.OUTFILE(+1),
//SYSIN DD *
SORT FIELDS=COPY
INCLUDE COND=(01,26,CH,LT,&DATE5(-)-1)
/* '

SAMPLE INFILE:
'
2013-06-27-00.18.57.018696
2013-06-27-00.48.27.511711
2013-06-27-00.56.32.568705
2013-06-27-16.00.24.094493
2013-06-27-16.36.36.435835
2013-06-27-16.47.36.665733
'

Re: Compare x(26) Timestamp using Sort JCL

PostPosted: Mon Jul 01, 2013 6:03 pm
by NicC
I am using simple SORT

As far as I am aware there is no such product on the mainframe. There is Syncsort, DFsort, CAsort and possibly some others. Executing PGM=SORT does not exectute a program called SORT- it executes a program with an alias of SORT. To find out which product you are using look at the SYSOUT. For SYNCSORT the messages begin WER and for DFSort they begin ICE. Assuming you have DFSort I will move this to the DFSort part of the forum. If you use SYNCSORT I will move it on at a later time.

Re: Compare x(26) Timestamp using Sort JCL

PostPosted: Mon Jul 01, 2013 9:44 pm
by skolusu
DFSORT does not allow arithmetic on DATE5. So you first filter out records using DATE1-1 and then use INREC to build the timestamp once again and filter the records using that timestamp once again using OUTFIL

I assumed your input has RECFM=FB and LRECL=80
//SYSIN    DD *                                               
  OPTION COPY                                                 
  INCLUDE COND=(1,10,CH,LE,DATE1(-)-1)                         
  INREC OVERLAY=(81:DATE5,81:DATE1(-)-1)                       
  OUTFIL BUILD=(1,80),INCLUDE=(1,26,CH,LT,81,26,CH)           
//*