BladeSystem Forums have moved here
To make BladeSystem information easier to find, we have moved the BladeSystem forums here, to Servers and Operating Systems.
Showing results for 
Search instead for 
Do you mean 

Number of years

Occasional Visitor

Number of years

Hi,
How to add number of years to a date field in mainframe COBOL? (input date field format: yyyy/mm/dd)


Thanks,
Vidhya
2 REPLIES
Acclaimed Contributor

Re: Number of years

What "mainframe"? There is only COBOLII/iX on MPE/iX.
Questions about IBM get deleted.
Trusted Contributor

Re: Number of years

:print z9
001000 id division.
002000 program-id. z8.
002100 data division.
002200 working-storage section.
002300 01 work-date pic x(10).
002400 01 wk-date redefines work-date.
002500 02 wk-year pic 9(4).
002600 02 filler pic x(6).
003000 procedure division.
004000 0.
004100 move "2008/02/09" to work-date
004300 add 1 to wk-year
004400 display work-date
004500 stop run.
:cob85xlk z9,,$null

PAGE 0001 COBOL II/iX HP31500A.04.19 [85] Copyright Hewlett-Packard CO. 1987



0 ERROR(s), 0 QUESTIONABLE, 0 WARNING(s)

DATA AREA IS 34 BYTES.
CPU TIME = 0:00:00. WALL TIME = 0:00:00.

END OF PROGRAM
END OF COMPILE
HP Link Editor/iX (HP30315A.06.14) Copyright Hewlett-Packard Co 1986

LinkEd> link ;to=

END OF LINK
:run $oldpass

2009/02/09

END OF PROGRAM
: