Loading empty VSAM data sets

You can load data into an empty VSAM data set in two ways.

  • Running the AMS utility program, IDCAMS
  • Writing records to the data set by using CICS transactions

Although VSAM imposes some restrictions during initial data set load processing, when the data set is said to be in load mode, these do not affect CICS transactions. For files opened in non-RLS mode, CICS file control hides load mode processing from your application programs. For files opened in RLS mode against an empty data set, load mode processing is hidden from CICS by VSAM, and all VSAM requests are allowed.

Using IDCAMS to load empty VSAM data sets

If you have a large amount of data to load into a new data set, run the AMS utility program IDCAMS as a batch job, using the REPRO command to copy data from an existing data set to the empty data set.

When you have loaded the data set with IDCAMS, it can be used by CICS in the normal way.

A data set in VSAM load mode cannot have alternate indexes in the upgrade set. If you want to create and load a data set with alternate indexes, you must use AMS, or some other suitable batch program, to load the data set and invoke BLDINDEX to create the alternate indexes.

Using CICS applications to load empty VSAM data sets

If the amount of data to be loaded is small, and if there is no upgrade set, you can load an empty data set by using standard CICS file WRITE requests.

When the first write, or series of writes (mass insert), to the file is completed, CICS closes the file and leaves it closed and enabled, so that it will be reopened for normal processing when next referenced. If you attempt to read from a file in load mode, CICS returns a NOTFOUND condition.

Considerations for using a concurrency(required) program to load empty VSAM data sets
When you use a concurrency(required) program to load empty VSAM data sets, be aware that excessive TCB switching from open TCB to QR TCB and back again will occur if the program uses a series of WRITE MASSINSERT requests.
Why TCB switching occurs
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.

A program that is defined as CONCURRENCY(REQUIRED) always runs on an open TCB. If the file is to be loaded from a concurrency(required) program, TCB switching from open TCB to QR TCB and back again will occur for each write operation while the file is in load mode.

How to avoid TCB switching
It is not recommended to load the file by using a series of WRITE MASSINSERT requests, because the file will remain in load mode until the series of WRITE MASSINSERT requests has completed. You should use a single WRITE without mass insert.

A single WRITE without mass insert, when completed, will cause CICS to close and reopen the file, thereby exiting VSAM load mode. If the file is normally accessed in LSR mode, when the file is out of load mode, CICS will resume accessing the file in LSR mode, and TCB switching will be avoided for further write operations to the file.