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

How to roll back my work in online program.


IBM Mainframe Forums -> CICS
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
vardhan0007

New User


Joined: 05 Jun 2006
Posts: 51
Location: Bangalore,India

PostPosted: Thu Aug 23, 2007 6:09 pm
Reply with quote

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
View user's profile Send private message
William Thompson

Global Moderator


Joined: 18 Nov 2006
Posts: 3156
Location: Tucson AZ

PostPosted: Thu Aug 23, 2007 6:16 pm
Reply with quote

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
View user's profile Send private message
Craq Giegerich

Senior Member


Joined: 19 May 2007
Posts: 1512
Location: Virginia, USA

PostPosted: Thu Aug 23, 2007 6:20 pm
Reply with quote

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
View user's profile Send private message
vardhan0007

New User


Joined: 05 Jun 2006
Posts: 51
Location: Bangalore,India

PostPosted: Thu Aug 23, 2007 7:39 pm
Reply with quote

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
View user's profile Send private message
dick scherrer

Moderator Emeritus


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

PostPosted: Thu Aug 23, 2007 7:51 pm
Reply with quote

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
View user's profile Send private message
William Thompson

Global Moderator


Joined: 18 Nov 2006
Posts: 3156
Location: Tucson AZ

PostPosted: Thu Aug 23, 2007 8:06 pm
Reply with quote

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
View user's profile Send private message
vardhan0007

New User


Joined: 05 Jun 2006
Posts: 51
Location: Bangalore,India

PostPosted: Thu Aug 23, 2007 8:38 pm
Reply with quote

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
View user's profile Send private message
William Thompson

Global Moderator


Joined: 18 Nov 2006
Posts: 3156
Location: Tucson AZ

PostPosted: Thu Aug 23, 2007 9:06 pm
Reply with quote

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
View user's profile Send private message
vardhan0007

New User


Joined: 05 Jun 2006
Posts: 51
Location: Bangalore,India

PostPosted: Thu Aug 23, 2007 9:16 pm
Reply with quote

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
View user's profile Send private message
William Thompson

Global Moderator


Joined: 18 Nov 2006
Posts: 3156
Location: Tucson AZ

PostPosted: Thu Aug 23, 2007 9:40 pm
Reply with quote

Syncpoints are done just like the rollback, but without the rollback in them..... icon_smile.gif
Back to top
View user's profile Send private message
vardhan0007

New User


Joined: 05 Jun 2006
Posts: 51
Location: Bangalore,India

PostPosted: Thu Aug 23, 2007 9:51 pm
Reply with quote

How to know whether it is a one transaction or not please advice as Iam new to CICS icon_confused.gif
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: Thu Aug 23, 2007 9:57 pm
Reply with quote

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
View user's profile Send private message
William Thompson

Global Moderator


Joined: 18 Nov 2006
Posts: 3156
Location: Tucson AZ

PostPosted: Thu Aug 23, 2007 9:59 pm
Reply with quote

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
View user's profile Send private message
vardhan0007

New User


Joined: 05 Jun 2006
Posts: 51
Location: Bangalore,India

PostPosted: Wed Sep 26, 2007 1:06 pm
Reply with quote

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
View user's profile Send private message
CICS Guy

Senior Member


Joined: 18 Jul 2007
Posts: 2146
Location: At my coffee table

PostPosted: Wed Sep 26, 2007 2:22 pm
Reply with quote

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
View user's profile Send private message
vardhan0007

New User


Joined: 05 Jun 2006
Posts: 51
Location: Bangalore,India

PostPosted: Wed Sep 26, 2007 2:56 pm
Reply with quote

icon_sad.gif 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
View user's profile Send private message
dick scherrer

Moderator Emeritus


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

PostPosted: Wed Sep 26, 2007 8:28 pm
Reply with quote

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
View user's profile Send private message
vardhan0007

New User


Joined: 05 Jun 2006
Posts: 51
Location: Bangalore,India

PostPosted: Wed Sep 26, 2007 8:54 pm
Reply with quote

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
View user's profile Send private message
dick scherrer

Moderator Emeritus


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

PostPosted: Wed Sep 26, 2007 9:54 pm
Reply with quote

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
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 -> CICS

 


Similar Topics
Topic Forum Replies
No new posts Using API Gateway from CICS program CICS 0
No new posts isfline didnt work in rexx at z/OS ve... CLIST & REXX 7
No new posts DB2 Event passed to the Application P... DB2 1
No new posts How to pass the PARM value to my targ... COBOL Programming 8
No new posts REXX code to expand copybook in a cob... CLIST & REXX 2
Search our Forums:

Back to Top