IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Converting data formats through sort


IBM Mainframe Forums -> DFSORT/ICETOOL
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
ojdiaz

New User


Joined: 19 Nov 2008
Posts: 98
Location: Spain

PostPosted: Mon May 18, 2009 4:34 pm
Reply with quote

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
View user's profile Send private message
Mazahar

New User


Joined: 11 Dec 2007
Posts: 82
Location: hyderabad

PostPosted: Mon May 18, 2009 5:21 pm
Reply with quote

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
View user's profile Send private message
Frank Yaeger

DFSORT Developer


Joined: 15 Feb 2005
Posts: 7129
Location: San Jose, CA

PostPosted: Mon May 18, 2009 9:01 pm
Reply with quote

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
View user's profile Send private message
Frank Yaeger

DFSORT Developer


Joined: 15 Feb 2005
Posts: 7129
Location: San Jose, CA

PostPosted: Mon May 18, 2009 9:03 pm
Reply with quote

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
View user's profile Send private message
Mazahar

New User


Joined: 11 Dec 2007
Posts: 82
Location: hyderabad

PostPosted: Mon May 18, 2009 10:51 pm
Reply with quote

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
View user's profile Send private message
Frank Yaeger

DFSORT Developer


Joined: 15 Feb 2005
Posts: 7129
Location: San Jose, CA

PostPosted: Mon May 18, 2009 11:05 pm
Reply with quote

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
View user's profile Send private message
Arun Raj

Moderator


Joined: 17 Oct 2006
Posts: 2481
Location: @my desk

PostPosted: Tue May 19, 2009 12:30 am
Reply with quote

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
View user's profile Send private message
ojdiaz

New User


Joined: 19 Nov 2008
Posts: 98
Location: Spain

PostPosted: Mon Jun 01, 2009 6:23 pm
Reply with quote

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
View user's profile Send private message
Skolusu

Senior Member


Joined: 07 Dec 2007
Posts: 2205
Location: San Jose

PostPosted: Mon Jun 01, 2009 9:16 pm
Reply with quote

ojdiaz,

Check this link which does exactly what you need.

www.ibmmainframes.com/viewtopic.php?p=113841#113841
Back to top
View user's profile Send private message
ojdiaz

New User


Joined: 19 Nov 2008
Posts: 98
Location: Spain

PostPosted: Tue Jun 02, 2009 12:01 pm
Reply with quote

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
View user's profile Send private message
Frank Yaeger

DFSORT Developer


Joined: 15 Feb 2005
Posts: 7129
Location: San Jose, CA

PostPosted: Fri Nov 20, 2009 5:54 am
Reply with quote

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
View user's profile Send private message
ojdiaz

New User


Joined: 19 Nov 2008
Posts: 98
Location: Spain

PostPosted: Fri Nov 20, 2009 1:28 pm
Reply with quote

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
View user's profile Send private message
Frank Yaeger

DFSORT Developer


Joined: 15 Feb 2005
Posts: 7129
Location: San Jose, CA

PostPosted: Fri Nov 20, 2009 10:07 pm
Reply with quote

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
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 How to split large record length file... DFSORT/ICETOOL 10
No new posts Data set Rec-Cnt and Byte-Cnt Testing & Performance 2
No new posts JCL sort card - get first day and las... JCL & VSAM 9
No new posts SCOPE PENDING option -check data DB2 2
No new posts Check data with Exception Table DB2 0
Search our Forums:

Back to Top