I have a requirement in which I need to find the day of a date in the past.
In my COBOL program I will be using an input file which will be having account numbers. I need to read that account number and go in to an IMS DB to check the date. That date is the entry date of that account number in the system. Usually the date would be a past date. I have to take that date and find the date of last Friday of that month and also I have to find out the date of previous month's last Friday.
For example, if the entry date of an account number is 01012014 (DDMMYY format)in the database, I need to find out the date of last Friday of January 2014 and also if the job is going to run in July, I have to find out the date for last Friday of June 2014 as well.
Can someone please help me with this?
Also, please let me know if you need more details.
Joined: 14 Jan 2008 Posts: 2504 Location: Atlanta, Georgia, USA
Before using INTEGER-OF-DATE, validate "your date". If you don't have any type of date validity checking facility, then use the LE Callable Date routine "CEEDAYS".
After calling "CEEDAYS", if the first 2-bytes of the 12-byte Feedback area are NOT X'00's, then the date is invalid.
Search the forum for "CEEDAYS". You'll get many hits and suggestions.
Any type of DATE FUNCTION in COBOL (except for FUNCTION CURRENT-DATE) requires valid data. Otherwise, you'll crash and burn.
"CEEDAYS" is also handy to determine if a particular year is a leap-year. Just build the leap-year date (for example) as "YYYY0229" and pass it to "CEEDAYS". If the first 2-bytes of the feedback area are NOT X'00's, then it's not a leap-year.
Before using INTEGER-OF-DATE, validate "your date". If you don't have any type of date validity checking facility, then use the LE Callable Date routine "CEEDAYS".
After calling "CEEDAYS", if the first 2-bytes of the 12-byte Feedback area are NOT X'00's, then the date is invalid.
Search the forum for "CEEDAYS". You'll get many hits and suggestions.
Any type of DATE FUNCTION in COBOL (except for FUNCTION CURRENT-DATE) requires valid data. Otherwise, you'll crash and burn.
"CEEDAYS" is also handy to determine if a particular year is a leap-year. Just build the leap-year and pass it to "CEEDAYS". If the first 2-bytes of the feedback area are NOT X'00's, then it's not a leap-year.