Page 1 of 1

IMS date/time

PostPosted: Fri Mar 15, 2013 5:08 pm
by JohnH
I need to convert the IMS date/time to readable format on my OUTREC statement. The data at position 63 is x'2013064F175005781856' which should print as '03/06/2013 17:50:05.781856'. How can I do this?

Re: IMS date/time

PostPosted: Fri Mar 15, 2013 9:07 pm
by Akatsukami
The date in an ordinal (oft miscalled "Julian") date in unsigned packed decimal format. The time looksto be BCD; I don't know if Syncsort can handle that.

Re: IMS date/time

PostPosted: Mon Mar 18, 2013 4:40 pm
by BillyBoyo
You're going to have to check your documentation/search the forums/google for SyncSort julian-date conversion. For the Time, have a look to see if SyncSort supports UNHEX, else it can be dealt with by "putting it somewhere" and appending X'0C' to it, then using the combined field as PDC to make it ZDF and then format it as you want.

Re: IMS date/time

PostPosted: Mon Mar 18, 2013 5:01 pm
by JohnH
Syncsort doesn't seem to have an UNHEX, but your comment gave me an idea. On the INREC, I simply append an x'0C' literal behind the time and then convert PD to ZD in the OURTREC. Thanks for the help.

Re: IMS date/time

PostPosted: Mon Mar 18, 2013 5:10 pm
by BillyBoyo
Remember that this will only work "simply" if you don't need the byte immediately after the time... If you do need the byte, you need to copy the field somewhere else, then append. Where you copy it to depends on where your records are fixed or variable.