There are different scratch pads which are available in CICS for saving data or to transfer the data between transactions. There are five storage areas which are provided by CICS, which we will be discussing in this module.
The COMMAREA behaves like a scratch pad that can be used to pass data from one program to another program, either within the same transaction or from different transactions. It should be defined in the LINKAGE SECTION using DFHCOMMAREA name.
Any transaction in the CICS region can access Common Work Area and hence the format and use of it must be agreed upon by all transactions in the system that decides to use it. There is only one CWA in the entire CICS region.
Transaction Work Area is used to pass data between the application programs that are executed with in the same transaction. TWA exists only for the duration of transaction. Its size is defined in the Program Control Table.
Temporary Storage Queue (TSQ) is a feature that is provided by the Temporary Storage Control Program (TSP).
A TSQ is a queue of records that can be created, read and deleted by different tasks or programs in the same CICS region.
A queue identifier is used to identify TSQ.
A record within a TSQ is identified by the relative position known as the item number.
The records in TSQ, remains accessible until the entire TSQ is explicitly deleted.
The records in TSQ can be read sequentially or directly.
TSQs may be written in the main storage or the auxiliary storage in the DASD.
This command is used to add items to an existing TSQ. Also, we can create a new TSQ using this command. Following is the syntax of WRITEQ TS command −
EXEC CICS WRITEQ TS QUEUE ('queue-name') FROM (queue-record) [LENGTH (queue-record-length)] [ITEM (item-number)] [REWRITE] [MAIN /AUXILIARY] END-EXEC.
Following are the details of parameters used in the WRITEQ TS command −
The QUEUE is identified by the name which is mentioned in this parameter.
FROM and LENGTH options are used to specify the record that is to be written to the queue and its length.
If the ITEM option is specified, CICS assigns an item number to the record in the queue, and sets the data area supplied in that option to the item number. If the record starts a new queue, the item number assigned is 1 and subsequent item numbers follow on sequentially.
The REWRITE option is used to update a record already present in the queue.
MAIN / AUXILIARY option is used to store records in main or auxiliary storage. Default is AUXILIARY.
This command is used read the Temporary Storage Queue. Following is the syntax of READQ TS −
EXEC CICS READQ TS QUEUE ('queue-name') INTO (queue-record) [LENGTH (queue-record-length)] [ITEM (item-number)] [NEXT] END-EXEC.
This command is used delete the Temporary Storage Queue. Following is the syntax of DELETEQ TS −
EXEC CICS DELETEQ TS QUEUE ('queue-name') END-EXEC.
Transient Data Queue is transient in nature as it can be created and deleted quickly. It allows only sequential access.
The contents of the queue can be read only once as it gets destroyed once a read is performed and hence the name Transient.
It cannot be updated.
It requires an entry in DCT.
This command is used to write Transient data queues and they are always written to a file. Following is the syntax of WRITEQ TD command −
EXEC CICS WRITEQ TD QUEUE ('queue-name') FROM (queue-record) [LENGTH (queue-record-length)] END-EXEC.
This command is used read the Transient data queue. Following is the syntax of READQ TD −
EXEC CICS READQ TD QUEUE ('queue-name') INTO (queue-record) [LENGTH (queue-record-length)] END-EXEC.
This command is used delete the Transient data queue. Following is the syntax of DELETEQ TD −
EXEC CICS DELETEQ TD QUEUE ('queue-name') END-EXEC.