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
 

 

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: 2502
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: 2502
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 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