Hi,
Do we have some intrinsic function of COBOL to identify a specific day of the month? For example to check if the given date is second Monday of the month?
I did not answer this question. I thought there was a function but I cold not find one later online.
Intrinsic function of COBOL to identify a specific day of the month?
- Robert Sample
- Global Moderator
- Posts: 1896
- Joined: Fri Jun 28, 2013 1:22 am
- Location: Dubuque Iowa
Re: Intrinsic function of COBOL to identify a specific day of the month?
There is no such function in Enterprise COBOL. It is not difficult to develop code for such a function, though.
Re: Intrinsic function of COBOL to identify a specific day of the month?
Thanks Robert.
Could you please help me to layout a logic for it in COBOL?
Could you please help me to layout a logic for it in COBOL?
- Robert Sample
- Global Moderator
- Posts: 1896
- Joined: Fri Jun 28, 2013 1:22 am
- Location: Dubuque Iowa
Re: Intrinsic function of COBOL to identify a specific day of the month?
Pick a known date and convert it to integer using the INTEGER-OF-DATE intrinsic function. Convert your date to integer and find the difference in the dates. If the difference modulo 7 is zero then your date is the same day of week as your known date; otherwise, you can determine the day of week by the modulus. As far as finding the second Monday, for example, one way would be to convert the 8th day of the month to integer and using the difference from your known date to adjust to Monday (the second Monday will not be earlier than the 8th nor later than the 14th).
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