Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

Cobol date function

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming
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    Post subject: Cobol date function
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

Global Moderator


Joined: 14 Mar 2007
Posts: 10274
Location: italy

PostPosted: Tue Sep 15, 2009 8:04 pm    Post subject: Reply to: Cobol date function
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    Post subject: Re: Reply to: Cobol date function
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: 8119
Location: East Dubuque, Illinois, USA

PostPosted: Tue Sep 15, 2009 8:14 pm    Post subject:
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: 2502
Location: Atlanta, Georgia, USA

PostPosted: Tue Sep 15, 2009 9:23 pm    Post subject: Reply to: Cobol date function
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    IBMMAINFRAMES.com Support Forums -> COBOL Programming All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts XML Parse for COBOL 5.2 Bhanu Praveen COBOL Programming 1 Sat Jul 08, 2017 8:58 pm
No new posts How to add header with Date(YYMMDD) i... Rajan Moorthy DFSORT/ICETOOL 2 Thu Jul 06, 2017 11:44 pm
No new posts Dynamic output file creation in cobol... smileheal COBOL Programming 7 Thu Jun 15, 2017 10:53 pm
No new posts What is the Extract Function in JCL dharmaraok JCL & VSAM 3 Wed Jun 14, 2017 9:12 am
No new posts Search utility(3.14) using JCl and Cobol RKS3 COBOL Programming 12 Sat Jun 10, 2017 10:24 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us