IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Is thier any inbuilt function for Date validation in cobol


IBM Mainframe Forums -> COBOL Programming
Post new topic   Reply to topic
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
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: 2501
Location: Atlanta, Georgia, USA

PostPosted: Wed May 21, 2008 3:35 pm
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: 2501
Location: Atlanta, Georgia, USA

PostPosted: Wed May 21, 2008 7:12 pm
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 View Bookmarks
All times are GMT + 6 Hours
Forum Index -> COBOL Programming

 


Similar Topics
Topic Forum Replies
No new posts Replacing 'YYMMDD' with date, varying... SYNCSORT 3
No new posts Replace each space in cobol string wi... COBOL Programming 3
No new posts COBOL -Linkage Section-Case Sensitive COBOL Programming 1
No new posts Modifying Date Format Using DFSORT DFSORT/ICETOOL 9
No new posts COBOL ZOS Web Enablement Toolkit HTTP... COBOL Programming 0
Search our Forums:

Back to Top