Page 1 of 1

Date in comp-3 Format and conversion.

Posted: Wed Jul 24, 2013 1:44 pm
by Manoj
I have a date stored in a COMP-3 field in YYYYMMDD format. I need to check the Year. Is there some easy way to find the year? Please help.

Re: Date in comp-3 Format and conversion.

Posted: Wed Jul 24, 2013 7:13 pm
by Robert Sample
Define a 4-byte numeric variable. Compute that variable = date-variable / 10000. Since COBOL will perform integer arithmetic, you'll get the MMDD removed and just the year as the result.