Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

sort date value (MMDDYY) using syncsort

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> JCL & VSAM
View previous topic :: :: View next topic  
Author Message
jaganmoni1

New User


Joined: 31 Oct 2008
Posts: 33
Location: CANADA

PostPosted: Wed Nov 30, 2011 6:34 am    Post subject: sort date value (MMDDYY) using syncsort
Reply with quote

I have a FB file and the LRECL is 80 bytes. I want to sort this file using date value. The date value (MMDDYY) is from column 4 to 9.
Could you please tell me how to sort date value using SYNCSORT?
Back to top
View user's profile Send private message

Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7315

PostPosted: Wed Nov 30, 2011 6:42 am    Post subject: Reply to: sort date value (MMDDYY) using syncsort
Reply with quote

Code:
  SORT FIELDS=(8.2.CH.A.4.2.CH.A.6.2.CH.A)


You can always take the CHs out by using FORMAT=CH outside the brackets.

or

Code:

//SYMNAMES DD *
DATE-YEAR,8,2,CH,A
DATE-MONTH,4,2,CH,A
DATE-DAY,6,2,CH,A
//SYSIN DD *
  SORT FIELDS=(DATE-YEAR,DATE-MONTH,DATE-DAY)


It is much more typing, I know, but it gives you (and future maintainers) a much better idea of what is happening.

Is this your first Sort?

EDIT: swapped the DD/MM around....
Back to top
View user's profile Send private message
jaganmoni1

New User


Joined: 31 Oct 2008
Posts: 33
Location: CANADA

PostPosted: Wed Nov 30, 2011 6:56 am    Post subject: Reply to: sort date value (MMDDYY) using syncsort
Reply with quote

Hi Bill,

Thank you very much for your quick response. The problem is the year might be from 80 (1980) to 11 (2011). Is there any way to convert year from YY to YYYY before sorting?
I mean if YY is >79 then YYYY is 19YY else 20YY.
Back to top
View user's profile Send private message
gcicchet

Senior Member


Joined: 28 Jul 2006
Posts: 1703
Location: Australia

PostPosted: Wed Nov 30, 2011 1:52 pm    Post subject:
Reply with quote

Hi,

this should help
Code:
//STEP001  EXEC PGM=SORT                                     
//SORTIN   DD *                                               
   010280                                                     
   122712                                                     
   061511                                                     
/*                                                           
//SORTOUT  DD SYSOUT=*                                       
//SYSOUT   DD SYSOUT=*                                       
//SYSIN    DD *                                               
  SORT FIELDS=(81,8,BI,A)                                     
  INREC IFTHEN=(WHEN=(8,2,ZD,GT,79),                         
       OVERLAY=(81:C'19',8,2,4,2,6,2)),                       
     IFTHEN=(WHEN=NONE,                                       
       OVERLAY=(81:C'20',8,2,4,2,6,2))                       
/*                                                           


Gerry
Back to top
View user's profile Send private message
kratos86

Active User


Joined: 17 Mar 2008
Posts: 148
Location: Anna NGR

PostPosted: Wed Nov 30, 2011 3:50 pm    Post subject:
Reply with quote

If you have SYNCSORT version 1.3 and above, use this one -

Code:
SORT FIELDS=(1,6,Y2W,A),CENTWIN=80 
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 -> JCL & VSAM All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts How to change 'K' or 'M' use Sort vice_versa DFSORT/ICETOOL 5 Thu May 18, 2017 7:11 am
No new posts Validate date and numeric fields and ... Rick Silvers DFSORT/ICETOOL 6 Thu May 11, 2017 6:51 pm
No new posts Adding big TEXT lines to each record ... bshkris SYNCSORT 4 Sat May 06, 2017 1:40 am
This topic is locked: you cannot edit posts or make replies. SORT trick needed bshkris SYNCSORT 6 Tue May 02, 2017 4:35 am
No new posts LISTIDR compiled date/time jerryte IBM Tools 3 Thu Apr 20, 2017 7:37 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us