There might be occasions when you want a batch job to have exclusive access to a migrated data set. This is equivalent to specifying DISP=OLD in your JCL. CICS® VT provides a facility to exclusively access a migrated data set by issuing the LOCK tabx IN EXCLUSIVE MODE command when your application program opens the data set.
To use the facility, add the following DD statement to the JCL for your batch job:
//VIDLOCK DD *
dim-name1
dim-name2
dim-name3
For each DIM name specified, CICS VT locks the table in exclusive mode. The facility is available for batch jobs that run in either non-subtasking or subtasking modes.
Using the table lock facility imposes certain rules as follows:
If one or more of these rules are not met, CICS VT issues a U3127 abend during open processing and the program is abnormally terminated.
These rules are required in case you add SQL commit statements to your program, in which case the table lock would otherwise be released by a commit.
There are implications if you use the table lock facility for a DIM that has an IRD exit. CICS VT assumes that the IRD exit is being used to split a data set into multiple DB2 tables. To achieve the equivalent of DISP=OLD, a table accessed by an IRD exit must also be locked. You must take this into consideration when you write an IRD exit, and add the appropriate code.
During an open call for a DIM that is specified in the VIDLOCK DD statement, CICS VT calls the IRD exit. In the parameter list that CICS VT provides to the exit, the field IRDFUNCT has a value of ‘X’. Before the exit ends and returns control to CICS VT, the field IRDRET must be set to a value of ‘X’. When CICS VT resumes control, the value of IRDRET is checked. If it is not ‘X’, CICS VT issues a U3126 abend and the program is abnormally terminated
It is not essential for your IRD exit to issue the LOCK TABLE SQL statement, but IRDRET must be set correctly to avoid a U3126 abend.