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

Cobol date function


IBM Mainframe Forums -> COBOL Programming
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
abhishek mitra

New User


Joined: 24 Feb 2008
Posts: 48
Location: Kolkata

PostPosted: Tue Sep 15, 2009 7:59 pm
Reply with quote

Hi,

Just wanted to know can a Integer-of-date function handle the change of year or leap year.

what i mean is that
will Integer-of-date('20093112') + 1 give a date of 01/01/2010?
will integer-of-date(20080228')) + 1 give a date of 29/02/2008?
Back to top
View user's profile Send private message
enrico-sorichetti

Superior Member


Joined: 14 Mar 2007
Posts: 10873
Location: italy

PostPosted: Tue Sep 15, 2009 8:04 pm
Reply with quote

it would be embarassing if not icon_wink.gif
Back to top
View user's profile Send private message
abhishek mitra

New User


Joined: 24 Feb 2008
Posts: 48
Location: Kolkata

PostPosted: Tue Sep 15, 2009 8:05 pm
Reply with quote

enrico-sorichetti wrote:
it would be embarassing if not icon_wink.gif


Thanks a lot icon_biggrin.gif
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: Tue Sep 15, 2009 8:14 pm
Reply with quote

Have you read the manual (link at the top of the page) on the INTEGER-OF-DATE function? The manual specifically states that INTEGER-OF-DATE converts a YYYYMMDD value into an integer in the range 1 to 3,067,671 (January 1, 1601 to December 31, 9999). Adding 1 to an integer as long as it stays in this range will be fine.

Converting the integer back into a date via the DATE-OF-INTEGER function is listed as being valid for all integers between 1 and 3,067,671. So as long as your integer stays in this range, you can manipulate the value any way you want, being confident that the date resulting will be the correct and valid date.
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: Tue Sep 15, 2009 9:23 pm
Reply with quote

Always remember, Intrinsic Functions (unlike their LE counterparts) will crash and burn if the data passed to them is invalid.

LE will populate the first two-bytes of the 12-Byte Feedback Parm with a value of other than X'0000' when bad data is passed.

But, FUNCTIONS and their LE counterparts should not be mixed, unless you use the correct compile option, which will make them uniform.

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 Replacing 'YYMMDD' with date, varying... SYNCSORT 3
No new posts Replace each space in cobol string wi... COBOL Programming 3
No new posts COBOL -Linkage Section-Case Sensitive COBOL Programming 1
No new posts Modifying Date Format Using DFSORT DFSORT/ICETOOL 9
No new posts COBOL ZOS Web Enablement Toolkit HTTP... COBOL Programming 0
Search our Forums:

Back to Top