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
 

 

Converting date in format 25DEC10 to 2010/12/25

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
View previous topic :: :: View next topic  
Author Message
sagarnsydney

New User


Joined: 12 Dec 2008
Posts: 16
Location: sydney

PostPosted: Thu Dec 30, 2010 7:47 am    Post subject: Converting date in format 25DEC10 to 2010/12/25
Reply with quote

I have a requirement to convert date from the format 25DEC10 to 2010/12/25.

Regards,
Sagar
Back to top
View user's profile Send private message

Guest







PostPosted: Thu Dec 30, 2010 10:39 am    Post subject:
Reply with quote

Hi Sagar,
I have come up with this solution:
Code:

//SORTIN   DD *                                               
25DEC10                                                       
//SORTOUT     DD SYSOUT=*                                     
//SYSIN    DD *                                               
  OPTION COPY                                                 
  INREC IFTHEN=(WHEN=(3,3,CH,EQ,C'JAN'),OVERLAY=(8:C'20',6,2, 
                C'/01/',1,2)),                                 
        IFTHEN=(WHEN=(3,3,CH,EQ,C'FEB'),OVERLAY=(8:C'20',6,2, 
                C'/02/',1,2)),                                 
        IFTHEN=(WHEN=(3,3,CH,EQ,C'MAR'),OVERLAY=(8:C'20',6,2, 
                C'/03/',1,2)),                                 
        IFTHEN=(WHEN=(3,3,CH,EQ,C'APR'),OVERLAY=(8:C'20',6,2, 
                C'/04/',1,2)),                                 
        IFTHEN=(WHEN=(3,3,CH,EQ,C'MAY'),OVERLAY=(8:C'20',6,2, 
                C'/05/',1,2)),                                 
        IFTHEN=(WHEN=(3,3,CH,EQ,C'JUN'),OVERLAY=(8:C'20',6,2, 
                C'/06/',1,2)),                                 
        IFTHEN=(WHEN=(3,3,CH,EQ,C'JUL'),OVERLAY=(8:C'20',6,2, 
                C'/07/',1,2)),                                 
        IFTHEN=(WHEN=(3,3,CH,EQ,C'AUG'),OVERLAY=(8:C'20',6,2, 
                C'/08/',1,2)),                                 
        IFTHEN=(WHEN=(3,3,CH,EQ,C'SEP'),OVERLAY=(8:C'20',6,2, 
                C'/09/',1,2)),                                 
        IFTHEN=(WHEN=(3,3,CH,EQ,C'OCT'),OVERLAY=(8:C'20',6,2, 
                C'/10/',1,2)),                                 
        IFTHEN=(WHEN=(3,3,CH,EQ,C'NOV'),OVERLAY=(8:C'20',6,2, 
                C'/11/',1,2)),                                 
        IFTHEN=(WHEN=(3,3,CH,EQ,C'DEC'),OVERLAY=(8:C'20',6,2, 
                C'/12/',1,2))                                 
  OUTREC BUILD=(8,10)                                         
/*                                                             


Assumption: Year after 2000.

Devil13
There definitely is a better solution
Back to top
sagarnsydney

New User


Joined: 12 Dec 2008
Posts: 16
Location: sydney

PostPosted: Tue Jan 04, 2011 7:18 am    Post subject:
Reply with quote

Hi devil13,

Thanks for quick response. Is there any other way using date predefined functions in SORT to achieve the result....

Sagar
Back to top
View user's profile Send private message
Skolusu

Senior Member


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

PostPosted: Wed Jan 05, 2011 12:54 am    Post subject: Reply to: Converting date in format 25DEC10 to 2010/12/25
Reply with quote

sagarnsydney,

There are no built-in functions to convert the date in text form. Here is another way of getting the desired results which also performs a date validity check.

Code:

//STEP0100 EXEC PGM=SORT                                     
//SYSOUT   DD SYSOUT=*                                       
//SORTIN   DD *                                             
25DEC10                                                     
//SORTOUT  DD SYSOUT=*                                       
//SYSIN    DD *                                             
  SORT FIELDS=COPY                                           
  INREC IFOUTLEN=80,                                         
  IFTHEN=(WHEN=INIT,OVERLAY=(81:3,3,1,2,6,2)),               
  IFTHEN=(WHEN=INIT,FINDREP=(STARTPOS=81,                   
          INOUT=(C'JAN',C'01',C'FEB',C'02',C'MAR',C'03',     
                 C'APR',C'04',C'MAY',C'05',C'JUN',C'06',     
                 C'JUL',C'07',C'AUG',C'08',C'SEP',C'09',     
                 C'OCT',C'10',C'NOV',C'11',C'DEC',C'12'))), 
  IFTHEN=(WHEN=INIT,OVERLAY=(81,6,Y2W,TOGREG=Y4T(/)))       
//*
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 How to pick only YYMMDD from DATE1P (... atulbaviskar SYNCSORT 7 Wed Mar 22, 2017 11:39 am
No new posts Date and time format in CICS Chandru3183 CICS 2 Sat Mar 18, 2017 12:46 pm
No new posts How to get current date -1 and curren... murali.andaluri DFSORT/ICETOOL 3 Wed Mar 08, 2017 2:09 pm
No new posts Overlay the system date Danielle.Filteau SYNCSORT 4 Fri Mar 03, 2017 1:16 am
No new posts Checking Current date vickey_dw DFSORT/ICETOOL 1 Wed Feb 08, 2017 11:14 pm


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