Excessive TCB switching in CICS when CONCURRENCY(REQUIRED) program writes to VSAM file

Why is a thread-safe application in CICS Transaction Server for z/OS (CICS TS) causing excessive TCB switches from the open TCB to the QR TCB and back again when writing to a local VSAM file? The excessive TCB switches occur when the program is writing to an empty VSAM file. The program doing the writes is defined with CONCURRENCY(REQUIRED).

1 reply

When loading an empty VSAM data set, VSAM puts the data set in load mode. To open a file in load mode, CICS cannot use local shared resources (LSR), so the file must be opened in non-shared resources (NSR) mode. NSR requires processing to happen on a QR TCB rather than an open TCB. However, a CONCURRENCY(REQUIRED) program always runs on an open TCB; therefore, TCB switching from open TCB to QR TCB and back again will occur for each write operation while the file is in load mode.

If the program uses mass insert, the file will remain in load mode until the series of WRITE MASSINSERT requests has completed. That is why excessive TCB switches are occurring.

It is not recommended to load the file by using a series of WRITE MASSINSERT requests. You should use a single WRITE without mass insert. This allows CICS to close and reopen the file after completing the first WRITE, thereby exiting VSAM load mode.