View previous topic :: View next topic
|
Author |
Message |
sandeep.tikoo
New User
Joined: 07 Oct 2006 Posts: 6 Location: Bangalore
|
|
|
|
I have a requirement in Cobol Pgm
How to add 90 days to a Timestamp field coming from I/P file |
|
Back to top |
|
|
Robert Sample
Global Moderator
Joined: 06 Jun 2008 Posts: 8697 Location: Dubuque, Iowa, USA
|
|
|
|
I just searched the COBOL Language Reference manual (link at the top of the page), and there were NO hits for "timestamp". Since the field type has to be a COBOL format, why don't you give us more details -- such as the precise PICTURE clause for the data field since we know it will not be "PIC TIMESTAMP" -- and we can provide some help.
DB2 has a format for "timestamp". SMF has a different format for "timestamp". I'm sure there are others -- so "timestamp" does not even have a standard format. |
|
Back to top |
|
|
enrico-sorichetti
Superior Member
Joined: 14 Mar 2007 Posts: 10873 Location: italy
|
|
|
|
extract the date part from the timestamp and ..
perform the proper computations
rebuild the timestamp!
look at the CEEDAYS and CEEDATE LE callable functions
CEEDAYS will convert a date to an absolute number
CEEDATE will convert back to a date
the logic... ( only the logic )
new_date = CEEDATE(CEEDAYS(old_date)+90)
look at the manuals for the exact syntax
here is a link to a sample
www-01.ibm.com/support/docview.wss?uid=nas1b5974feb06cc159a862565c2007d14f9 |
|
Back to top |
|
|
Bill O'Boyle
CICS Moderator
Joined: 14 Jan 2008 Posts: 2501 Location: Atlanta, Georgia, USA
|
|
|
|
After you post your timestamp format, review COBOL INTRINSIC FUNCTIONS. The minimum version/release must be COBOL/370. If you really mean a datestamp, the format can be YYYYMMDD (Gregorian) or YYYYDDD (Julian).
If you are running COBOL2 or even OS/VS COBOL ( ), then Language Environment must have been installed in your LPAR. If this is true, then follow Enrico's advice.
The LE Callable Service routines will return you a "Feedback Code", which indicates success/failure of the CALL.
Unfortunately, INTRINSIC DATE FUNCTIONS expect the passed-date to be valid. Otherwise, for invalid passed-dates, you'll crash and burn....
Bill |
|
Back to top |
|
|
|