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
 

 

Easiest way to do date validation in a cobol program

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming
View previous topic :: :: View next topic  
Author Message
karthik_sripal

New User


Joined: 28 Mar 2008
Posts: 67
Location: 125.16.180.5

PostPosted: Sun May 31, 2009 12:21 pm    Post subject: Easiest way to do date validation in a cobol program
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: 6968
Location: porcelain throne

PostPosted: Sun May 31, 2009 2:42 pm    Post subject:
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: 2502
Location: Atlanta, Georgia, USA

PostPosted: Mon Jun 01, 2009 1:58 am    Post subject: Reply to: Easiest way to do date validation in a cobol progr
Reply with quote

Dick is correct as Language Environment does offer a Callable Service routine for date validation.

Click below -

http://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    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 XML Parse for COBOL 5.2 Bhanu Praveen COBOL Programming 1 Sat Jul 08, 2017 8:58 pm
No new posts How to add header with Date(YYMMDD) i... Rajan Moorthy DFSORT/ICETOOL 2 Thu Jul 06, 2017 11:44 pm
No new posts Writing a file using online program grvtomar PL/I & Assembler 3 Fri Jun 30, 2017 1:06 pm
No new posts pre-compiler for program in an HFS Pedro DB2 0 Fri Jun 23, 2017 11:13 pm
No new posts Dynamic output file creation in cobol... smileheal COBOL Programming 7 Thu Jun 15, 2017 10:53 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us