Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist 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: 7314

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 Reformatting and adding additional fi... Badbeef SYNCSORT 6 Thu Apr 05, 2018 4:45 pm
No new posts Sort numeric fields with trailing spaces sancraig16 SYNCSORT 7 Tue Apr 03, 2018 1:21 am
No new posts Find & Replace string in CA-SORT mrgnndhmk CA Products 1 Fri Mar 30, 2018 12:58 am
No new posts SORT 3 files,extract specific fields ... Kiransr DFSORT/ICETOOL 13 Fri Mar 23, 2018 10:54 am
No new posts How to Generate JCL using Sort naveen katkuri DFSORT/ICETOOL 7 Tue Mar 13, 2018 3:50 pm

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