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

RR RS CS and UR


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

Active User


Joined: 08 Feb 2009
Posts: 116
Location: CHENNAI/NEW JERSEY - INDIA/USA

PostPosted: Mon Dec 27, 2010 9:54 pm
Reply with quote

Hi,

Could any one explain the difference between RR and RS from Cobol-Db2 programming point of view.

I have gone through the links which explains the difference between RR and RS. But its not very clear.

My understanding is that both are same but for Phantom Rows.
Back to top
View user's profile Send private message
sushanth bobby

Senior Member


Joined: 29 Jul 2008
Posts: 1020
Location: India

PostPosted: Tue Dec 28, 2010 2:56 am
Reply with quote

Elixir,

RR is more restrictive than RS, because every row that is referenced is locked and another application cannot insert or update a row that would be added to the list of rows referenced by a query if that query were to be executed again in that UOW.

You can do a simple test using SPUFI to know how RR works,

Code:

Step 1:
Set the following values in spufi,
AUTOCOMMIT ...... ===> NO         
ISOLATION LEVEL   ===> RR         (RR=Repeatable Read, CS=Cursor Stability,
                                   UR=Uncommitted Read)                   


Stetp 2:
Execute a simple query like,
SELECT EMPE_NO,EMP_NAME,CCRF_COST_CNTER_CD,   
CODM_LAWS_ACCT_CD                             
FROM BOBT1.EMPINFO                             
WHERE CCRF_COST_CNTER_CD=100                   

Step 3:
You will get the results and in the next screen, it will ask you commit or rollback.

Dont' enter any values(commit / rollback).


Step 4:
Submit a batch DSNTEP2 job to insert a row like,
INSERT INTO BOBT1.EMPINFO VALUES(199,'TEST',100,'Z');


The Batch job will wait, till you do an commit/rollback in the SPUFI.


Step 5:
Commit in spufi, you will get a message that batch job is successfully executed.


Repeat the same test after changing the isolation level to CS in spufi,
ISOLATION LEVEL ===> CS


Thanks,
Sushanth
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 -> DB2

 


Search our Forums:

Back to Top