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
 

 

Julian date 3 years ago

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

New User


Joined: 10 Dec 2010
Posts: 96
Location: Massachusetts

PostPosted: Thu Jan 27, 2011 2:06 am    Post subject: Julian date 3 years ago
Reply with quote

Hi,
I need to extract data from 3 years back going forward to today, but, the field is a 5 byte packed Julian Date.
I found this to get today's date then convert to julian:
Code:

 //SYSIN     DD *     
  OPTION COPY         
  OUTREC BUILD=(DATE3)
 /*                   
//SYSIN    DD *
  SORT FIELDS=COPY
  INREC OVERLAY=(13:1,8,Y4T,TOJUL=Y2T)

then I need to make the first 2 bytes minus 3 years. I saw some INCLUDE date3 (minus days, months) and was curious if date3 has a minus year, and also, if I could just do the minus 3 year within the INCLUDE statement. Thanks.
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 27, 2011 2:18 am    Post subject: Reply to: Julian date 3 years ago
Reply with quote

madmartinsonxx,

With PTF UK90025 for z/OS DFSORT V1R10 and PTF UK90026 for z/OS DFSORT V1R12(Oct, 2010), DFSORT now supports date arithmetic which can add/subtract days, months or years to a given date like shown below.

Code:

//STEP0100 EXEC PGM=SORT                                 
//SYSOUT   DD SYSOUT=*                                   
//SORTIN   DD *                                           
Dummy record                                                         
//SORTOUT  DD SYSOUT=*                                   
//SYSIN    DD *                                           
  SORT FIELDS=COPY                                       
  INREC IFTHEN=(WHEN=INIT,BUILD=(DATE3)),                 
  IFTHEN=(WHEN=INIT,BUILD=(1,7,Y4T,SUBYEARS,+3,TOJUL=Y4T))
//*


The output is
Code:

2008026


For complete details of date arithmetic functions and other new functions see "User Guide for DFSORT PTFs UK90025 and UK90026" paper (sortugph.pdf) at:

http://www.ibm.com/support/docview.wss?rs=114&uid=isg3T7000242
Back to top
View user's profile Send private message
madmartinsonxx

New User


Joined: 10 Dec 2010
Posts: 96
Location: Massachusetts

PostPosted: Thu Jan 27, 2011 2:26 am    Post subject: we only have through 'G' ICE201I record
Reply with quote

well back to the drawing board.
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 27, 2011 5:29 am    Post subject: Re: we only have through 'G' ICE201I record
Reply with quote

madmartinsonxx wrote:
well back to the drawing board as we only have through 'G' ICE201I record.


If you don't have the PTF which supports date arithmetic, then use the following DFSORT JCL which will give you the desired results. Subtracting years always results in the same day of the prior year, however if you are subtracting 3 years from a leap year December 31st then you will have invalid Julian date when subtracting 3 years.

ex: December 31st 2012 = 2012 366 (Julian date) - 3 years = 2009 366 which is an invalid date. So we check if the day of the year is 366 and then make the day of the year as 365.

Code:

//STEP0100 EXEC PGM=SORT                                 
//SYSOUT   DD SYSOUT=*                                   
//SORTIN   DD *                                         
dummy record
//SORTOUT  DD SYSOUT=*                                   
//SYSIN    DD *                                         
  SORT FIELDS=COPY                                       
  INREC IFOUTLEN=7,                                     
  IFTHEN=(WHEN=INIT,BUILD=(DATE3)),                     
  IFTHEN=(WHEN=INIT,OVERLAY=(1,4,ZD,SUB,+3,EDIT=(TTTT))),
  IFTHEN=(WHEN=(5,3,ZD,EQ,366),                         
  OVERLAY=(8:1,7,Y4T,TOGREG=Y4T),HIT=NEXT),             
  IFTHEN=(WHEN=(8,1,CH,EQ,C'*'),OVERLAY=(5:C'365'))     
//*
Back to top
View user's profile Send private message
madmartinsonxx

New User


Joined: 10 Dec 2010
Posts: 96
Location: Massachusetts

PostPosted: Thu Jan 27, 2011 10:26 pm    Post subject:
Reply with quote

Code:

//SYSIN    DD *                                         
 SORT FIELDS=COPY                                       
 INREC IFOUTLEN=30,                                     
 IFTHEN=(WHEN=INIT,BUILD=(DATE3)),                     
 IFTHEN=(WHEN=INIT,OVERLAY=(1,4,ZD,SUB,+3,EDIT=(TTTT))),
 IFTHEN=(WHEN=INIT,OVERLAY=(20:1,7,Y4T,TOJUL=Y2T)),     
 IFTHEN=(WHEN=(5,3,ZD,EQ,366),                         
 OVERLAY=(8:1,7,Y4T,TOGREG=Y4T),HIT=NEXT),             
 IFTHEN=(WHEN=(8,1,CH,EQ,C'*'),OVERLAY=(5:C'365'))     
/*                                                     

Kolusu,
Many thanks. I added to TOJUL overlay to get the format I need for this project. Going to be symbol table happy for a while now. Hopefully others will get some use of this.
Back to top
View user's profile Send private message
Skolusu

Senior Member


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

PostPosted: Fri Jan 28, 2011 11:32 pm    Post subject:
Reply with quote

madmartinsonxx,

Did you realize that you will have asterisks when the date is 2012-12-31 ? I chopped the lrecl to 7 so that you won't see the invalid dates. You expanded the lrecl to 30 and you will see asterisks in position 8 and 20? Is that what you really want?
Back to top
View user's profile Send private message
madmartinsonxx

New User


Joined: 10 Dec 2010
Posts: 96
Location: Massachusetts

PostPosted: Sat Jan 29, 2011 12:14 am    Post subject: julian date
Reply with quote

Kolusu,
yes i did realize that the date will be asterisk. I needed the output of the 5 char julian date to get rolling or i would be up the .....I couldn't figure out how to make the TOJUL work after the '366'. Some syntax I was missing i believe, so I stuck that in where it is and i got the field I needed and clapped out loud. I told myself to readdress when I wasn't crunched for time, but, don't we all ! The IFOUTLEN=30 was put in arbitrarily so the outrec could hold my other output. Again, many thanks.
Back to top
View user's profile Send private message
Skolusu

Senior Member


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

PostPosted: Sat Jan 29, 2011 12:19 am    Post subject: Re: julian date
Reply with quote

madmartinsonxx wrote:
Kolusu,
I couldn't figure out how to make the TOJUL work after the '366'. Some syntax I was missing i believe, so I stuck that in where it is and i got the field I needed and clapped out loud.


What exactly do you want your output to look like? Show me the sample desired output and I will show you ways to do it.
Back to top
View user's profile Send private message
madmartinsonxx

New User


Joined: 10 Dec 2010
Posts: 96
Location: Massachusetts

PostPosted: Sat Jan 29, 2011 12:24 am    Post subject: julian date format
Reply with quote

kolusu,
Sure no problem. The date on the payment history file here is the 5 char julian date type.
Code:

2008028            08028


the second guy there is the one i am stripping out and making a symbol for. the business unit is strict on the 'exact' time frame and they want 3 years back as of the run i make, no matter when I run. Thank you. Go Red Sox !!
Back to top
View user's profile Send private message
Skolusu

Senior Member


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

PostPosted: Sat Jan 29, 2011 12:48 am    Post subject: Re: julian date format
Reply with quote

madmartinsonxx wrote:
kolusu,
Sure no problem. The date on the payment history file here is the 5 char julian date type.
Code:

2008028            08028


the second guy there is the one i am stripping out and making a symbol for. the business unit is strict on the 'exact' time frame and they want 3 years back as of the run i make, no matter when I run. Thank you. Go Red Sox !!



if your sole intention is to make a symbol julian Y2T date , then use the following DFSORT control cards.

Code:

//SYSIN    DD *                                           
  SORT FIELDS=COPY                                       
  INREC IFOUTLEN=7,                                       
  IFTHEN=(WHEN=INIT,BUILD=(DATE3)),                       
  IFTHEN=(WHEN=INIT,OVERLAY=(1,4,ZD,SUB,+3,EDIT=(TTTT))),
  IFTHEN=(WHEN=(5,3,ZD,EQ,366),                           
  OVERLAY=(8:1,7,Y4T,TOGREG=Y4T),HIT=NEXT),               
  IFTHEN=(WHEN=(8,1,CH,EQ,C'*'),OVERLAY=(5:C'365'))       
  OUTREC BUILD=(C'SYM1,C''',3,5,C'''',80:X)               
//*


This will create a 80 byte symbol as
Code:
SYM1,C'08028'


if the date is December 31 2012 then the symbol will be created as
Code:
SYM1,C'12365'
Back to top
View user's profile Send private message
madmartinsonxx

New User


Joined: 10 Dec 2010
Posts: 96
Location: Massachusetts

PostPosted: Sat Jan 29, 2011 1:20 am    Post subject: julian date symbol
Reply with quote

Kolusu,
yes, that is it. I was going to do this in 2 steps ( due to ignorance right now ) , but, that was exactly what I was trying to achieve. I now have additional tools with which I can generate some additional associations I need for this huge conversion. Having some of the parameter detail you used ingrained in my noggin' is going to be a huge help. I won't bug you guys unless I need to and please.....

Have a great weekend !
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 TOT & DATE parameter in ICEMAN hemanthj642 DFSORT/ICETOOL 4 Mon Nov 14, 2016 5:19 am
This topic is locked: you cannot edit posts or make replies. How to pass the previous month date i... Suganya87 DFSORT/ICETOOL 5 Mon Oct 31, 2016 4:13 pm
This topic is locked: you cannot edit posts or make replies. Get correct date and time when curren... balaji81_k DB2 24 Fri Oct 14, 2016 10:40 pm
No new posts Change date (DD/MM/YY) in 2nd record ... uday kiran DFSORT/ICETOOL 12 Wed Sep 07, 2016 10:57 pm
No new posts Add system date inside of a PS file a... pramitdas DFSORT/ICETOOL 5 Sun Aug 28, 2016 12:06 am


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