Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

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

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DB2
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    Post subject: HOW TO SIMULATE DB2 SQLCODE OF -534, -180, -532
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    Post subject:
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    Post subject:
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    Post subject:
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    Post subject:
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

Site Director


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

PostPosted: Fri Dec 14, 2007 2:34 am    Post subject:
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    Post subject: Reply to: HOW TO SIMULATE DB2 SQLCODE OF -534, -180, -532
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    Post subject:
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    Post subject:
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    Post subject:
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: 149
Location: Ottawa Canada

PostPosted: Wed Dec 19, 2007 12:39 am    Post subject:
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    IBMMAINFRAMES.com Support Forums -> DB2 All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts DB2 SQL Error: SQLCODE=-440, SQLSTATE... kishpra DB2 1 Sat Feb 18, 2017 2:31 am
No new posts SQLCODE-000000080N priya91 DB2 1 Mon Feb 01, 2016 4:35 pm
No new posts Need to understand SQLCODE = 12 rohanthengal DB2 3 Thu Nov 05, 2015 11:22 am
No new posts SQLCODE -922 in Batch-Cics program tr... kishpra CICS 2 Thu Sep 10, 2015 12:36 pm
No new posts SQLCODE -450 for stored procedure spoorni DB2 3 Fri Jan 16, 2015 2:45 am


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us