Date in comp-3 Format and conversion.
Date in comp-3 Format and conversion.
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.
- Robert Sample
- Global Moderator
- Posts: 1891
- Joined: Fri Jun 28, 2013 1:22 am
- Location: Dubuque Iowa
Re: Date in comp-3 Format and conversion.
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.
Create an account or sign in to join the discussion
You need to be a member in order to post a reply
Create an account
Not a member? register to join our community
Members can start their own topics & subscribe to topics
It’s free and only takes a minute