You are on page 1of 3

Normally, temporary storage control maintains TSQ’s in single VSAM ESDS called temporary storage file or DFHTEMP.

For pseudo conversational programs, that’s an efficient way to store data between program executions. The one big advantage the TSQ’s have over communication area is that it makes better use of the systems resources by not tying up the main memory for long periods of time. One can also store the TSQ’s on disks as Temporary Storage Control allows that but that means overheads in storing and retrieving the data in a single task execution. But if we specify main storage over disk, the processing is faster at the cost of critical main memory in the CICS system. 1. Write to a TSQ (creates the Q if not present already) EXEC CICS WRITEQ TS QUEUE(TS-QUEUE-NAME) FROM(TS-QUEUE-RECORD) LENGTH(TS-QUEUE-LENGTH) [ MAIN ] [ AUXIALLIARY ] END-EXEC. TS-QUEUE-LENGTH : PIC S9(4) COMP FIELD (Half-Word binary). TS-QUEUE-NAME : 1 TO 8 CHARACTER name that should be unique to avoid using other TSQ’s. MAIN/AUXIALLIARY : Specifies that TSQ shall reside on main/disk storage. OPTIONAL FIELDS. 2. Update an existing record. EXEC CICS WRITEQ TS QUEUE(TS-QUEUE-NAME) FROM(TS-QUEUE-RECORD) LENGTH(TS-QUEUE-LENGTH) ITEM(TS-ITEM-NUMBER) REWRITE RESP(RESPONSE-CODE) END-EXEC. Within a TSQ, each record is assigned an ITEM-NUMBER just like an array-index. The item #s start from 1,2,…..To rewrite a record in the TSQ you need to specify the item number of the record to be updated. Since most TSQ’s have one record only that is updated, its never a problem. In case a TSQ name is not found it raises a QIDERR. In case it doesn’t find the item-number, then an ITEMERR is raised. 3. To read from a TSQ : EXEC CICS READQ TS QUEUE(TS-QUEUE-NAME) INTO(TS-QUEUE-RECORD) LENGTH(TS-QUEUE-LENGTH) ITEM(TS-ITEM-NUMBER) RESP(RESPONSE-CODE) [ NEXT ] END-EXEC. NEXT : Specifies that the next record in the sequence following the most recently read record should be read. OPTIONAL parameter. Its always a good practice to use the item #. In case of a readq also, the possible exceptions are QIDERR and ITEMERR. The response code can be used to handle an abnormal termination as in any CICS program.

4. Deleting a TSQ : EXEC CICS DELETEQ TS QUEUE(TS-QUEUE-NAME) END-EXEC. this command needs to be issued explicitly after the completion of processing to delete the TSQ. If we do not, then the TSQ remains indefinitely wasting storage space. The command deletes the entire TSQ and not just the record. That shouldn’t be problem either coz most of the times the TSQ is going to have a single entry. All the variables used will be defined in the working storage before you can use these lines of code in your program. Something like…… WORKING-STORAGE DIVISION. 01 TSQ-AREA. 05 TS-QUEUE-RECORD 05 TS-QUEUE-NAME 05 TS-QUEUE-LENGTH 05 TS-ITEM-NUMBER ………………………………. PROCEDURE DIVISION. ……………… PIC X(100). PIC X(8). PIC S9(4) COMP. PIC 9(02).

2000-PROCESS SECTION. …………….. MOVE “NIL001” TO TS-QUEUE-NAME. MOVE WS-Q-RECORD TO TS-QUEUE-RECORD. MOVE 100 TO TS-QUEUE-LENGTH. ………………….. EXEC CICS WRITEQ TS QUEUE(TS-QUEUE-NAME FROM(TS-QUEUE-RECORD) LENGTH(TS-QUEUE-LENGTH) END-EXEC. …………………………… CECI Description: CECI = Command-Level Interpreter Enables CICS commands to be entered, syntax-checked, and executed interactively at a 3270 screen. The interpreter performs a dual role in the operation of a CICS system. For the application programmer, it provides a reference to the syntax of the complete CICS command-level application programming interface. Most of the commands can be carried through to execution, and the results of execution can be displayed. For the system administrator, it provides a means of interaction with the system. The command-level interpreter can be invoked by two CICS-supplied transactions, CECI and CECS. CECI invokes the command level interpreter to enter an EXEC CICS command, checks its syntax, and you modify it as necessary. In most cases, you

can also process the command. CECS invokes the syntax, and you modify it as necessary. In most cases, you can also process the command. CECS invokes the command-level interpreter to check the syntax of an EXEC CICS command but not to process it.