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 a julian date to gregorian

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> JCL & VSAM
View previous topic :: :: View next topic  
Author Message
Neena John

New User


Joined: 20 Nov 2008
Posts: 13
Location: bangalore

PostPosted: Fri Jan 08, 2010 11:33 am    Post subject: Converting a julian date to gregorian
Reply with quote

HI,
There is a requirement of converting a julian date in a file to the format MM-DD-YYYY through jcl.

In the file it is in the format +1999016 which is to be converted to
01-16-1999.
Can anyone help me by providing any sort card for doing this.
Back to top
View user's profile Send private message

guptae

Moderator


Joined: 14 Oct 2005
Posts: 1187
Location: Bangalore,India

PostPosted: Fri Jan 08, 2010 11:46 am    Post subject:
Reply with quote

Hello Neena,

Please refer below post :
http://www.ibmmainframes.com/about18642.html
Back to top
View user's profile Send private message
Neena John

New User


Joined: 20 Nov 2008
Posts: 13
Location: bangalore

PostPosted: Fri Jan 08, 2010 12:58 pm    Post subject:
Reply with quote

Hi,
In the abov epost,it is conversion of julian(yyddd) to gregorian.
My file will eb having both 19 and 20 ie 1992 to 2010 years.
So can anyone help me on this
Back to top
View user's profile Send private message
enrico-sorichetti

Global Moderator


Joined: 14 Mar 2007
Posts: 10210
Location: italy

PostPosted: Fri Jan 08, 2010 1:01 pm    Post subject: Reply to: Converting a julian date to gregorian
Reply with quote

looks like You did nor care to try to understand the linked post, it say in clear words that...
Quote:
I assumed that your yyddd field is in positions 1-5 and you want a century window of 1950-2049.

reread and try to understand, whining will get You nowhere.
the linked post contains the solution for Your issue
Back to top
View user's profile Send private message
genesis786

Active User


Joined: 28 Sep 2005
Posts: 210
Location: St Katherine's Dock London

PostPosted: Fri Jan 08, 2010 1:05 pm    Post subject:
Reply with quote

If I read correctly, the SORT which Frank has written in that post covers from 1950 to 2049...
Back to top
View user's profile Send private message
enrico-sorichetti

Global Moderator


Joined: 14 Mar 2007
Posts: 10210
Location: italy

PostPosted: Fri Jan 08, 2010 1:11 pm    Post subject: Reply to: Converting a julian date to gregorian
Reply with quote

Yes, I am pretty sure that You, I, almost everybody will read correctly, but there are always exceptions

quoting the linked solution
Code:
* 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))                 


the TS complains that his date is not a short julian(YYDDD) , but a long one (CCYYDDD),
and does not realize (he is too lazy to) that it' s enough to skip the first four steps of the posted solution

edited to correct a glitch
I was misled by the comments in the solution ...
still, looking at the sort manuals it would have been easy to find the glitch and fix accordingly,
also a quick and dirty forum search for dt1 would have taken the ts to ...
http://www.ibmmainframes.com/about7034.html
which is the perfect complement to get the solution

quoting the linked solution
Code:
 OPTION COPY
* Convert X'19yyddds' to X'00yyddds'.
* Convert X'20yyddds' to X'01yyddds'.
  INREC FIELDS=(1:1,1,CHANGE=(1,X'19',X'00',X'20',X'01'),
    NOMATCH=(X'02'),2:2,3)
* Use SMF date format (DT1) to convert X'0cyyddds' to Z'yyyymmdd'
* and P'yyyymmdd'.
  OUTREC FIELDS=(1,4,DT1,X,1,4,DT1,TO=PD,LENGTH=5)


what bothers me is that people just want to be spoon fed and lack completely the ingenuity to find something themselves

take the first part of solution 2 and the second part of solution 1

another hint...
the first part of solution 2 transforms the CCYY in a forma tsuitable for the DT1 format
second part of solution 1 formats the DT1 produced result to the format asked for by the TS

anyway, again, a forum search would have provided the TS with all the info needed,
and would have made him gain a bit of experience in problem solving and solution research

... solution research is always an iterative process

...
give a man a fish and You will feed him for one meal,
teach him how to fish and You will feed him for life
Back to top
View user's profile Send private message
expat

Global Moderator


Joined: 14 Mar 2007
Posts: 8593
Location: Back in jolly old England

PostPosted: Fri Jan 08, 2010 1:55 pm    Post subject:
Reply with quote

Quote:
...
give a man a fish and You will feed him for one meal,
teach him how to fish and You will feed him for life

Enrico, did you assume that his catch rate is allowable under the EU fishing quota limitations.
Back to top
View user's profile Send private message
enrico-sorichetti

Global Moderator


Joined: 14 Mar 2007
Posts: 10210
Location: italy

PostPosted: Fri Jan 08, 2010 1:56 pm    Post subject: Reply to: Converting a julian date to gregorian
Reply with quote

Quote:
EU fishing quota limitations.

all depends on the price of the daily fishing pass

for forums answers the process is a bit murky..
we pay for the pass and they get the fish icon_wink.gif
Back to top
View user's profile Send private message
guptae

Moderator


Joined: 14 Oct 2005
Posts: 1187
Location: Bangalore,India

PostPosted: Fri Jan 08, 2010 1:57 pm    Post subject:
Reply with quote

Hi ,

I agree with Enrico comments. But if your input in ZD format then following code should work
Code:

   OPTION COPY                                         
* IF CC =19, CONVERT Z'CCYYDDD' TO X'00YYDDDC'           
  INREC IFTHEN=(WHEN=(1,2,ZD,EQ,+19),                   
                BUILD=(X'00',3,5,ZD,TO=PD,LENGTH=3)),   
* IF CC =20, CONVERT Z'CCYYDDD' TO X'01YYDDDC'           
        IFTHEN=(WHEN=NONE,                             
                BUILD=(X'01',3,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))         


Its not an optimal solution But it will provide your output
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 Jan 08, 2010 11:07 pm    Post subject:
Reply with quote

Neena,

If you have the Nov, 2009 DFSORT PTF, you can do what you want with a DFSORT job like the following:

Code:

//S1    EXEC  PGM=SORT                       
//SYSOUT    DD  SYSOUT=*                     
//SORTIN DD *                               
+1999016                                     
+1999001                                     
+2000001                                     
//SORTOUT DD SYSOUT=*                       
//SYSIN    DD    *                           
  OPTION COPY                               
  INREC BUILD=(2,7,Y4T,TOGREG=Y4W(-))       
/*


SORTOUT would have:

Code:

01-16-1999   
01-01-1999   
01-01-2000   


If you don't have that PTF, ask your System Programmer to install it. For more information on the PTF, see:

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

SYNCSORT Support


Joined: 25 Jul 2007
Posts: 500
Location: USA

PostPosted: Sat Jan 09, 2010 2:43 am    Post subject:
Reply with quote

Here is a SyncSort for z/OS 1.3 job that will produce the requested output:
Code:
//SORT1 EXEC PGM=SORT,PARM='CENTWIN=80'
//SORTIN  DD *                             
+1999016                                   
//SORTOUT DD SYSOUT=*                     
//SYSOUT  DD SYSOUT=*                       
//SYSIN   DD *                               
  INREC BUILD=(4,5,Y2T,DT=(MD4-))         
  SORT FIELDS=COPY                         
/*   
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 -> JCL & VSAM All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts DB2 query Using Recursion, Converting... smilewithashu2 DB2 1 Tue Jan 03, 2017 12:50 pm
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


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