Compare x(26) Timestamp using Sort JCL



IBM's flagship sort product DFSORT for sorting, merging, copying, data manipulation and reporting. Includes ICETOOL and ICEGENER

Compare x(26) Timestamp using Sort JCL

Postby sganja » Mon Jul 01, 2013 3:12 pm

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,
sganja
 
Posts: 13
Joined: Wed Feb 06, 2013 8:58 pm
Has thanked: 1 time
Been thanked: 0 time

Re: Compare x(26) Timestamp using Sort JCL

Postby Robert Sample » Mon Jul 01, 2013 5:11 pm

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?
Robert Sample
Global moderator
 
Posts: 3719
Joined: Sat Dec 19, 2009 8:32 pm
Location: Dubuque, Iowa, USA
Has thanked: 1 time
Been thanked: 279 times

Re: Compare x(26) Timestamp using Sort JCL

Postby sganja » Mon Jul 01, 2013 5:48 pm

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
'
sganja
 
Posts: 13
Joined: Wed Feb 06, 2013 8:58 pm
Has thanked: 1 time
Been thanked: 0 time

Re: Compare x(26) Timestamp using Sort JCL

Postby NicC » Mon Jul 01, 2013 6:03 pm

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.
The problem I have is that people can explain things quickly but I can only comprehend slowly.
Regards
Nic
NicC
Global moderator
 
Posts: 3025
Joined: Sun Jul 04, 2010 12:13 am
Location: Pushing up the daisies (almost)
Has thanked: 4 times
Been thanked: 136 times

Re: Compare x(26) Timestamp using Sort JCL

Postby skolusu » Mon Jul 01, 2013 9:44 pm

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)           
//*
Kolusu - DFSORT Development Team (IBM)
DFSORT is on the Web at:
www.ibm.com/storage/dfsort

These users thanked the author skolusu for the post:
sganja (Thu Jun 11, 2015 12:00 pm)
skolusu
 
Posts: 586
Joined: Wed Apr 02, 2008 10:38 pm
Has thanked: 0 time
Been thanked: 39 times


Return to DFSORT/ICETOOL/ICEGENER

 


  • Related topics
    Replies
    Views
    Last post