Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist 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: 10327
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: 8165
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: 2504
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 IEW2456E error when link-editing a C ... Senthilraj JCL & VSAM 0 Fri Oct 13, 2017 3:12 pm
No new posts Assembler Macro Copybook converted to... Ziquilix PL/I & Assembler 4 Tue Sep 26, 2017 3:07 am
No new posts Compare yesterday's date to the one o... migusd SYNCSORT 11 Fri Sep 22, 2017 11:35 pm
No new posts Validate the Date girishb2 DFSORT/ICETOOL 9 Tue Sep 19, 2017 1:12 am
This topic is locked: you cannot edit posts or make replies. Extract all "IF" Statements... Adarsh Damodaran CLIST & REXX 1 Wed Sep 06, 2017 9:28 am

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us