View previous topic :: View next topic
|
Author |
Message |
neo4u
New User
Joined: 03 Oct 2016 Posts: 8 Location: India
|
|
|
|
Hi,
Is there any way to abend a select SQL inside a program to abend; without modifying the query? I need to abend the program to test a scenario, where any Sqlcode other than 0,+100 I have to insert a record in a different table. I can test this by manually moving a different sqlcode to the SQLCA variable; but want to know if there any any way without modified the program/sql.
I tried to force -811 but the primary key would not allow me to do so.
Let me know your suggestions.
Thanks, |
|
Back to top |
|
|
prino
Senior Member
Joined: 07 Feb 2009 Posts: 1306 Location: Vilnius, Lithuania
|
|
|
|
Running the program under Debug Tool in batch will allow you to do this. |
|
Back to top |
|
|
Rohit Umarjikar
Global Moderator
Joined: 21 Sep 2010 Posts: 3053 Location: NYC,USA
|
|
|
|
I can test this by manually moving a different sqlcode to the SQLCA variable; but want to know if there any any way without modified the program/sql. How would that change the results of what you are testing?
Quote: |
I tried to force -811 but the primary key would not allow me to do so. |
If duplicates are not allowed then whats the point of testing -811, since it will never ever come? if you are joining with some other tables then you need to modify them ( if you can) to test the real scenario. |
|
Back to top |
|
|
neo4u
New User
Joined: 03 Oct 2016 Posts: 8 Location: India
|
|
|
|
Rohit Umarjikar wrote: |
I can test this by manually moving a different sqlcode to the SQLCA variable; but want to know if there any any way without modified the program/sql. How would that change the results of what you are testing?
Quote: |
I tried to force -811 but the primary key would not allow me to do so. |
If duplicates are not allowed then whats the point of testing -811, since it will never ever come? if you are joining with some other tables then you need to modify them ( if you can) to test the real scenario. |
What I am trying to test is not the SQLCODE, it is the step if I ever get an error other than 0 or +100. So by moving a false sqlcode, i can test the WHEN OTHER condition. |
|
Back to top |
|
|
Rohit Umarjikar
Global Moderator
Joined: 21 Sep 2010 Posts: 3053 Location: NYC,USA
|
|
|
|
Reread what you said and asked in your first post vs above post. Both don’t make sense they look contradictory. |
|
Back to top |
|
|
Arun Raj
Moderator
Joined: 17 Oct 2006 Posts: 2481 Location: @my desk
|
|
|
|
neo4u,
Did you notice what prino had pointed out earlier? If you have any debugging tool (IBM Debug, Xpeditor etc..) you could run your test in batch using the tool, and set a break point after the SQL execution. Then overtype the SQLCODE value to the desired value and execute the rest of the program. |
|
Back to top |
|
|
bauer
New User
Joined: 03 Mar 2009 Posts: 28 Location: germany
|
|
|
|
1) LOCK TABLE <yourTableWhereYouSelect> IN EXCLUSIVE MODE by SPUFI without commit
2) Execute your program, wait für SQL -904 after timeout
3) ROLLBACK in SPUFI the pending command from step (1) |
|
Back to top |
|
|
Pandora-Box
Global Moderator
Joined: 07 Sep 2006 Posts: 1592 Location: Andromeda Galaxy
|
|
|
|
There are many ways to test :
1. Ask your DBA to put the Tablespace in any of the pending status and when you try to access you get -904
2. Try to update the table without commit and so you get -911
3 As pointed by prino if you have a debugging tool you could override the SQL CODE at runtime.
.. |
|
Back to top |
|
|
|