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

HOW TO SIMULATE DB2 SQLCODE OF -534, -180, -532


IBM Mainframe Forums -> DB2
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
ashish tech

New User


Joined: 05 Dec 2007
Posts: 7
Location: Delhi

PostPosted: Thu Dec 13, 2007 11:03 am
Reply with quote

Can anyone quote the 1 example for each of the SQLCODE -534, -180 and -532? As i need to simulate all these SQLCODEs and test my COBOL-DB2 program conditions. Let me know if need more information.

I tried following SQL (without using cursor) to simulate -534 but i got -803 instead:
EXEC SQL
UPDATE T1.VH_ACCT_RULES
SET I_RULE = 'CURR-MONTH'
WHERE I_RULE_COPYBOOK = 'VHR111'
END-EXEC
where I_RULE is primary key and multiple rows exists for the condition I_RULE_COPYBOOK = 'VHR111'.
Back to top
View user's profile Send private message
stodolas

Active Member


Joined: 13 Jun 2007
Posts: 632
Location: Wisconsin

PostPosted: Thu Dec 13, 2007 9:25 pm
Reply with quote

What version of DB2 are you running?
The QW on -534 has the following to say

Note: This SQLCODE will only be issued for plans and packages bound prior
to Version 5. SQLCODE -534 will not be issued for dynamic SQL or
plans and packages bound with Version 5 or later releases.

The -180 is easy enough try to update a timestamp column with one that DB2 can't support like 2007-12-13 09.48.53:798.478

I can't say on the -532
Back to top
View user's profile Send private message
arivazhagan_k

New User


Joined: 05 Dec 2007
Posts: 57
Location: chennai

PostPosted: Thu Dec 13, 2007 9:33 pm
Reply with quote

SQL CODE -532
A DELETE operation attempted to delete a specified parent
row in the object table and all related descendent rows in the descendent
tables. However, a delete rule of RESTRICT or NO ACTION was specified for one or more descendent tables.
Back to top
View user's profile Send private message
stodolas

Active Member


Joined: 13 Jun 2007
Posts: 632
Location: Wisconsin

PostPosted: Thu Dec 13, 2007 9:38 pm
Reply with quote

Very good, but the poster wants to know how to write a test to test that condition, not the pasting from the manual that tells what the error is.
Back to top
View user's profile Send private message
arivazhagan_k

New User


Joined: 05 Dec 2007
Posts: 57
Location: chennai

PostPosted: Thu Dec 13, 2007 9:53 pm
Reply with quote

SQL CODE -532

That test query may be

DELETE FROM T1.VH_ACCT_RULES
WHERE I_RULE = 'CURR-MONTH'


Correct me if i am wrong .
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: Fri Dec 14, 2007 2:34 am
Reply with quote

Hello,

Quote:
-534, -180 and -532
Do you have some set of more inclusive return codes you are supposed to "test"? I am somewhat confused as to why it is necessary to run specific tests simulate situations for return codes that are not common icon_confused.gif

Most code tests for "expected" errors (i.e. row not found) and has a catch-all for any unexpected return codes.
Back to top
View user's profile Send private message
skkp2006

New User


Joined: 14 Jul 2006
Posts: 93
Location: Chennai,India

PostPosted: Fri Dec 14, 2007 1:12 pm
Reply with quote

It really difficult to simulate all the unexpected return codes like the ones mentioned above as the test data may affect other tables/users.

A simple way is to hard code the value of SQLCODE after the query has completed and you can make sure that your piece of code will trap the unexpected return codes.

Sk
Back to top
View user's profile Send private message
die7nadal

Active User


Joined: 23 Mar 2005
Posts: 156

PostPosted: Fri Dec 14, 2007 8:51 pm
Reply with quote

A much more easier way would be to use debuggers like xpediter, viasoft or mainframe express and change the sqlcode after the query is completed.
Back to top
View user's profile Send private message
ashish tech

New User


Joined: 05 Dec 2007
Posts: 7
Location: Delhi

PostPosted: Mon Dec 17, 2007 12:39 pm
Reply with quote

Thanks all for all ur help!

Steve, as you suggest that for SQLCODE = -534 i shoudl check DB2 version. Could you please tell how to verify the DB2 version i am using. I am using changeman for all file operations. Or do i need to check with DBA or client or someone else?

Thanks
Back to top
View user's profile Send private message
ashish tech

New User


Joined: 05 Dec 2007
Posts: 7
Location: Delhi

PostPosted: Mon Dec 17, 2007 5:11 pm
Reply with quote

Steve, i got the version of db2. It is 7.10
Back to top
View user's profile Send private message
TG Murphy

Active User


Joined: 23 Mar 2007
Posts: 148
Location: Ottawa Canada

PostPosted: Wed Dec 19, 2007 12:39 am
Reply with quote

I agree with Dick.

No need to test these weird SQLCODEs unless your error handling needs to do something special with them. Just let your catch-all error handler do the job.

Some SQLCODEs are indeed special - they require special handling. These include -911 and -904 since some transactions treat these as recoverable errors instead of fatal errors (ie -805).
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 -> DB2

 


Similar Topics
Topic Forum Replies
No new posts SQLCODE = -122 while using the scalar... DB2 4
No new posts SQLCODE = -16002 when using XMLEXISTS DB2 1
No new posts How can we simulate JOINKEYS in ICETOOL DFSORT/ICETOOL 9
No new posts Is SQLCODE -811 possible while fetchi... DB2 1
No new posts SQLCODE=-204 SQLSTATE=42704 DB2 4
Search our Forums:

Back to Top