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

Handle invalid dates


IBM Mainframe Forums -> COBOL Programming
Post new topic   Reply to topic
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
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
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: 2501
Location: Atlanta, Georgia, USA

PostPosted: Wed Aug 05, 2009 1:32 am
Reply with quote

Click on this LINK -

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
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
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

Moderator Emeritus


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

PostPosted: Wed Aug 05, 2009 7:41 pm
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 View Bookmarks
All times are GMT + 6 Hours
Forum Index -> COBOL Programming

 


Similar Topics
Topic Forum Replies
No new posts Amount of days between two dates PL/I & Assembler 8
No new posts Invalid URL in Sticky topic TSO/ISPF 1
No new posts Blue zone error with an invalid exten... CICS 3
No new posts DFSORT to handle in between specific ... DFSORT/ICETOOL 6
No new posts HANDLE AD2R CICS ABEND CICS 4
Search our Forums:

Back to Top