DATE Comparision



Support for NetApp SyncSort for z/OS, Visual SyncSort, SYNCINIT, SYNCLIST and SYNCTOOL

DATE Comparision

Postby RajeshT » Mon Jan 31, 2011 8:50 pm

Good Morning !!

Can you help me comparing a DATE from a flat file to a fixed date. I have 6 byte date field in the form of MMDDYY at position 1 in the file. I wanted to remove all the records with the DATE greater than 01st OCT 2010.

Thank you.
Rajesh.
RajeshT
 
Posts: 22
Joined: Tue May 04, 2010 10:19 pm
Has thanked: 0 time
Been thanked: 0 time

Re: DATE Comparision

 

Re: DATE Comparision

Postby RajeshT » Tue Feb 08, 2011 6:22 pm

Can someone comment on DATE comparison please.

Thank you.
Rajesh.
RajeshT
 
Posts: 22
Joined: Tue May 04, 2010 10:19 pm
Has thanked: 0 time
Been thanked: 0 time

Re: DATE Comparision

Postby Robert Sample » Tue Feb 08, 2011 7:55 pm

What do you want comment on? It is obvious the comparison has to be done in two parts -- year first, then month and day since the format is MMDDYY. Date comparisons is one reason so many dates are stored in YYMMDD format. Have you searched the forum for solutions? Have you used Google to find solutions? There are plenty of examples of how to do this --- even in Syncsort -- available if you look.
Robert Sample
Global moderator
 
Posts: 3367
Joined: Sat Dec 19, 2009 8:32 pm
Location: Dubuque, Iowa, USA
Has thanked: 1 time
Been thanked: 222 times

Re: DATE Comparision

Postby Alissa Margulies » Wed Feb 09, 2011 2:21 am

Here is one example of how to accomplish this task:
//SORT1 EXEC PGM=SORT,PARM='CENTWIN=80'         
//SORTIN  DD *                                 
120109                                         
041810                                         
100110                                         
082211                                         
//SORTOUT DD SYSOUT=*                           
//SYSOUT  DD SYSOUT=*                           
//SYSIN   DD *                                 
  INREC OVERLAY=(10:5,2,1,4)                     
  SORT FIELDS=COPY                               
  OUTFIL INCLUDE=(10,6,Y2T,LE,101001),BUILD=(1,6)
/* 

Here is the output produced:
120109
041810
100110
Alissa Margulies
Syncsort Mainframe Product Services
201-930-8260
zos_tech@syncsort.com
Alissa Margulies
Global moderator
 
Posts: 369
Joined: Tue Feb 26, 2008 11:15 pm
Location: USA
Has thanked: 1 time
Been thanked: 1 time

Re: DATE Comparision

Postby Alissa Margulies » Wed Feb 09, 2011 2:27 am

Here is a more efficient method:
//SORT1 EXEC PGM=SORT,PARM='CENTWIN=80'                           
//SORTIN  DD *                                                   
120109                                                           
041810                                                           
100110                                                           
082211                                                           
//SORTOUT DD SYSOUT=*                                             
//SYSOUT  DD SYSOUT=*                                             
//SYSIN   DD *                                                   
  OMIT COND=(5,2,Y2C,GT,10,OR,(5,2,Y2C,EQ,10,AND,1,4,ZD,GT,1001))
  SORT FIELDS=COPY                                               
/*                                                               
Alissa Margulies
Syncsort Mainframe Product Services
201-930-8260
zos_tech@syncsort.com
Alissa Margulies
Global moderator
 
Posts: 369
Joined: Tue Feb 26, 2008 11:15 pm
Location: USA
Has thanked: 1 time
Been thanked: 1 time

Re: DATE Comparision

Postby RajeshT » Wed Feb 23, 2011 6:40 pm

Thank You very much Alissa. The code you've mentioned below worked for me. However, i have tried the code pasted below earlier and it too had given the expected result :- created the 4 digit year and them performed the comparison.

INREC IFTHEN=(WHEN=(63,2,CH,GT,C'11'),
OVERLAY=(65:63,2,63:C'19'),HIT=NEXT),
IFTHEN=(WHEN=(63,2,CH,LE,C'11',&,63,2,CH,GE,C'00'),
OVERLAY=(65:63,2,63:C'20'),HIT=NEXT),
IFTHEN=(WHEN=(59,6,CH,EQ,C' '),
OVERLAY=(59:C' '))
SORT FIELDS=COPY

Thank You for the help.

Rajesh.
RajeshT
 
Posts: 22
Joined: Tue May 04, 2010 10:19 pm
Has thanked: 0 time
Been thanked: 0 time


Return to Syncsort/Synctool

 


  • Related topics
    Replies
    Views
    Last post