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
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
Joined: 14 Oct 2005 Posts: 1208 Location: Bangalore,India
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