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

Converting a julian date to gregorian


IBM Mainframe Forums -> JCL & VSAM
Post new topic   Reply to topic
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
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: 1208
Location: Bangalore,India

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

Hello Neena,

Please refer below post :
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
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

Superior Member


Joined: 14 Mar 2007
Posts: 10766
Location: italy

PostPosted: Fri Jan 08, 2010 1:01 pm
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
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

Superior Member


Joined: 14 Mar 2007
Posts: 10766
Location: italy

PostPosted: Fri Jan 08, 2010 1:11 pm
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 ...
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: 8797
Location: Welsh Wales

PostPosted: Fri Jan 08, 2010 1:55 pm
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

Superior Member


Joined: 14 Mar 2007
Posts: 10766
Location: italy

PostPosted: Fri Jan 08, 2010 1:56 pm
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: 1208
Location: Bangalore,India

PostPosted: Fri Jan 08, 2010 1:57 pm
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 Developer


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

PostPosted: Fri Jan 08, 2010 11:07 pm
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:

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: 496
Location: USA

PostPosted: Sat Jan 09, 2010 2:43 am
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 View Bookmarks
All times are GMT + 6 Hours
Forum Index -> JCL & VSAM

 


Similar Topics
Topic Forum Replies
This topic is locked: you cannot edit posts or make replies. A Rexx who changes date into a JCL?Po... CLIST & REXX 9
No new posts Date conversion using SORT SYNCSORT 4
No new posts Converting a file from PD to display ... SYNCSORT 4
No new posts Date Conversion Y2T to Y2W SYNCSORT 8
No new posts Date format conversion DFSORT/ICETOOL 4
Search our Forums:

Back to Top