Page 1 of 1

Convert 7 digit Julian date to DD-MMM-YYYY format

PostPosted: Wed Jul 02, 2014 1:51 pm
by Farhaan4mf
Hi,
I have gone through DFsort manual on Julian date conversion but could not implement it properly while practicing.
Julian dates are in a flat file ( LRECL=93, RECFM=FB). Position col 87-93
dates are as below
2013180
2014070
2014180
2014179
2015090
2016059
Needs to change to DD-MMM-YYYY format (example 29-JUN-2014). Please give me the DFSORT code to do this. (note: all the dates are in 20xx years. there are no dates having 19xx years)

Re: Convert 7 digit Julian date to DD-MMM-YYYY format

PostPosted: Wed Jul 02, 2014 2:00 pm
by BillyBoyo
What have you tried, and what were the results?

Re: Convert 7 digit Julian date to DD-MMM-YYYY format

PostPosted: Wed Jul 02, 2014 5:23 pm
by Farhaan4mf
Hi Billy,
I tried the below sort card
 OPTION COPY                         
 OUTREC BUILD=(51,7,Y4T,TOGREG=Y4W(-))

Results are in
mm-dd-yyyy format. But I want in DD-MMM-YYYY format. Is it possible using DFSORT. I do not know how...

Re: Convert 7 digit Julian date to DD-MMM-YYYY format

PostPosted: Wed Jul 02, 2014 6:17 pm
by BillyBoyo
I don't think there's anything to do that directly.

You can look in the Smart DFSORT Tricks publication for "Sort ddmonyy dates", which will give you code to convert month-number to month-abbreviation. That plus just shuffling around should get you there.

Use INREC, put your existing BUILD on an IFTHEN=(WHEN=NONE, and a new BUILD to do the change and the shuffling.