You can use the SET CURRENT PACKAGESET statement to set the isolation level of the transaction. The table below lists the package names, the corresponding isolation levels and its equivalent COBOL ODBC SQL statements:
Package Name | Isolation Level | Equivalent COBOL ODBC SQL statement |
---|---|---|
DSNREXRR | Repeatable Read (RR) | EXEC SQL SET TRANSACTION ISOLATION REPEATABLE READ END-EXEC |
DSNREXRS | Read Stability (RS) | EXEC SQL SET TRANSACTION ISOLATION SERIALIZABLE END-EXEC |
DSNREXCS | Cursor Stability (CS) | EXEC SQL SET TRANSACTION ISOLATION READ COMMITTED END-EXEC |
DSNREXUR | Uncommitted Read (UR) | EXEC SQL SET TRANSACTION ISOLATION READ UNCOMMITTED END-EXEC |
For example, you can set the isolation level to repeatable read by executing the following code:
ADDRESS DSNREXX "EXECSQL SET CURRENT PACKAGESET=’DSNREXRR’ "
Using SET CURRENT PACKAGESET with a package name not listed in the table results in an SQL error. See SET TRANSACTION ISOLATION for more information.