Re: Number of years (84 Views)
Reply
Occasional Visitor
Vidhya.G
Posts: 1
Registered: ‎08-05-2008
Message 1 of 3 (84 Views)

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
Please use plain text.
Acclaimed Contributor
Dennis Handly
Posts: 24,387
Registered: ‎03-06-2006
Message 2 of 3 (84 Views)

Re: Number of years

What "mainframe"? There is only COBOLII/iX on MPE/iX.
Questions about IBM get deleted.
Please use plain text.
Trusted Contributor
Masatake Hanayama
Posts: 72
Registered: ‎12-23-1996
Message 3 of 3 (84 Views)

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
:
Please use plain text.
The opinions expressed above are the personal opinions of the authors, not of HP. By using this site, you accept the Terms of Use and Rules of Participation