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: 7251

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 Syncsort Help to group fields sudhakarraju SYNCSORT 6 Thu Dec 29, 2016 1:38 am
No new posts syncsort: copy lines after the keyword shreya19 SYNCSORT 7 Fri Dec 02, 2016 9:47 am
No new posts Limit duplicate records in the SORT pshongal SYNCSORT 6 Mon Nov 21, 2016 12:54 pm
No new posts How to convert the VBM file to VB or... Sulabh Agrawal JCL & VSAM 4 Fri Nov 18, 2016 1:04 pm
No new posts TOT & DATE parameter in ICEMAN hemanthj642 DFSORT/ICETOOL 4 Mon Nov 14, 2016 5:19 am


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