Page 1 of 2

Binary date to gregorian Date

PostPosted: Tue Nov 12, 2013 10:05 pm
by mail4rsb
I have a two bit binary date field in the input file and i need to convert to a greg date MM/DD/YYYY.
can it be converted using sysnsort. Please let me know

Thank you

Re: Binary date to gregorian Date

PostPosted: Tue Nov 12, 2013 10:07 pm
by steve-myers
It is simply not possible to represent a "date" in a 2 bit data area. Do you mean 2 bytes?

Re: Binary date to gregorian Date

PostPosted: Tue Nov 12, 2013 10:14 pm
by mail4rsb
yes its two bytes sorry for the cofusion

Re: Binary date to gregorian Date

PostPosted: Tue Nov 12, 2013 10:51 pm
by steve-myers
How the "date" stored in the 2 bytes?

Re: Binary date to gregorian Date

PostPosted: Tue Nov 12, 2013 11:10 pm
by mail4rsb
the document says its binary date. one cobol program is reading it as X(02) and calling a assembler routine to convert the binary date to gregorian date...

Re: Binary date to gregorian Date

PostPosted: Tue Nov 12, 2013 11:15 pm
by Akatsukami
Whilst I can think of ways to stuff a (non-Y2K compliant) pseudo-Julian date into two bytes, IMPO that would have been a waste of ingenuity back in the S/360 days. I would like to see some bit patterns and the corresponding Gregorian dates.

Re: Binary date to gregorian Date

PostPosted: Tue Nov 12, 2013 11:30 pm
by steve-myers
Akatsukami is correct. For example, you can store 13316 (November 12, 1913? 2013?) in 2 bytes, but it is not Y2K compliant! 113316 (which is Y2K compliant, sort of) cannot be stored in 2 bytes.

How soon the lessons of the Y2K disaster have been forgotten! This does not bode well for the more difficult 2100 problem, though none of us will be around for it!

Re: Binary date to gregorian Date

PostPosted: Wed Nov 13, 2013 12:32 am
by mail4rsb
Thank you Steve-myers and Akatsukami for the details.Initially i thought of unpacking the binary and then convert to MM/DD/YYYY in few SORT steps. buy i think it wont work

Re: Binary date to gregorian Date

PostPosted: Wed Nov 13, 2013 12:42 am
by Akatsukami
"Unpacking the binary" makes no sense; a binary number is quite different from a packed decimal number. Moreover, a two-byte packed decimal field could hold a maximum value of 999, completely inadequate for representing a date. We must see the data to say anything meaningful.

Re: Binary date to gregorian Date

PostPosted: Wed Nov 13, 2013 12:59 am
by mail4rsb
I am seeing something like this
Ç5
0N
Åà