View previous topic :: View next topic
|
Author |
Message |
aqilis
New User
Joined: 23 Feb 2007 Posts: 17 Location: NOIDA
|
|
|
|
Hi ,
can DFSORT convert a JUlian-date to mm-dd-yyyyy format.
please give the code if possible.
Thanks. |
|
Back to top |
|
|
William Thompson
Global Moderator
Joined: 18 Nov 2006 Posts: 3156 Location: Tucson AZ
|
|
|
|
What is the format of the julian date? Zoned or packed decimal? Have you looked at the manual? |
|
Back to top |
|
|
aqilis
New User
Joined: 23 Feb 2007 Posts: 17 Location: NOIDA
|
|
|
|
William,
It is in Zoned-Decimal format: CP-END-DATE PIC 9(5)
Thanks |
|
Back to top |
|
|
William Thompson
Global Moderator
Joined: 18 Nov 2006 Posts: 3156 Location: Tucson AZ
|
|
|
|
As in YYDDD?
Have you looked at the manual? |
|
Back to top |
|
|
Frank Yaeger
DFSORT Developer
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
Do the yyddd dates all represent 20yyddd dates or do they represent 19yyddd and 20yyddd dates? |
|
Back to top |
|
|
aqilis
New User
Joined: 23 Feb 2007 Posts: 17 Location: NOIDA
|
|
|
|
Frank,
I think it will be 20-.
But can you give me the procedure for both of the cases.
Thanks regards
aquilis |
|
Back to top |
|
|
Frank Yaeger
DFSORT Developer
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
aquilis,
Here's a DFSORT job that shows how to do what you asked for. I assumed that your yyddd field is in positions 1-5 and you want a century window of 1950-2049.
Code: |
//S1 EXEC PGM=ICEMAN
//SYSOUT DD SYSOUT=*
//SORTIN DD *
06012
51001
50001
07100
49001
99012
/*
//SORTOUT DD SYSOUT=*
//SYSIN DD *
OPTION COPY
* If yy > 49, convert Z'yyddd' to X'00yydddC'
INREC IFTHEN=(WHEN=(1,2,ZD,GT,+49),
BUILD=(X'00',1,5,ZD,TO=PD,LENGTH=3)),
* If yy <= 49, convert Z'yyddd' to X'01yydddC'
IFTHEN=(WHEN=NONE,
BUILD=(X'01',1,5,ZD,TO=PD,LENGTH=3))
* Convert to X'00yydddC' to Z'19yymmdd'.
* Convert to X'01yydddC' to Z'20yymmdd'.
OUTREC IFTHEN=(WHEN=INIT,BUILD=(1,4,DT1)),
* Convert to Z'ccyymmdd' to C'mm-dd-ccyy'.
IFTHEN=(WHEN=INIT,
BUILD=(5,2,C'-',7,2,C'-',1,4))
/*
|
SORTOUT will have:
Code: |
01-12-2006
01-01-1951
01-01-1950
04-10-2007
01-01-2049
01-12-1999
|
|
|
Back to top |
|
|
Frank Yaeger
DFSORT Developer
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
With z/OS DFSORT V1R5 PTF UK51706 or z/OS DFSORT V1R10 PTF UK51707 (Nov, 2009), you now use DFSORT's new date conversion functions to do this kind of thing quite easily, like so:
Code: |
//S2 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SORTIN DD *
06012
51001
50001
07100
49001
99012
/*
//SORTOUT DD SYSOUT=*
//SYSIN DD *
OPTION COPY,Y2PAST=1950
INREC BUILD=(1,5,Y2T,TOGREG=Y4W(-))
/*
|
For complete details on date conversion functions and the other new functions available with the Nov, 2009 DFSORT PTF, see:
www.ibm.com/support/docview.wss?rs=114&uid=isg3T7000174 |
|
Back to top |
|
|
|