Question & Answer
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).
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.
For more information, see Loading empty VSAM data sets in the CICS TS documentation.
Posted on behalf of Erik Cao & John Tilling
IBM CICS Information Development & Strategy
CICS/TS CICSTS CICS TS CICS Transaction Server
09 January 2018