View previous topic :: View next topic
|
Author |
Message |
ashish tech
New User
Joined: 05 Dec 2007 Posts: 7 Location: Delhi
|
|
|
|
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 |
|
|
stodolas
Active Member
Joined: 13 Jun 2007 Posts: 632 Location: Wisconsin
|
|
|
|
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 |
|
|
arivazhagan_k
New User
Joined: 05 Dec 2007 Posts: 57 Location: chennai
|
|
|
|
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 |
|
|
stodolas
Active Member
Joined: 13 Jun 2007 Posts: 632 Location: Wisconsin
|
|
|
|
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 |
|
|
arivazhagan_k
New User
Joined: 05 Dec 2007 Posts: 57 Location: chennai
|
|
|
|
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 |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
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
Most code tests for "expected" errors (i.e. row not found) and has a catch-all for any unexpected return codes. |
|
Back to top |
|
|
skkp2006
New User
Joined: 14 Jul 2006 Posts: 93 Location: Chennai,India
|
|
|
|
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 |
|
|
die7nadal
Active User
Joined: 23 Mar 2005 Posts: 156
|
|
|
|
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 |
|
|
ashish tech
New User
Joined: 05 Dec 2007 Posts: 7 Location: Delhi
|
|
|
|
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 |
|
|
ashish tech
New User
Joined: 05 Dec 2007 Posts: 7 Location: Delhi
|
|
|
|
Steve, i got the version of db2. It is 7.10 |
|
Back to top |
|
|
TG Murphy
Active User
Joined: 23 Mar 2007 Posts: 148 Location: Ottawa Canada
|
|
|
|
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 |
|
|
|