View previous topic :: View next topic
|
Author |
Message |
vardhan0007
New User
Joined: 05 Jun 2006 Posts: 51 Location: Bangalore,India
|
|
|
|
Hi,
I have an online program which is inserting records into 3 db2 tables. This program should behave as follows:--
If the record insertion is successful in all the tables no need to do anything
If the record is inserted in first table and if it fails to insert in to 2nd or 3rd table we need to roll back the record which is already inserted in the prebvious table. We are checking for DB2 return code after every insert and if it is not zero we are calling error para.
Note:-- There no expilict commit or roll back in my program. |
|
Back to top |
|
|
William Thompson
Global Moderator
Joined: 18 Nov 2006 Posts: 3156 Location: Tucson AZ
|
|
|
|
If I recall correctly, the EC SYNCPOINTs replace the DB2 COMMITs.
Using the syncpoint, keep the three table updates within a single LUW (logical unit of work). |
|
Back to top |
|
|
Craq Giegerich
Senior Member
Joined: 19 May 2007 Posts: 1512 Location: Virginia, USA
|
|
|
|
You can't use a DB2 ROLLBACK in a CICS program, you have to use a CICS rollback.
Code: |
EXEC CICS
SYNCPOINT ROLLBACK
END-EXEC.
|
|
|
Back to top |
|
|
vardhan0007
New User
Joined: 05 Jun 2006 Posts: 51 Location: Bangalore,India
|
|
|
|
Here is my error para.If Iam understanding correctly ,I can put the above rollback in this para?
Z100-SQL-ERROR.
SET REQ-DB2-ERROR TO TRUE.
EXEC CICS
SYNCPOINT ROLLBACK
END-EXEC.
MOVE SQLCODE TO REQ-WEB-SQLCODE.
MOVE WS-HOLD-TRANSID TO EIBTRNID.
GO TO 000-RETURN. |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Hello,
That should rollback the current LUW (logical unit of work).
You need to make sure that only what you want is rolled back. If there were uncommitted updates to other than your 3 tables, those updates will also be rolled back. |
|
Back to top |
|
|
William Thompson
Global Moderator
Joined: 18 Nov 2006 Posts: 3156 Location: Tucson AZ
|
|
|
|
vardhan0007 wrote: |
Here is my error para.If Iam understanding correctly ,I can put the above rollback in this para? |
Yes, but as Dick indicated, you will need a syncpoint without the rollback after each pass of successful updates to keep prior ones from rolling back too..... |
|
Back to top |
|
|
vardhan0007
New User
Joined: 05 Jun 2006 Posts: 51 Location: Bangalore,India
|
|
|
|
Ok. If the insertion fails into any of the tables i need to roll back the record for only on that transaction. Means that unit of work or request. So I can go ahead with above change ?. One more query :- How to know the syncpoints? |
|
Back to top |
|
|
William Thompson
Global Moderator
Joined: 18 Nov 2006 Posts: 3156 Location: Tucson AZ
|
|
|
|
vardhan0007 wrote: |
Ok. If the insertion fails into any of the tables i need to roll back the record for only on that transaction. Means that unit of work or request. So I can go ahead with above change ?. One more query :- How to know the syncpoints? |
Is each update of the three tables a separate transaction? If so then the end of the prior transaction (return to CICS) marked the end of the LUW and explicit syncpoints aren't needed, just the rollback..... |
|
Back to top |
|
|
vardhan0007
New User
Joined: 05 Jun 2006 Posts: 51 Location: Bangalore,India
|
|
|
|
I will get the all details from java mercator call and i will insert all the details into 3 different tables. If any one of the insert fails i need to roll back the insert whcih i had done for one table. So i think it is one transaction. Please let me know how to keep syncpoints.
Thanks,
Harsha |
|
Back to top |
|
|
William Thompson
Global Moderator
Joined: 18 Nov 2006 Posts: 3156 Location: Tucson AZ
|
|
|
|
Syncpoints are done just like the rollback, but without the rollback in them..... |
|
Back to top |
|
|
vardhan0007
New User
Joined: 05 Jun 2006 Posts: 51 Location: Bangalore,India
|
|
|
|
How to know whether it is a one transaction or not please advice as Iam new to CICS |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Hello,
The checkpoint/rollback/restart functionality is usually common for an environment.
I'd suggest you talk with others who have update/backout processes already running in that environment.
If is not a good practice to have a different scheme for each author and/or transaction.
If you have not done so already, some time would be well spent with your database support people. |
|
Back to top |
|
|
William Thompson
Global Moderator
Joined: 18 Nov 2006 Posts: 3156 Location: Tucson AZ
|
|
|
|
I can't tell, but if you are in doubt, use the syncpoint after the third table update and before you return....
Does the transaction number change with each entry into your program? If it does, thats a "new" transaction..... |
|
Back to top |
|
|
vardhan0007
New User
Joined: 05 Jun 2006 Posts: 51 Location: Bangalore,India
|
|
|
|
Hi,
I had implimented SYNCPOINT/ROLLBACK logic in my program. It compiled successfully .But I got a mail from CICS people that my program is crashing the region. Can anyone let me know what may be the reason.
Thanks in advance.
Harsha. |
|
Back to top |
|
|
CICS Guy
Senior Member
Joined: 18 Jul 2007 Posts: 2146 Location: At my coffee table
|
|
|
|
That's great, progress.....
Crashing the region....That's a nice technical term....
I can only guess that your logic is faulty..... |
|
Back to top |
|
|
vardhan0007
New User
Joined: 05 Jun 2006 Posts: 51 Location: Bangalore,India
|
|
|
|
Please advice me where I am going wrong. Just I had made a syncpoint brfore insertion of into first table and i have the rollback in db2 error para.
Thanks,
Harsha. |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Hello,
From what you posted, the only advice someone here can offer is "fix your code".
I'm sure that is not an answer you can work with.
If you post that part of the code that "crashes" and the diagnostic information presented by the system, we may be able to help. |
|
Back to top |
|
|
vardhan0007
New User
Joined: 05 Jun 2006 Posts: 51 Location: Bangalore,India
|
|
|
|
Hi Dic,
My code change is as follows.
I had kept EXEC CICS
SYNCPOINT
END-EXEC.
before the isertion into the tables.There is an error para wher we are calling if anything goes wrong in sql operation. In that error para i had kept
EXEC CICS
SYNCPOINT ROLLBACK
END-EXEC.
Below is the dump
CEE3501S The module CEEWUCHA was not found.
CEE3250C The system or user abend ADPL was issued.
From compile unit XXXXXXX at entry point P6330V12 at compile unit offset +000024B0 at entry offset +000024B0 at address
1B547EC0.
XXXXXX = Program Name.
Please advice.
Thanks,
Harsha |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Hello,
Did you look up the ADPL abend? If not, you should.
What is the code in youjr program here
Quote: |
From compile unit XXXXXXX at entry point P6330V12 at compile unit offset +000024B0 at entry offset +000024B0 |
I'd suggest you talk with your CICS system support and determine why CEEWUCHA cannot be found. |
|
Back to top |
|
|
|