View previous topic :: View next topic
|
Author |
Message |
krsenthil85
New User
Joined: 31 Aug 2007 Posts: 55 Location: bangalore
|
|
|
|
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 |
|
|
Craq Giegerich
Senior Member
Joined: 19 May 2007 Posts: 1512 Location: Virginia, USA
|
|
|
|
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 |
|
|
Bill O'Boyle
CICS Moderator
Joined: 14 Jan 2008 Posts: 2501 Location: Atlanta, Georgia, USA
|
|
Back to top |
|
|
Ketan Varhade
Active User
Joined: 29 Jun 2009 Posts: 197 Location: Mumbai
|
|
|
|
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 |
|
|
Escapa
Senior Member
Joined: 16 Feb 2007 Posts: 1399 Location: IL, USA
|
|
|
|
Quote: |
Many of the shops does now have CEEDAYS |
Do you mean to say...
Many of the shops does not have CEEDAYS
|
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
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 |
|
|
|