|   | 
	 
  
    | 
RSS Feed - WebSphere MQ Support
 | 
RSS Feed - Message Broker Support
 |   
 
  
	     | 
	 | 
   
 
  
	|  two phase commit for : z/OS, Cics, 3270 bridge, DB2, Cobol | 
	« View previous topic :: View next topic »  | 
   
  
  	
	  
		
		
		  | Author | 
		  Message
		 |  
		
		  | EgilsJ.Rubenis | 
		  
		    
			  
				 Posted: Thu Jan 23, 2003 12:47 am    Post subject: two phase commit for : z/OS, Cics, 3270 bridge, DB2, Cobol | 
				     | 
			   
			 
		   | 
		 
		
		   Acolyte
 
 Joined: 18 Nov 2002 Posts: 63 Location: Germany, Alfeld 
  | 
		  
		    
			  
				Hi, 
 
 
can somebody tell me how to implement a two phase commit?
 
I have incoming messages on Queue triggering a CicsTransaction.
 
The CicsTransaction updates data in a DB2 table.
 
 
My assumption so far from what i read in books is:
 
 
CicsTransaction
 
  EXEC CICS SYNCPOINT
 
  PERFORM UNTIL NO FURTHER MESSAGES
 
    MQGET
 
    INSERT DATA on TABLE
 
    COMMIT
 
 
Question: Does the Commit set both, the Message and the DB Changes
 
or ist there anything else to do ?
 
 
thanks for your help | 
			   
			 
		   | 
		 
		
		  | Back to top | 
		  
		  	
		   | 
		 
		
		    | 
		 
		
		  | oz1ccg | 
		  
		    
			  
				 Posted: Thu Jan 23, 2003 2:07 am    Post subject:  | 
				     | 
			   
			 
		   | 
		 
		
		    Yatiri
 
 Joined: 10 Feb 2002 Posts: 628 Location: Denmark 
  | 
		  
		    
			  
				In CICS, the CICS acts as two-phase Commit coordinator, and therefore demands the other resource managers to either do commit or backout. So twophase commit is done automaticly in CICS.
 
 
You control it with EXEC CICS SYNCPOINT or EXEC CICS SYNCPOINT ROLLBACK, this is all in the CICS Application Programming Reference manual.
 
 
I have a comment on your design:
 
I personally like to do commits often, so I don't get a deadlock, because many systems are on-line systems.
 
 
CicsTransaction 
 
   
	| Code: | 
   
  
	
 
PERFORM UNTIL NO FURTHER MESSAGES 
 
   MQGET 
 
   INSERT DATA on TABLE 
 
   EXEC CICS SYNCPOINT 
 
   END-PERFORM
 
MQCLOSE | 
   
 
 
The last MQCLOSE is important, (the manual say that CICS do it automaticly) because the CICS will first issue the MQCLOSE when it have resources for cleanup, or are in need of resources.
 
 
I had this situation:
 
The queue was open for input, and therefore didn't MQ issue a new trigger, and waited until eiter the triggerinterval occured or cleanup in the CICS.... Quite difficult to spot, because the CICS task was invisible in CEMT I TA(*)
 
 
Just my $0.02    _________________ Regards, Jørgen
 
Home of BlockIP2, the last free MQ Security exit  ver. 3.00
 
Cert. on WMQ, WBIMB, SWIFT.
  Last edited by oz1ccg on Thu Jan 23, 2003 2:14 am; edited 1 time in total | 
			   
			 
		   | 
		 
		
		  | Back to top | 
		  
		  	
		   | 
		 
		
		    | 
		 
		
		  | bob_buxton | 
		  
		    
			  
				 Posted: Thu Jan 23, 2003 2:09 am    Post subject:  | 
				     | 
			   
			 
		   | 
		 
		
		    Master
 
 Joined: 23 Aug 2001 Posts: 266 Location: England 
  | 
		  
		    
			  
				You use the EXEC CICS SYNCPOINT to perform the commit so you would not do that call first.  This will cause DB2, MQ and any other resource managers to commit their updates.
 
 
You could choose to issue the Syncpoint after performing the DB2 updates relating to a sungle MQ message,  after a group of messages or after emptying the whole queue.   If you choose the latter option you need to consider how long you might be holding locks on DB2 rows whilst processing the queue, especially if you use MQGET WAIT to wait for more messages to arrive on the queue. _________________ Bob Buxton
 
Ex-Websphere MQ Development | 
			   
			 
		   | 
		 
		
		  | Back to top | 
		  
		  	
		   | 
		 
		
		    | 
		 
		
		  | 
		    
		   | 
		 
	   
	 | 
   
 
  
	     | 
	 | 
	Page 1 of 1 | 
   
 
 
 
  
  	
	  
		
		  
 
  | 
		  You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
  | 
  		 
	   
	 | 
   
 
  	 | 
	  |