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

Two phase commit


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

Global Moderator


Joined: 07 Sep 2006
Posts: 1592
Location: Andromeda Galaxy

PostPosted: Sun Mar 25, 2012 9:35 pm
Reply with quote

Hi all,

I have three programs A,B,C

A ==> Main driver cics program which links B and calls C dynamically
B ==> CICS program which process data in tables
C ==> MQ routine which would be called for every MQ operation ( open,put,close)

Now the major driver CICS program A does some process and links B and inserts some records to tables

The program B actually does "EXEC CICS SYNCPOINT END-EXEC" if SQLCODE of table process is 0

So My table has data like

Code:
PROGRAM STARTED
PROGRAM FIRST HALF WITHOUT ERRORS

"The records are actually commited"

and later it calls program C and suppose if open of MQ fails I again link
program B and try to process the tables and the table process was successful and returns back to A where since the MQ process failed I do a SYNCPOINT ROLLBACK

As a table record I try inserting

Code:
MQ PROCESS FAILED


"The records inserted after calling MQ program has not commited"

So its like

My table at the end it has data

Code:
PROGRAM STARTED
PROGRAM FIRST HALF WITHOUT ERRORS


I have two questions here

1.If my first set of records are actually inserted before MQ program call why didnt it insert a record after MQ failure when data insertion was succesful

2.SYNCPOINT ROLLBACK should rollback all the data till the previous syncpoint why didnt it happen that way??

If my doubts are wrong I guess there is some serious problems with my understanding icon_redface.gif

Could someone please help me out??
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Sun Mar 25, 2012 11:03 pm
Reply with quote

you should have the logic to do a syncpoint or rollback in the same place.

keep in mind, the idea of RRSAF
(where you have more than one resource,
in this case DB2 and MQS)
you want a 'commit' or 'rollback' decision based on 'unit of work'.

if the MQS write is based on a successful completion of DB2 process,
you should do the sycnpoint after the MQS write
and not
afer the DB2 process
otherwise, you have divided a unit-of-work, which you should not do.

now, as to your question about what is or is not there after commit and rollback,
insure that you are using RRSAF.

if you are not using RRSAF, then that is another conversation, for another time.

as to why you are performing what should be a batch process in cics,
let the fact that i made the comment suffice as a negative critique.

and last but not least, forget the fact that you have 3 programs,
IT IS ONE TASK,
and work is accomplished in a task, and not a program.
if it helps,
just think as the linked-to and CALLed program as just two more paragraphs within the mainmodule.
Back to top
View user's profile Send private message
Pandora-Box

Global Moderator


Joined: 07 Sep 2006
Posts: 1592
Location: Andromeda Galaxy

PostPosted: Sun Mar 25, 2012 11:22 pm
Reply with quote

Yes Dick

Thanks I understand your point but say there is a requirement that I need to inform certain users that MQ has been failed due to some reason may be like when MQs are down after DB2 process

Yes I do agree with you I need to consider things "1 Unit of work"

How to acheieve that??
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Mon Mar 26, 2012 1:11 am
Reply with quote

you never answered my question about RRSAF.
the 1 unit of work decision is based on your answer to that.
Do you have it installed and implemented?

as far as as informing users that something is not available,
i prefer to notify those who are responsible for insuring that a service is available.
as to notifying the user, how are you communicating with them now?

i have no idea about what your process actually does.
is it screen driven by a user, where you have essentially one transaction?
Back to top
View user's profile Send private message
Pandora-Box

Global Moderator


Joined: 07 Sep 2006
Posts: 1592
Location: Andromeda Galaxy

PostPosted: Mon Mar 26, 2012 7:49 am
Reply with quote

Yes RRSAF is installed nd yeah one unit of work gets done after writing to MQ

No its,not a screen but a web page which calls A
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Mon Mar 26, 2012 4:07 pm
Reply with quote

if the unit of work is complete when mqs is written,
then that is when the syncpoint should be taken either commit or rollback.

when then webpage invokes cics transaction,
how many db2 processes and mqs processes are expected for each invocation?

This thread:
ibmmainframes.com/about55525.html
last two post are of interest.
Back to top
View user's profile Send private message
Pandora-Box

Global Moderator


Joined: 07 Sep 2006
Posts: 1592
Location: Andromeda Galaxy

PostPosted: Tue Mar 27, 2012 12:24 am
Reply with quote

Yes RRSAF is installed nd yeah one unit of work gets done after writing to MQ

No its,not a screen but a web page which calls A
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 Mar 28, 2012 3:19 am
Reply with quote

Hello,

Was there some reason to re-post your previous reply?

I suspect it would have been more productive to answer the question from DBZ as well as comment on the link provided. . . icon_confused.gif

d
Back to top
View user's profile Send private message
Pandora-Box

Global Moderator


Joined: 07 Sep 2006
Posts: 1592
Location: Andromeda Galaxy

PostPosted: Wed Mar 28, 2012 10:02 am
Reply with quote

Oops Apologies my mistake I guess I am in need of break badly I never know why I replied that

For each webpage invocation. I process webpage atleast three times and write to MQ just once

I did see that link long back when the other Dick
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 filter COMMIT/ROLLBACK statements DFSORT/ICETOOL 13
No new posts Why Newcopy is required when we have ... CICS 5
No new posts Commit limit for Delete query through... DB2 10
No new posts Commit a DB2 Table on Unix Server and... DB2 3
No new posts Need information on DB2 COMMIT DB2 9
Search our Forums:

Back to Top