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: 10231
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: 7995
Location: Bellevue, IA

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 Date and time format in CICS Chandru3183 CICS 2 Sat Mar 18, 2017 12:46 pm
No new posts How to get current date -1 and curren... murali.andaluri DFSORT/ICETOOL 3 Wed Mar 08, 2017 2:09 pm
No new posts Overlay the system date Danielle.Filteau SYNCSORT 4 Fri Mar 03, 2017 1:16 am
No new posts SQL query not working in Cobol program. CuriousMainframer COBOL Programming 14 Wed Feb 22, 2017 5:56 pm
No new posts Execute TSO ACF commands from COBOL-I... supreethi.srid TSO/ISPF 0 Tue Feb 21, 2017 5:19 pm


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