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
 

 

Gregorian Date format (YYDDMM) to Julian date (YYDDD)

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

New User


Joined: 13 Sep 2005
Posts: 35
Location: India

PostPosted: Fri Dec 28, 2007 3:40 pm    Post subject: Gregorian Date format (YYDDMM) to Julian date (YYDDD)
Reply with quote

Please let me know if anybody aware of how to change the Gregorian Date format (YYDDMM) to Julian date (YYDDD) format using IBM SORT Utility DFSORT through JCL.
[/u]
Back to top
View user's profile Send private message

krisprems

Active Member


Joined: 27 Nov 2006
Posts: 649
Location: India

PostPosted: Fri Dec 28, 2007 5:24 pm    Post subject:
Reply with quote

COVERSION OF GREGORIAN TO JULIAN
Code:
//************************************************
//STEP1    EXEC PGM=SORT                         
//SYSOUT   DD SYSOUT=*                           
//SORTIN   DD *                                   
20050205                                         
20080702                                         
20070101                                         
20070107                                         
20081231                                         
20080201                                         
/*                                               
//SORTOUT  DD SYSOUT=*                           
//SYSIN    DD *                                   
 SORT FIELDS=COPY                                 
 INREC IFTHEN=(WHEN=(5,2,ZD,EQ,01),               
 OVERLAY=(15:07,02,ZD,LENGTH=4),HIT=NEXT),       
 IFTHEN=(WHEN=(5,2,ZD,EQ,02),                     
 OVERLAY=(15:+31,ADD,07,02,ZD,LENGTH=4),HIT=NEXT),
 IFTHEN=(WHEN=(5,2,ZD,EQ,03),                     
 OVERLAY=(15:+59,ADD,07,02,ZD,LENGTH=4),HIT=NEXT),
 IFTHEN=(WHEN=(5,2,ZD,EQ,04),                     
 OVERLAY=(15:+90,ADD,07,02,ZD,LENGTH=4),HIT=NEXT), 
 IFTHEN=(WHEN=(5,2,ZD,EQ,05),                       
 OVERLAY=(15:+120,ADD,07,02,ZD,LENGTH=4),HIT=NEXT),
 IFTHEN=(WHEN=(5,2,ZD,EQ,06),                       
 OVERLAY=(15:+151,ADD,07,02,ZD,LENGTH=4),HIT=NEXT),
 IFTHEN=(WHEN=(5,2,ZD,EQ,07),                       
 OVERLAY=(15:+181,ADD,07,02,ZD,LENGTH=4),HIT=NEXT),
 IFTHEN=(WHEN=(5,2,ZD,EQ,08),                       
 OVERLAY=(15:+212,ADD,07,02,ZD,LENGTH=4),HIT=NEXT),
 IFTHEN=(WHEN=(5,2,ZD,EQ,09),                       
 OVERLAY=(15:+243,ADD,07,02,ZD,LENGTH=4),HIT=NEXT),
 IFTHEN=(WHEN=(5,2,ZD,EQ,10),                       
 OVERLAY=(15:+273,ADD,07,02,ZD,LENGTH=4),HIT=NEXT),
 IFTHEN=(WHEN=(5,2,ZD,EQ,11),                       
 OVERLAY=(15:+304,ADD,07,02,ZD,LENGTH=4),HIT=NEXT),
 IFTHEN=(WHEN=(5,2,ZD,EQ,12),                       
 OVERLAY=(15:+334,ADD,07,02,ZD,LENGTH=4),HIT=NEXT),
 IFTHEN=(WHEN=(1,4,ZD,GT,+0000),                   
 OVERLAY=(81:1,4,ZD,MOD,+4,LENGTH=2),HIT=NEXT),     
 IFTHEN=(WHEN=(20,1,ZD,EQ,+0,&,5,2,ZD,GT,02),       
 OVERLAY=(15:15,3,ZD,ADD,+1,LENGTH=4),HIT=NEXT),   
 IFOUTLEN=80                                       
 OUTREC OVERLAY=(13:3,2,15:15,3,UFF,TO=ZD,LENGTH=3)
/*                                                 



SORTOUT
Code:
20050205    05036
20080702    08184
20070101    07001
20070107    07007
20081231    08366
20080201    08032
Back to top
View user's profile Send private message
Skolusu

Senior Member


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

PostPosted: Sat Dec 29, 2007 12:36 am    Post subject: Reply to: Gregorian Date format (YYDDMM) to Julian date (YYD
Reply with quote

krisprems,

Your logic will fail for century years (21000301 is only the 60th day of the year 2100). Most years that can be divided evenly by 4 are leap years. However there are exceptions: Century years are NOT leap years UNLESS they can be evenly divided by 400.(For example, 1700, 1800, and 1900 were not leap years, but 1600 and 2000, which are divisible by 400, were.)

The solar year is just about 365 ¼ days long—but not exactly! The exact length of a solar year is actually 11 minutes and 14 seconds less than 365 ¼ days. That means that even if you add a leap day every four years, the calendar would still overshoot the solar year by a little bit—11 minutes and 14 seconds per year. These minutes and seconds really start to add up: after 128 years, the calendar would gain an entire extra day. So, the leap year rule, "add a leap year every four years" was a good rule, but not good enough!
Back to top
View user's profile Send private message
krisprems

Active Member


Joined: 27 Nov 2006
Posts: 649
Location: India

PostPosted: Mon Dec 31, 2007 2:30 pm    Post subject:
Reply with quote

Skolusu
Please check my below SORT card
Code:
//*******************************************************
//STEPM    EXEC PGM=SORT                                 
//SYSOUT   DD SYSOUT=*                                   
//SORTIN   DD *                                         
17000702                                                 
18000702                                                 
19000301                                                 
21000301                                                 
20081231                                                 
20080201                                                 
/*                                                       
//SORTOUT  DD SYSOUT=*                                   
//SYSIN    DD *                                         
 SORT FIELDS=COPY                                       
 INREC IFTHEN=(WHEN=(5,2,ZD,EQ,01),                     
 OVERLAY=(15:07,02,ZD,LENGTH=4),HIT=NEXT),               
 IFTHEN=(WHEN=(5,2,ZD,EQ,02),                           
 OVERLAY=(15:+31,ADD,07,02,ZD,LENGTH=4),HIT=NEXT),       
 IFTHEN=(WHEN=(5,2,ZD,EQ,03),                           
 OVERLAY=(15:+59,ADD,07,02,ZD,LENGTH=4),HIT=NEXT),       
 IFTHEN=(WHEN=(5,2,ZD,EQ,04),                           
 OVERLAY=(15:+90,ADD,07,02,ZD,LENGTH=4),HIT=NEXT),                 
 IFTHEN=(WHEN=(5,2,ZD,EQ,05),                                       
 OVERLAY=(15:+120,ADD,07,02,ZD,LENGTH=4),HIT=NEXT),                 
 IFTHEN=(WHEN=(5,2,ZD,EQ,06),                                       
 OVERLAY=(15:+151,ADD,07,02,ZD,LENGTH=4),HIT=NEXT),                 
 IFTHEN=(WHEN=(5,2,ZD,EQ,07),                                       
 OVERLAY=(15:+181,ADD,07,02,ZD,LENGTH=4),HIT=NEXT),                 
 IFTHEN=(WHEN=(5,2,ZD,EQ,08),                                       
 OVERLAY=(15:+212,ADD,07,02,ZD,LENGTH=4),HIT=NEXT),                 
 IFTHEN=(WHEN=(5,2,ZD,EQ,09),                                       
 OVERLAY=(15:+243,ADD,07,02,ZD,LENGTH=4),HIT=NEXT),                 
 IFTHEN=(WHEN=(5,2,ZD,EQ,10),                                       
 OVERLAY=(15:+273,ADD,07,02,ZD,LENGTH=4),HIT=NEXT),                 
 IFTHEN=(WHEN=(5,2,ZD,EQ,11),                                       
 OVERLAY=(15:+304,ADD,07,02,ZD,LENGTH=4),HIT=NEXT),                 
 IFTHEN=(WHEN=(5,2,ZD,EQ,12),                                       
 OVERLAY=(15:+334,ADD,07,02,ZD,LENGTH=4),HIT=NEXT),                 
 IFTHEN=(WHEN=(1,4,ZD,GT,+0000),                                   
 OVERLAY=(81:1,4,ZD,DIV,+100,LENGTH=4,81:81,4,UFF,MOD,+4,LENGTH=2),
 HIT=NEXT),IFTHEN=(WHEN=(81,2,ZD,EQ,+0,&,5,2,ZD,GT,02),             
 OVERLAY=(15:15,3,ZD,ADD,+1,LENGTH=4),HIT=NEXT),                   
 IFOUTLEN=80                                       
 OUTREC OVERLAY=(13:3,2,15:15,3,UFF,TO=ZD,LENGTH=3)
/*                                                 


SORTOUT
Code:
17000702    00183
18000702    00183
19000301    00060
21000301    00060
20081231    08366
20080201    08032
Back to top
View user's profile Send private message
Skolusu

Senior Member


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

PostPosted: Thu Jan 03, 2008 9:54 pm    Post subject:
Reply with quote

krisprems wrote:
Skolusu
Please check my below SORT card


Krisprems,

By fixing the code for century years you broke the code for regular years. Your leap year check is not right. It will even consider non leap years as leap years. Run your latest code with 20070301 date and see that you would get it as 07061 which is wrong. Here is the right code.

Code:

//STEP0100 EXEC PGM=ICEMAN                                     
//SYSOUT   DD SYSOUT=*                                         
//SORTIN   DD *                                                 
20050205                                                       
20080702                                                       
20070101                                                       
20070107                                                       
20070301                                                       
20081231                                                       
20080229                                                       
20080301                                                       
18000301                                                       
21000301                                                       
//SORTOUT  DD SYSOUT=*                                         
//SYSIN    DD *                                                 
  SORT FIELDS=COPY                                             
  INREC IFTHEN=(WHEN=INIT,                                     
        OVERLAY=(81:01,04,ZD,MOD,+4,EDIT=(T),                   
                 82:01,04,ZD,MOD,+100,EDIT=(TTT),               
                 85:01,04,ZD,MOD,+400,EDIT=(TTT)),HIT=NEXT),   
                                                               
         IFTHEN=(WHEN=(85,3,ZD,EQ,0,OR,                   
                      (81,1,ZD,EQ,0,AND,82,3,ZD,GT,0)),   
        OVERLAY=(88:C'L'),HIT=NEXT),                     
                                                         
         IFTHEN=(WHEN=(05,02,ZD,EQ,01),                   
        OVERLAY=(13:3,2,7,2,ZD,EDIT=(TTT))),             
                                                         
         IFTHEN=(WHEN=(05,02,ZD,EQ,02),                   
        OVERLAY=(13:3,2,+031,ADD,07,02,ZD,EDIT=(TTT))),   
                                                         
         IFTHEN=(WHEN=(05,02,ZD,EQ,03),                   
        OVERLAY=(13:3,2,+059,ADD,07,02,ZD,EDIT=(TTT))),   
                                                         
         IFTHEN=(WHEN=(05,02,ZD,EQ,04),                   
        OVERLAY=(13:3,2,+090,ADD,07,02,ZD,EDIT=(TTT))),   
                                                         
         IFTHEN=(WHEN=(05,02,ZD,EQ,05),                   
        OVERLAY=(13:3,2,+120,ADD,07,02,ZD,EDIT=(TTT))),   
                                                         
         IFTHEN=(WHEN=(05,02,ZD,EQ,06),                   
        OVERLAY=(13:3,2,+151,ADD,07,02,ZD,EDIT=(TTT))),   
                                                         
         IFTHEN=(WHEN=(05,02,ZD,EQ,07),                   
        OVERLAY=(13:3,2,+181,ADD,07,02,ZD,EDIT=(TTT))),   
                                                         
         IFTHEN=(WHEN=(05,02,ZD,EQ,08),                   
        OVERLAY=(13:3,2,+212,ADD,07,02,ZD,EDIT=(TTT))),   
                                                         
         IFTHEN=(WHEN=(05,02,ZD,EQ,09),                   
        OVERLAY=(13:3,2,+243,ADD,07,02,ZD,EDIT=(TTT))),   
                                                         
         IFTHEN=(WHEN=(05,02,ZD,EQ,10),                   
        OVERLAY=(13:3,2,+273,ADD,07,02,ZD,EDIT=(TTT))),   
                                                         
         IFTHEN=(WHEN=(05,02,ZD,EQ,11),                   
        OVERLAY=(13:3,2,+304,ADD,07,02,ZD,EDIT=(TTT))),   
                                                         
         IFTHEN=(WHEN=(05,02,ZD,EQ,12),                   
        OVERLAY=(13:3,2,+334,ADD,07,02,ZD,EDIT=(TTT)))   
                                                 
  OUTFIL IFOUTLEN=80,                           
         IFTHEN=(WHEN=(88,1,CH,EQ,C'L',AND,     
                       05,2,ZD,GT,2),           
        OVERLAY=(15:+1,ADD,15,03,ZD,EDIT=(TTT)))

/*


Hope this helps...

Cheers
Back to top
View user's profile Send private message
krisprems

Active Member


Joined: 27 Nov 2006
Posts: 649
Location: India

PostPosted: Mon Jan 07, 2008 5:31 pm    Post subject:
Reply with quote

Thanks kolusu...havent verified your SORT card...
But sure it would be the correct one icon_razz.gif
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:38 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:

//S2 EXEC PGM=ICEMAN
//SYSOUT   DD SYSOUT=*
//SORTIN   DD *
20050205
20080702
20070101
20070107
20070301
20081231
20080229
20080301
18000301
21000301
//SORTOUT DD SYSOUT=*
//SYSIN    DD *
  SORT FIELDS=COPY
  INREC OVERLAY=(13:1,8,Y4T,TOJUL=Y2T)
/*


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
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 How to pick only YYMMDD from DATE1P (... atulbaviskar SYNCSORT 7 Wed Mar 22, 2017 11:39 am
No new posts Date and time format in CICS Chandru3183 CICS 2 Sat Mar 18, 2017 12:46 pm
No new posts How to get current date -1 and curren... murali.andaluri DFSORT/ICETOOL 3 Wed Mar 08, 2017 2:09 pm
No new posts Overlay the system date Danielle.Filteau SYNCSORT 4 Fri Mar 03, 2017 1:16 am
No new posts Checking Current date vickey_dw DFSORT/ICETOOL 1 Wed Feb 08, 2017 11:14 pm


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