CICS - Control operations
CICS - Control Operations
The CICS Program Control Program (PCP) manages the flow of application programs. All application programs must have an entry in the processing program table. These are the commands that are used for program control services -
Logical levels of the program
Application programs that run under CICS have different logical levels. The first program which receives the command directly is at the highest logic level, that is to say at level 1. The linked program is at the next logical level of the link program. XCTL programs operate at the same level. This will be clear when we go through Link and XCTL, later in this module. The following image shows the logical levels -
The expThe basic explanation of XCTL is as follows -
Command XCTL allows to pass control from one program to another at the same level.
It doesn 't wait for control to return.
This is similar to the GO TO instruction.
An XCTL program can be pseudo-conversational.
The following example shows how to use the XCTL command to pass control to another program -
DIVISION IDENTIFICATION. PROGRAM-ID. PROG1. WORK-STORAGE SECTION. 01 WS-COMMAREA PIC X (100). DIVISION OF PROCEDURE. EXEC CICS XCTL PROGRAM ( 'PROG2 ') COMMAREA (WS-COMMAREA) LENGTH (100) END-EXEC.
This command transfers control to be passed to the 'PROG2 ' program with 100 bytes of data. COMMAREA is an optional parameter and is the name of the zone containing the data to be transmitted or the zone to which the results should be sent.ent be returned.
The link command is used to transfer control to another lower level program. He waits for the check back. A linked program cannot be pseudo-conversational.
The following example shows how to use the Link command to pass control to another program -
IDENTIFICATION DIVISION. PROGRAM-ID. PROG1. WORK-STORAGE SECTION. 01 WS-COMMAREA PIC X (100). DIVISION OF PROCEDURE. EXEC CICS LINK PROGRAM ( 'PROG2 ') COMMAREA (WS-COMMAREA) LENGTH (100) END-EXEC.
The load command is used to load a program or a table. Here is the syntax of the Load -
EXEC CICS LOAD PROGRAM ( 'name ') END-EXEC command.
The Release command is used to release a program or a table. Here is the syntax of the Release -
EXEC CICS RELEASE PROGRAM ( 'name ') END-EXEC.
The return command is used to return control to the next higher logical level. Here is the syntax for the Return -
EXEC CICS RETURN PROGRAM ( 'name ') COMMAREA (data-value) LENGTH (data-value) END-EXEC command.
Interval control operations
Interval control operations are of the following two types -
ASKTIME is used to request the current time and date or timestamp. We then move that value to the working storage variable inside the program. Here is the syntax of the ASKTIME -
EXEC CICS ASKTIME [ABSTIME (WS-TIMESTAMP)] END-EXEC command.
FORMATTIME formats the timestamp to the required format according to the options, which can be YYDDD, YYMMDD or YYDDMM for the date. DATESEP specifies the separator for DATE, just like the TIMESEP variable for TIME. Here is the syntax of the FORMATTIME command -
EXEC CICS FORMATTIME ABSTIME (WS-TIMESTAMP) [YYDDD (WS-DATE)] [YYMMDD (W S-DATE)] [ YYDDMM (WS-DATE)] [DATESEP (WS-DATE-SEP)] [TIME (WS-TIME)] [TIMESEP (WS-TIME-SEP)] END-EXEC.