View previous topic :: View next topic
|
Author |
Message |
ojdiaz
New User
Joined: 19 Nov 2008 Posts: 98 Location: Spain
|
|
|
|
Hi there. Is there a way to convert a YYYY-MM-DD or YYYYMMDD or YYMMDD date to a YYYYDDD format?
I need to get a julian format date, that is, current year and current day from 1 to 366, as example, february 1 of 2009 would look like 2009032
I was browsing through several date formats, like DT3, but I can't get it to work on an outrec or inrec sort steps
Thanks a lot
Oliver |
|
Back to top |
|
|
Mazahar
New User
Joined: 11 Dec 2007 Posts: 82 Location: hyderabad
|
|
|
|
Oliver,
Try this
//step01 exec pgm=iceman
//sysout dd sysout=*
//sortin dd *
dummy record
//sortout dd dsn= ..... << u r o/p ds
//sysin dd *
option copy
outrec build=(YDDDNS=(DY))
/* |
|
Back to top |
|
|
Frank Yaeger
DFSORT Developer
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
Oliver,
Do you want the current date as a yyyyddd date? If so, then either of these OUTREC statements would do it:
Code: |
OUTREC BUILD=(DATE3)
|
Code: |
OUTREC BUILD=(YDDDNS=(4D))
|
Or are you trying to convert a gregorian date field in your records to a julian date field? If so, then what is the starting position, length and format of the gregorian date? What is the RECFM and LRECL of the input file? |
|
Back to top |
|
|
Frank Yaeger
DFSORT Developer
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
Mazahar,
Your OUTREC statement would give a dddyy date, not a yyyyddd date.
We have two DFSORT developers who answer questions in this Forum, so we really don't need your "help". But if you feel the need to post here, please test your "solutions" before posting them to make sure they do what was asked. |
|
Back to top |
|
|
Mazahar
New User
Joined: 11 Dec 2007 Posts: 82 Location: hyderabad
|
|
|
|
Frank,
Thank You, I will not post any answer from now, Only Questions.
And coming to my reply to the question, its well tested and executed. It will give you date in DDDYY format only. You can check it out once. |
|
Back to top |
|
|
Frank Yaeger
DFSORT Developer
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
Quote: |
And coming to my reply to the question, its well tested and executed. It will give you date in DDDYY format only. You can check it out once. |
Yes, it gives you a DDDYY format. But if you go back to the first post, you'll see that the requester asked for "a YYYYDDD format", not a DDDYY format. DDDYY and YYYYDDD are NOT the same. A "well tested" solution does not just validate that a value is produced - it validates that the requested value is produced. |
|
Back to top |
|
|
Arun Raj
Moderator
Joined: 17 Oct 2006 Posts: 2481 Location: @my desk
|
|
|
|
Quote: |
A "well tested" solution does not just validate that a value is produced - it validates that the requested value is produced. |
Mazahar,
And even if it produces the requested value for you, it might not work the same way in DFSORT (or vice versa), given that you use SyncSort as your other posts say. |
|
Back to top |
|
|
ojdiaz
New User
Joined: 19 Nov 2008 Posts: 98 Location: Spain
|
|
|
|
Hello there... I'm sorry it took me to long to answer my own question, but i got sick and i just got back to work today.
Anyways, Sorry if my question wasn't clear enough, and it raised some troubles
For the purposes if this request, I have an input file of 300 bytes LRECL and Format FB, and the date is in format CH, like: YYYYMMDD (character format - 4 bytes for the Year 2 bytes for the month and 2 bytes for the day). The exact position in the file is starting col: 8, length 8.
So, my request is to transform those fields in the input record to a YYYYDDD julian format date (7 bytes length)
Thanks again for your valuable answers
Best Regards
Oliver
PD - For testing purposes before attempting to convert the large input file I'm using this code:
Code: |
//PASO001 EXEC PGM=SORT
//SORTIN DD *
20090520
20090521
20090522
20090523
20090524
20090525
20090526
20090527
20090610
//SORTOUT DD SYSOUT=*
//SYSOUT DD SYSOUT=*
//SYSPRINT DD SYSOUT=*
//SYSIN DD *
SORT FIELDS=COPY
build fields=((1,4....
|
Is not fiinished yet, and just to test the convertion process |
|
Back to top |
|
|
Skolusu
Senior Member
Joined: 07 Dec 2007 Posts: 2205 Location: San Jose
|
|
Back to top |
|
|
ojdiaz
New User
Joined: 19 Nov 2008 Posts: 98 Location: Spain
|
|
|
|
Thanks Skolosu. I'll try that and I'll let you know my results. It was an interesting discussion about the 400 years window, of which i was not aware of it |
|
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, you can now use the new date conversion function TOJUL to do this kind of thing much easier, like so:
Code: |
//PASO001 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SORTIN DD *
20090520
20090521
20090522
20090523
20090524
20090525
20090526
20090527
20090610
//SORTOUT DD SYSOUT=*
//SYSIN DD *
SORT FIELDS=COPY
INREC BUILD=(1,8,Y4T,TOJUL=Y4T)
|
SORTOUT would have:
Code: |
2009140
2009141
2009142
2009143
2009144
2009145
2009146
2009147
2009161
|
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 |
|
|
ojdiaz
New User
Joined: 19 Nov 2008 Posts: 98 Location: Spain
|
|
|
|
I see this release is quite new. November 2009. How could i check if my shop has this new functions installed?
Thanks for the info. It would be quite valuable
Best regards
Oliver |
|
Back to top |
|
|
Frank Yaeger
DFSORT Developer
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
The Nov, 2009 PTF was available as of 11/18.
See the following which explains how to tell which functional PTF level you have:
ibmmainframes.com/viewtopic.php?t=33389
If you don't have the new PTF, ask your System Programmer to install it (it's free). |
|
Back to top |
|
|
|