Language
Showing results for 
Search instead for 
Do you mean 

COBOL II date add function

Occasional Advisor

COBOL II date add function

Hello.

We are using COBOL II on an MPE/iX 6.0 HP3000 system.

IN COBOL, how do i add a number of days to a date and come up with a new date?

Any help would be gratefully appreciated.

Thanks,
Tony
3 REPLIES
Valued Contributor Valued Contributor

Re: COBOL II date add function

Tony -

I'd use the standard COBOL intrinsic functions to do this (works on any reasonably current COBOL platform):

COMPUTE New-Date = FUNCTION DATE-OF-INTEGER(INTEGER-OF-DATE(Date1)+ Number-Of-Days)

Regards,

Glenn
Occasional Advisor

Re: COBOL II date add function

Hello Glenn.

I'm sorry it took so long for me to get back to this problem.

Can you explain where this information is documented. I can't seem to find anything about it for the HP3000. All of my searches about it point to manuals from MicroFocus Object COBOL.

Not sure of how to get this line working in HP COBOL II.

Thanks,
Tony
Highlighted
Valued Contributor Valued Contributor

Re: COBOL II date add function

These are standard COBOL functions that almost any recent COBOL text should explain. For detailed information about the MPE implementation, see the manual(s) at: http://docs.hp.com/en/mpeixall.html#COBOL

Make sure the POST85 option is specified on your $CONTROL card (either the system one or the one you provide).

Glenn