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

can DFSORT convert a JUlian-date to mm-dd-yyyyy format.


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

New User


Joined: 23 Feb 2007
Posts: 17
Location: NOIDA

PostPosted: Tue Mar 06, 2007 2:13 pm
Reply with quote

Hi ,

can DFSORT convert a JUlian-date to mm-dd-yyyyy format.
please give the code if possible.

Thanks.
Back to top
View user's profile Send private message
William Thompson

Global Moderator


Joined: 18 Nov 2006
Posts: 3156
Location: Tucson AZ

PostPosted: Tue Mar 06, 2007 2:33 pm
Reply with quote

What is the format of the julian date? Zoned or packed decimal? Have you looked at the manual?
Back to top
View user's profile Send private message
aqilis

New User


Joined: 23 Feb 2007
Posts: 17
Location: NOIDA

PostPosted: Tue Mar 06, 2007 4:01 pm
Reply with quote

William,

It is in Zoned-Decimal format: CP-END-DATE PIC 9(5)


Thanks
Back to top
View user's profile Send private message
William Thompson

Global Moderator


Joined: 18 Nov 2006
Posts: 3156
Location: Tucson AZ

PostPosted: Tue Mar 06, 2007 4:15 pm
Reply with quote

As in YYDDD?
Have you looked at the manual?
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: Tue Mar 06, 2007 8:53 pm
Reply with quote

Do the yyddd dates all represent 20yyddd dates or do they represent 19yyddd and 20yyddd dates?
Back to top
View user's profile Send private message
aqilis

New User


Joined: 23 Feb 2007
Posts: 17
Location: NOIDA

PostPosted: Thu Mar 08, 2007 12:23 pm
Reply with quote

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

DFSORT Developer


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

PostPosted: Thu Mar 08, 2007 9:48 pm
Reply with quote

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
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 11:39 pm
Reply with quote

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
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 Date format correction using dfsort DFSORT/ICETOOL 3
No new posts Sorting Date Field DFSORT/ICETOOL 4
No new posts CONVERT a given date from UTC TO BST CICS 0
No new posts Pull data using date difference betwe... DB2 6
No new posts CA7 count with DATE variable CA Products 0
Search our Forums:

Back to Top