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
Warnings : 2

Senior Member


Joined: 29 Apr 2008
Posts: 1228

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 Member


Joined: 15 Aug 2015
Posts: 628
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
Warnings : 2

Senior Member


Joined: 29 Apr 2008
Posts: 1228

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
Warnings : 2

Senior Member


Joined: 29 Apr 2008
Posts: 1228

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 To re-format the file using SORT card DFSORT/ICETOOL 6
No new posts SORT for dynamic trailer record + CSV... DFSORT/ICETOOL 14
No new posts Date conversation DFSORT/ICETOOL 6
No new posts To pull the file with Date and Time u... TSO/ISPF 17
No new posts Help this REXX Rookie-Bad arithmetic ... CLIST & REXX 7
Search our Forums:

Back to Top