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

Easiest way to do date validation in a cobol program


IBM Mainframe Forums -> COBOL Programming
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
karthik_sripal

New User


Joined: 28 Mar 2008
Posts: 69
Location: 125.16.180.5

PostPosted: Sun May 31, 2009 12:21 pm
Reply with quote

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 icon_sad.gif

please point me if there is any good discussion on a similar note earlier.

Thanks in advance !! icon_smile.gif
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Sun May 31, 2009 2:42 pm
Reply with quote

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
View user's profile Send private message
Bill O'Boyle

CICS Moderator


Joined: 14 Jan 2008
Posts: 2501
Location: Atlanta, Georgia, USA

PostPosted: Mon Jun 01, 2009 1:58 am
Reply with quote

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
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 Using API Gateway from CICS program CICS 0
No new posts COBOL -Linkage Section-Case Sensitive COBOL Programming 1
No new posts Modifying Date Format Using DFSORT DFSORT/ICETOOL 9
Search our Forums:

Back to Top