View previous topic :: View next topic
|
Author |
Message |
anilsanda
New User
Joined: 07 Jun 2007 Posts: 15 Location: chennai
|
|
|
|
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 |
|
|
Bill O'Boyle
CICS Moderator
Joined: 14 Jan 2008 Posts: 2501 Location: Atlanta, Georgia, USA
|
|
|
|
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 |
|
|
Bill O'Boyle
CICS Moderator
Joined: 14 Jan 2008 Posts: 2501 Location: Atlanta, Georgia, USA
|
|
|
|
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 |
|
|
|