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
 
Is thier any inbuilt function for Date validation in cobol

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming
View previous topic :: :: View next topic  
Author Message
anilsanda

New User


Joined: 07 Jun 2007
Posts: 15
Location: chennai

PostPosted: Wed May 21, 2008 3:20 pm    Post subject: Is thier any inbuilt function for Date validation in cobol
Reply with quote

HI,

Can u suggest any inbuilt function for date validation in cobol like CURRENT_DATE function which can be used for getting up the current date.

My purpose is to verify whether a given date is valid or not using inbuilt functions in cobol without wriiting code for validating the 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: Wed May 21, 2008 3:35 pm    Post subject: Re: Is thier any inbuilt function for Date validation in cob
Reply with quote

Unfortunately, if you used a COBOL FUNCTION in an attempt to validate a date, the FUNCTION will abend as well as abend your program.

However, review the LE (Language Environment) Callable Service routine "CEEDAYS", which has the ability to return a feedback-halfword (as the first 2-bytes of the 12-byte feedback-parm), indicating a good or bad date had been passed, with good being zero.

Search the IBM.MAINFRAME archives and you should get some hits with examples or find it in an LE manual. It hasn't changed in over 15 years so there shouldn't be any problems with its usage.

The overhead in calling "CEEDAYS" is negligible and this method is used by many shops for date validation. As like many LE Date-Routines, it uses internal tables, so CPU usage is not a worry.

HTH....

Regards,

Bill
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: Wed May 21, 2008 7:12 pm    Post subject: Re: Is thier any inbuilt function for Date validation in cob
Reply with quote

One other point I'd like to mention. You can save yourself a CALL to "CEEDAYS" by first validating the month and the day, providing that the date-format is "CCYYMMDD", which seems to be the ISO-Standard adopted by many shops for Y2K compliance.

Note that when I had said in the previous post, that validating a date using the COBOL FUNCTION could cause an abend, the abend would occur when the FUNCTION has detected an invalid date.

The COBOL FUNCTION equvilent to "CEEDAYS", using a "CCYYMMDD" date-format, is FUNCTION INTEGER-OF-DATE.

Regards,

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 How to display offset thru cobol prog... tvinodkumar7 CICS 1 Sun Apr 22, 2018 8:42 pm
No new posts Linkage editor is part of COBOL, z/OS... ankit.jain COBOL Programming 4 Fri Apr 20, 2018 4:17 pm
This topic is locked: you cannot edit posts or make replies. Difference between EQUAL and EQUAL TO... jithinraghavan COBOL Programming 3 Thu Apr 19, 2018 2:22 am
No new posts Call COBOL or PLI with a click from w... vaibhav gs All Other Mainframe Topics 1 Mon Apr 16, 2018 7:29 pm
No new posts COBOL MVS options BiswajitDG COBOL Programming 8 Fri Apr 06, 2018 12:35 am

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