Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist 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: 6970
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: 2504
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 The same REXX program doesnt work for... jackzhang75 CLIST & REXX 5 Wed Dec 06, 2017 2:51 am
No new posts Fetching data from JHS as per the cur... arunsoods All Other Mainframe Topics 4 Wed Nov 22, 2017 1:54 pm
This topic is locked: you cannot edit posts or make replies. Cobol to fetch the content by using s... arunc55 COBOL Programming 4 Fri Nov 17, 2017 1:25 pm
No new posts Date in where clause - Windows Karthikeyan Subbarayan DB2 9 Wed Nov 15, 2017 9:07 pm
No new posts Calling IKJEFT01 program from Rexx upendrasri CLIST & REXX 8 Wed Nov 15, 2017 4:27 pm

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us