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
 

 

DFSort- Date formatting

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
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    Post subject: DFSort- Date formatting
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: 1703
Location: Australia

PostPosted: Wed Nov 18, 2009 4:13 pm    Post subject:
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    Post subject: Reply to: DFSort- Date formatting
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    Post subject:
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    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Validate date and numeric fields and ... Rick Silvers DFSORT/ICETOOL 6 Thu May 11, 2017 6:51 pm
No new posts LISTIDR compiled date/time jerryte IBM Tools 3 Thu Apr 20, 2017 7:37 pm
No new posts SUBSTR for Date functions Shaheen Shaik DB2 4 Thu Apr 06, 2017 2:14 pm
No new posts DFSORT - Overriding default option TU... Steve Ironmonger DFSORT/ICETOOL 3 Tue Apr 04, 2017 3:54 pm
No new posts Formatting VB File Learncoholic DFSORT/ICETOOL 3 Mon Mar 20, 2017 12:29 pm


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