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

sort date value (MMDDYY) using syncsort


IBM Mainframe Forums -> JCL & VSAM
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
jaganmoni1

New User


Joined: 31 Oct 2008
Posts: 35
Location: CANADA

PostPosted: Wed Nov 30, 2011 6:34 am
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

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Wed Nov 30, 2011 6:42 am
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: 35
Location: CANADA

PostPosted: Wed Nov 30, 2011 6:56 am
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: 1702
Location: Australia

PostPosted: Wed Nov 30, 2011 1:52 pm
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
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 View Bookmarks
All times are GMT + 6 Hours
Forum Index -> JCL & VSAM

 


Similar Topics
Topic Forum Replies
No new posts Replacing 'YYMMDD' with date, varying... SYNCSORT 3
No new posts Need to set RC4 through JCL SORT DFSORT/ICETOOL 5
No new posts How to split large record length file... DFSORT/ICETOOL 10
No new posts Populate last day of the Month in MMD... SYNCSORT 2
No new posts Modifying Date Format Using DFSORT DFSORT/ICETOOL 9
Search our Forums:

Back to Top