Portal | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Forum Index
 
Register
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Profile Log in to check your private messages Log in
 
Compare input date as YYMMDD with the same in SynSort

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> SYNCSORT
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    Post subject: Compare input date as YYMMDD with the same in SynSort
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

Senior Member


Joined: 21 Sep 2010
Posts: 2466
Location: NY,USA

PostPosted: Fri Feb 21, 2020 11:05 pm    Post subject:
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

Active User


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

PostPosted: Fri Feb 21, 2020 11:48 pm    Post subject:
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    Post subject:
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

Senior Member


Joined: 21 Sep 2010
Posts: 2466
Location: NY,USA

PostPosted: Sat Feb 22, 2020 1:14 am    Post subject:
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

Active User


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

PostPosted: Sat Feb 22, 2020 1:24 am    Post subject:
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    IBMMAINFRAMES.com Support Forums -> SYNCSORT All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Dynamically read input files using BP... Srinivas B COBOL Programming 20 Sat Sep 05, 2020 1:48 pm
No new posts Compare two character variables Head ... Harold Barnes CLIST & REXX 3 Fri Aug 28, 2020 12:38 am
No new posts Required Date Format in Include Sort ... vivky_vivek DFSORT/ICETOOL 6 Fri Aug 14, 2020 6:52 am
No new posts Trying to add current date in place o... shub2204 DFSORT/ICETOOL 8 Wed Aug 12, 2020 4:14 pm
No new posts Populating Date and Sequence numer in... PORYES SYNCSORT 11 Thu Jul 16, 2020 5:01 pm

Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us