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

DFSort- Date formatting


IBM Mainframe Forums -> DFSORT/ICETOOL
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
mssabirami

New User


Joined: 11 Feb 2008
Posts: 17
Location: Chennai

PostPosted: Wed Nov 18, 2009 3:40 pm
Reply with quote

Hi,

The input date needs be converted into mm/dd/ccyy format.

Input --------------------->Expected output
11/7/2009-----------------> 11/07/2009
1/27/2009-----------------> 01/27/2009
1/1/2009-------------------> 01/01/2009

If the month or date is in single digit, '0' needs to be prefixed.

Is there any way to solve this using DFSORT?
Back to top
View user's profile Send private message
gcicchet

Senior Member


Joined: 28 Jul 2006
Posts: 1702
Location: Australia

PostPosted: Wed Nov 18, 2009 4:13 pm
Reply with quote

Hi,

this is one way of achieving it
Code:
//STEP0100 EXEC PGM=SORT                                         
//SYSOUT   DD SYSOUT=*                                           
//SORTIN   DD *                                                   
11/7/2009                                                         
1/27/2009                                                         
1/1/2009                                                         
//SORTOUT  DD SYSOUT=*                                           
//SYSIN    DD *                                                   
   SORT FIELDS=COPY                                               
     INREC IFTHEN=(WHEN=(3,1,CH,EQ,C'/',&,5,1,CH,EQ,C'/'),       
                 BUILD=(1,3,C'0',4,6)),                           
           IFTHEN=(WHEN=(2,1,CH,EQ,C'/',&,5,1,CH,EQ,C'/'),       
                 BUILD=(C'0',1,9)),                               
           IFTHEN=(WHEN=(2,1,CH,EQ,C'/',&,4,1,CH,EQ,C'/'),       
                 BUILD=(C'0',1,2,C'0',3,6))                       
/*                                                               


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

New User


Joined: 11 Feb 2008
Posts: 17
Location: Chennai

PostPosted: Wed Nov 18, 2009 6:07 pm
Reply with quote

Thanks Gerry. Its working..
Back to top
View user's profile Send private message
Skolusu

Senior Member


Joined: 07 Dec 2007
Posts: 2205
Location: San Jose

PostPosted: Wed Nov 18, 2009 11:18 pm
Reply with quote

mssabirami,

Here is an alternative way of doing it

Code:

//STEP0100 EXEC PGM=SORT                                       
//SYSOUT   DD SYSOUT=*                                         
//SORTIN   DD *                                               
11/7/2009                                                     
1/27/2009                                                     
1/1/2009                                                       
//SORTOUT  DD SYSOUT=*                                         
//SYSIN    DD *                                               
 SORT FIELDS=COPY                                             
 INREC PARSE=(%00=(ENDBEFR=C'/',FIXLEN=2),                     
              %01=(ENDBEFR=C'/',FIXLEN=2),                     
              %02=(FIXLEN=4)),                                 
      BUILD=(%00,UFF,EDIT=(TT),C'/',%01,UFF,EDIT=(TT),C'/',%02)
//*
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 -> DFSORT/ICETOOL

 


Similar Topics
Topic Forum Replies
No new posts Replacing 'YYMMDD' with date, varying... SYNCSORT 3
No new posts Modifying Date Format Using DFSORT DFSORT/ICETOOL 9
No new posts Replace Multiple Field values to Othe... DFSORT/ICETOOL 12
No new posts Calling DFSORT from Cobol, using OUTF... DFSORT/ICETOOL 5
No new posts Need to convert date format DFSORT/ICETOOL 20
Search our Forums:

Back to Top