IBM Mainframe Forum Index
 
Register
 
IBM Mainframe Forum Index Mainframe: Search Log in to check your private messages Log in
 

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: 36
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

Active Member


Joined: 29 Apr 2008
Posts: 876
Location: Maryland

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

Active User


Joined: 15 Aug 2015
Posts: 350
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

Active Member


Joined: 29 Apr 2008
Posts: 876
Location: Maryland

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

Active Member


Joined: 29 Apr 2008
Posts: 876
Location: Maryland

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 All times are GMT + 6 Hours
Forum Index -> DFSORT/ICETOOL
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Forum Replies
No new posts Hex Value - vb file replace old date ... DFSORT/ICETOOL 14
No new posts EBCDIC to ASCII conversion help All Other Mainframe Topics 1
No new posts Required Date Format in Include Sort ... DFSORT/ICETOOL 6
No new posts Trying to add current date in place o... DFSORT/ICETOOL 8
No new posts Populating Date and Sequence numer in... SYNCSORT 11

Back to Top