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

Date format conversion


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

New User


Joined: 30 Jun 2005
Posts: 37
Location: Germany

PostPosted: Wed Oct 28, 2020 8:34 pm
Reply with quote

I can not find the exact format abbreviation from ccyy/mm/dd to dd/mm/ccyy. The following conversion works. Any help from experts here?
Code:

//S1       EXEC  PGM=SORT             
//SYSOUT   DD  SYSOUT=*               
//SORTIN   DD  *                       
2020/10/21                             
2020/01/31                             
//SORTOUT  DD  SYSOUT=*               
//SYSIN    DD  *                       
  OPTION COPY                         
  OUTREC BUILD=(9,2,C'/',6,2,C'/',1,4)

Result:
21/10/2020
31/01/2020
Back to top
View user's profile Send private message
sergeyken

Senior Member


Joined: 29 Apr 2008
Posts: 2022
Location: USA

PostPosted: Wed Oct 28, 2020 10:18 pm
Reply with quote

Code:
// EXEC PGM=SORT,PARM=‘CENTWIN=99’
. . . . . . .
//SYSIN    DD *
 INREC BUILD=(1,10,UFF,TO=ZD,LENGTH=8)
 SORT FIELDS=COPY
 OUTREC BUILD=(3,6,Y2T,DT=(DM4/))
 END
//*
Back to top
View user's profile Send private message
Joerg.Findeisen

Senior Member


Joined: 15 Aug 2015
Posts: 1252
Location: Bamberg, Germany

PostPosted: Wed Oct 28, 2020 11:25 pm
Reply with quote

Wouldn't be a Y4T be more appropriate?

Code:
//SYSIN    DD *                           
  OPTION COPY                             
  INREC BUILD=(1,10,UFF,TO=ZD,LENGTH=8)   
  OUTREC BUILD=(1,8,Y4T,DT=(DM4/))       
/*
Back to top
View user's profile Send private message
sergeyken

Senior Member


Joined: 29 Apr 2008
Posts: 2022
Location: USA

PostPosted: Thu Oct 29, 2020 4:16 am
Reply with quote

Joerg.Findeisen wrote:
Wouldn't be a Y4T be more appropriate?

Code:
//SYSIN    DD *                           
  OPTION COPY                             
  INREC BUILD=(1,10,UFF,TO=ZD,LENGTH=8)   
  OUTREC BUILD=(1,8,Y4T,DT=(DM4/))       
/*

Yes, that’s good, too.

Y4T was introduced much later than Y2T, and rarely used.
That’s why it did not come to my mind at the first moment.
About 90-95% of all needed date conversions actually require conversion from 2-digit year to 4-digit.

In this particular case Y4T makes more sense, I agree.
Back to top
View user's profile Send private message
sergeyken

Senior Member


Joined: 29 Apr 2008
Posts: 2022
Location: USA

PostPosted: Thu Oct 29, 2020 6:26 pm
Reply with quote

In real circumstances, it would be better to override the input date value in-place, and in one shot, in either of INREC, OUTREC, OUTFIL statements:
Code:
 INREC IFTHEN=(WHEN=INIT,OVERLAY=(1:1,10,UFF,TO=ZD,LENGTH=10)),
       IFTHEN=(WHEN=INIT,OVERLAY=(1:3,8,Y4T,DT=(DM4/)))
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 Populate last day of the Month in MMD... SYNCSORT 2
No new posts Modifying Date Format Using DFSORT DFSORT/ICETOOL 9
No new posts 10 byte RBA conversion DB2 2
No new posts 10 byte RBA conversion -non applicati... JCL & VSAM 1
Search our Forums:

Back to Top