View previous topic :: View next topic
|
Author |
Message |
karthik_sripal
New User
Joined: 28 Mar 2008 Posts: 69 Location: 125.16.180.5
|
|
|
|
Hi all,
I jus want to know, what is the Easiest way to do date validation in a cobol program??
By validation i jus mean a valid date like below nothing more
for eg:5/31/2009 --> valid
5/32/2009 ---> invalid
4/31/2009 -->invalid
sorry if this is a repeated question.i couldn't find anything crisp and clear inside
please point me if there is any good discussion on a similar note earlier.
Thanks in advance !! |
|
Back to top |
|
|
dbzTHEdinosauer
Global Moderator
Joined: 20 Oct 2006 Posts: 6966 Location: porcelain throne
|
|
|
|
I would ask your peers, check with application support, read your site documentation.
Unless your shop has just started writing code,
somewhere, someplace there is a 'DATE' module.
This module would be called by any program that needs to - validate a date
- convert calender to julian - or reverse
- determine difference between two dates
- calculate a date based on an increment and a date
- determine application holidays
As changes in software (LE for instance) occur, newer, faster, more accurate methods are available
to make date calculations/manipulations/conversion
and only one module needs to be changed to take advantage of the upgrades
If such a module does not exist,
earn points by writing/suggesting such a module
and help your site/shop enter the computer age.
My tone may sound a little harsh,
but I doubt that you have explored all the options of your shop
or this site. This topic has been discussed often,
results being a repetition of the above and somebody providing a specific routine.
More than likely Language Environment has a routine.
LE overview
LE Manuals |
|
Back to top |
|
|
Bill O'Boyle
CICS Moderator
Joined: 14 Jan 2008 Posts: 2501 Location: Atlanta, Georgia, USA
|
|
|
|
Dick is correct as Language Environment does offer a Callable Service routine for date validation.
Click below -
ibmmainframes.com/viewtopic.php?p=119165&highlight=#119165
If your compiler supports INTRINSIC FUNCTIONS (COBOL/370 and greater), do not attempt to use the FUNCTION equivalent of CEEDAYS, which is either INTEGER-OF-DATE (CCYYMMDD format) or INTEGER-OF-DAY (CCYYDDD format) to validate a date, because if the date-passed is invalid, your program will crash and burn as the date-passed is expected to be valid.
CEEDAYS can also be used to determine whether a particular year is a leap-year or not.
Language Environment is available for all versions of COBOL.
Please refer to Dick's link for further LE documentation.
Regards, |
|
Back to top |
|
|
|