IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

How to add 90 days to a Timestamp field coming from I/P file


IBM Mainframe Forums -> COBOL Programming
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
sandeep.tikoo

New User


Joined: 07 Oct 2006
Posts: 6
Location: Bangalore

PostPosted: Fri Nov 13, 2009 12:44 am
Reply with quote

I have a requirement in Cobol Pgm

How to add 90 days to a Timestamp field coming from I/P file
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 8697
Location: Dubuque, Iowa, USA

PostPosted: Fri Nov 13, 2009 12:50 am
Reply with quote

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
View user's profile Send private message
enrico-sorichetti

Superior Member


Joined: 14 Mar 2007
Posts: 10873
Location: italy

PostPosted: Fri Nov 13, 2009 12:50 am
Reply with quote

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
View user's profile Send private message
Bill O'Boyle

CICS Moderator


Joined: 14 Jan 2008
Posts: 2501
Location: Atlanta, Georgia, USA

PostPosted: Fri Nov 13, 2009 1:56 am
Reply with quote

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 ( icon_eek.gif ), 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
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> COBOL Programming

 


Similar Topics
Topic Forum Replies
No new posts Compare 2 files and retrive records f... DFSORT/ICETOOL 3
No new posts FTP VB File from Mainframe retaining ... JCL & VSAM 8
No new posts Extract the file name from another fi... DFSORT/ICETOOL 6
No new posts How to split large record length file... DFSORT/ICETOOL 10
No new posts Extracting Variable decimal numbers f... DFSORT/ICETOOL 17
Search our Forums:

Back to Top