Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

Converting data formats through sort

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
View previous topic :: :: View next topic  
Author Message
ojdiaz

New User


Joined: 19 Nov 2008
Posts: 90
Location: Spain

PostPosted: Mon May 18, 2009 4:34 pm    Post subject: Converting data formats through sort
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    Post subject: Oliver
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 Moderator


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

PostPosted: Mon May 18, 2009 9:01 pm    Post subject:
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 Moderator


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

PostPosted: Mon May 18, 2009 9:03 pm    Post subject:
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    Post subject:
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 Moderator


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

PostPosted: Mon May 18, 2009 11:05 pm    Post subject:
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: 2159
Location: @my desk

PostPosted: Tue May 19, 2009 12:30 am    Post subject:
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: 90
Location: Spain

PostPosted: Mon Jun 01, 2009 6:23 pm    Post subject:
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    Post subject:
Reply with quote

ojdiaz,

Check this link which does exactly what you need.

http://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: 90
Location: Spain

PostPosted: Tue Jun 02, 2009 12:01 pm    Post subject:
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 Moderator


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

PostPosted: Fri Nov 20, 2009 5:54 am    Post subject:
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:

http://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: 90
Location: Spain

PostPosted: Fri Nov 20, 2009 1:28 pm    Post subject:
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 Moderator


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

PostPosted: Fri Nov 20, 2009 10:07 pm    Post subject:
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:

http://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    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Is the 'prompt' data for the DSLIST p... Willy Jensen TSO/ISPF 2 Tue Dec 06, 2016 4:38 am
This topic is locked: you cannot edit posts or make replies. How to move a long alphanumeric data ... lind sh COBOL Programming 8 Mon Dec 05, 2016 7:51 pm
No new posts Limit duplicate records in the SORT pshongal SYNCSORT 6 Mon Nov 21, 2016 12:54 pm
No new posts How to convert the VBM file to VB or... Sulabh Agrawal JCL & VSAM 4 Fri Nov 18, 2016 1:04 pm
No new posts ODPP(Optim Data privacy Provider) Iss... Rama kishore IBM Tools 1 Mon Nov 07, 2016 5:46 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us