User storage
User storage is available to all the programs in a transaction, but some effort is required to pass it between programs using LINK or XCTL commands. Its size is not fixed, and it can be obtained (using GETMAIN commands) just when the transaction requires it and returned as soon as it is not needed.
User storage is useful for large storage requirements that are variable in size or are shorter-lived than the transaction.
See Storage control for information about how the USERDATAKEY and CICSDATAKEY options of the GETMAIN commands override the TASKDATAKEY option of the transaction resource definition.
The SHARED option of the GETMAIN commands causes the acquired storage to be retained after the end of the task. The storage can be passed in the communication area from one task to the next at the same terminal. The first task returns the address of the communication area in the COMMAREA option of the RETURN command. The second task accesses the address in the COMMAREA option of the ADDRESS command. You must use the SHARED option of the GETMAIN commands to ensure that your storage is in common storage.
Because of the processor overhead involved in GETMAIN commands, do not use user storage for a small amount of storage. Use the transaction work area (TWA) for the smaller amounts, or group them into a larger request. Although the storage acquired by GETMAIN commands can be held longer when using combined requests, the processor overhead and the reference set size are both reduced.