IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Compare input date as YYMMDD with the same in SynSort


IBM Mainframe Forums -> SYNCSORT
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
Khurshid_Khan

New User


Joined: 21 Feb 2020
Posts: 2
Location: usa

PostPosted: Fri Feb 21, 2020 10:28 pm
Reply with quote

Hi,
I have a 6-digit date field as YYMMDD in column 2 of input file. The requirement is to sort the file and OMIT any records with date less than current date. I can use the Y2T for my input data but I cannot find the date variable in SyncSort representative of the YYMMDD. Any help is appreciated.
Back to top
View user's profile Send private message
Rohit Umarjikar

Global Moderator


Joined: 21 Sep 2010
Posts: 3051
Location: NYC,USA

PostPosted: Fri Feb 21, 2020 11:05 pm
Reply with quote

One way is,
Code:
//SORTIN   DD  *                             
D200219                                       
D200221                                       
D200222                                       
D200217                                       
//SORTOUT  DD  SYSOUT=*                       
//SYSIN    DD    *                           
 SORT FIELDS=(2,6,ZD,A)                       
 INREC IFTHEN=(WHEN=INIT,OVERLAY=(81:DATE1)) 
 OUTFIL REMOVECC,FNAMES=SORTOUT,             
 BUILD=(1,7),INCLUDE=(2,6,ZD,LT,83,6,ZD)     

output:
Code:
*********
D200217 
D200219 
*********
Back to top
View user's profile Send private message
Joerg.Findeisen

Senior Member


Joined: 15 Aug 2015
Posts: 1246
Location: Bamberg, Germany

PostPosted: Fri Feb 21, 2020 11:48 pm
Reply with quote

Code:
//DATEDIFF EXEC PGM=SORT                                   
//SYSOUT   DD SYSOUT=*                                     
//SORTIN   DD *                                           
D200219                                                   
D200221                                                   
D200222                                                   
D200217                                                   
D991231                                                   
//SORTOUT  DD SYSOUT=*                                     
//SYSIN    DD *                                           
  INREC IFTHEN=(WHEN=INIT,                                 
    OVERLAY=(81:DATE1,81:2,6,Y2T,DATEDIFF,81,8,Y4T))       
  SORT FIELDS=(81,8,SFF,A)                                 
  OUTFIL FNAMES=(SORTOUT),                                 
    INCLUDE=(81,8,SFF,LT,+0), * anything at least one day old here?
    BUILD=(1,7)                                           
/*

Output:
Code:
D991231
D200217
D200219
Back to top
View user's profile Send private message
Khurshid_Khan

New User


Joined: 21 Feb 2020
Posts: 2
Location: usa

PostPosted: Sat Feb 22, 2020 12:33 am
Reply with quote

Thank you much. Let me try this on my own.
Back to top
View user's profile Send private message
Rohit Umarjikar

Global Moderator


Joined: 21 Sep 2010
Posts: 3051
Location: NYC,USA

PostPosted: Sat Feb 22, 2020 1:14 am
Reply with quote

Joerg, Why add extra DATEDIFF when we can avoid it ?
Back to top
View user's profile Send private message
Joerg.Findeisen

Senior Member


Joined: 15 Aug 2015
Posts: 1246
Location: Bamberg, Germany

PostPosted: Sat Feb 22, 2020 1:24 am
Reply with quote

@Rohit: It's intended for interested parties to see a different approach.
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> SYNCSORT

 


Similar Topics
Topic Forum Replies
No new posts TRIM everything from input, output co... DFSORT/ICETOOL 1
No new posts Replacing 'YYMMDD' with date, varying... SYNCSORT 3
No new posts Extracting Variable decimal numbers f... DFSORT/ICETOOL 17
No new posts Modifying Date Format Using DFSORT DFSORT/ICETOOL 9
No new posts Compare only first records of the fil... SYNCSORT 7
Search our Forums:

Back to Top