|
View previous topic :: View next topic
|
| Author |
Message |
kushkush
New User
Joined: 30 Jun 2005 Posts: 37 Location: Germany
|
|
|
|
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 |
|
 |
sergeyken
Senior Member

Joined: 29 Apr 2008 Posts: 2263 Location: USA
|
|
|
|
| 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 |
|
 |
Joerg.Findeisen
Senior Member

Joined: 15 Aug 2015 Posts: 1424 Location: Bamberg, Germany
|
|
|
|
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 |
|
 |
sergeyken
Senior Member

Joined: 29 Apr 2008 Posts: 2263 Location: USA
|
|
|
|
| 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 |
|
 |
sergeyken
Senior Member

Joined: 29 Apr 2008 Posts: 2263 Location: USA
|
|
|
|
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 |
|
 |
|
|
 |
All times are GMT + 6 Hours |
|