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
 
Handle invalid dates

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

New User


Joined: 31 Aug 2007
Posts: 55
Location: bangalore

PostPosted: Tue Aug 04, 2009 11:09 pm    Post subject: Handle invalid dates
Reply with quote

I want to handle the invalid dates before inserting into the table

For example '2009/02/31' is an invalid date when i tried to insert into table it will give the Sql return code as- 181. So before inserting i want to validate.

Is there is any method to identify instead of writing the actual logic for the date validation.
Back to top
View user's profile Send private message

Craq Giegerich

Senior Member


Joined: 19 May 2007
Posts: 1512
Location: Virginia, USA

PostPosted: Tue Aug 04, 2009 11:49 pm    Post subject:
Reply with quote

If your insert or update fails with a -180 or -181 then there is something wrong with the date!

or

Code:
EXEC SQL
SET :WS-DATE = :WS-DATE - 0 DAYS
END-EXEC.
IF SQLCODE = -180 OR SQLCODE = -181
    take error action
END-IF.
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: Wed Aug 05, 2009 1:32 am    Post subject: Reply to: Handle invalid dates
Reply with quote

Click on this LINK -

http://www.ibmmainframes.com/viewtopic.php?p=192595&highlight=#192595

Bill
Back to top
View user's profile Send private message
Ketan Varhade

Active User


Joined: 29 Jun 2009
Posts: 197
Location: Mumbai

PostPosted: Wed Aug 05, 2009 11:12 am    Post subject:
Reply with quote

Hi Bill,
Many of the shops does now have CEEDAYS . I too having the same problem and I am handling this using the SQL check. So is there any way by which we can handle this in COBOL
Back to top
View user's profile Send private message
Escapa

Senior Member


Joined: 16 Feb 2007
Posts: 1399
Location: IL, USA

PostPosted: Wed Aug 05, 2009 11:35 am    Post subject:
Reply with quote

Quote:
Many of the shops does now have CEEDAYS

Do you mean to say...

Many of the shops does not have CEEDAYS

icon_question.gif
Back to top
View user's profile Send private message
dick scherrer

Site Director


Joined: 23 Nov 2006
Posts: 19270
Location: Inside the Matrix

PostPosted: Wed Aug 05, 2009 7:41 pm    Post subject:
Reply with quote

Hello,

Quote:
So is there any way by which we can handle this in COBOL
Most mainframe development environments have a local implementation of code for data validation that is called.

Suggest you ask if such a data validation routine is available on your system.

It is quite wasteful to code/maintain an entire date validation routine in every program that works with a date that needs to be validated. . . The common routine (if it exists), CEEDAYS, or SQL are all better choices than a custom set of code. . .
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 INVALID RECFM FOR DDNAME SYSLIN AND C... sandeep kumar302 All Other Mainframe Topics 7 Fri Apr 27, 2018 6:07 pm
No new posts Invalid XML character while producing... nikhil.bhole IBM Tools 4 Tue Mar 20, 2018 1:24 am
No new posts Comparing dates in different formats migusd SYNCSORT 4 Sat Nov 18, 2017 3:02 am
No new posts INVALID FIELD OR CONSTANT IN SORTOF ?? Ron Klop DFSORT/ICETOOL 8 Wed Jan 11, 2017 3:44 pm
No new posts hot to get details when "EXEC CI... Andi1982 CICS 11 Tue Sep 20, 2016 5:01 pm

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