CICS - Control Operations


Advertisements


CICS Program Control Program (PCP) manages the flow of application programs. All the application programs must have an entry in the Processing Program Table. Following are the commands which are used for program control services −

  • XCTL
  • Link
  • Load
  • Release
  • Return

Program Logical Levels

The application programs which execute under CICS have various logical levels. The first program which receives the control directly is at highest logical level, i.e., Level 1. The Linked program is at the next logical level from the linking program. The XCTL programs run at the same level. It will be clear when we will go through Link and XCTL, later in this module. The following image shows the logical levels −

CICS Control Operations

XCTL

The fundamental explanation of XCTL is as follows −

  • XCTL command is used to pass the control from one program to another at the same level.

  • It does not expect the control back.

  • It is similar to GO TO statement.

  • An XCTL program can be a pseudo-conversational.

Example

The following example shows how to use XCTL command to pass the control to another program −

IDENTIFICATION DIVISION.                                         
PROGRAM-ID. PROG1.  
WORKING-STORAGE SECTION.
01 WS-COMMAREA    PIC X(100).                                             
PROCEDURE DIVISION.

EXEC CICS XCTL
   PROGRAM ('PROG2')
   COMMAREA (WS-COMMAREA)
   LENGTH (100)
END-EXEC.

This command transfers the control to be passed to program 'PROG2' with 100 bytes of data. COMMAREA is an optional parameter and is the name of the area containing the data to be passed or the area to which results are to be returned.

Link

Link command is used to transfer the control to another program at lower level. It expects the control back. A Linked program cannot be pseudo-conversational.

Example

The following example shows how to use Link command to pass the control to another program −

IDENTIFICATION DIVISION.                                         
PROGRAM-ID. PROG1.  
WORKING-STORAGE SECTION.
01 WS-COMMAREA    PIC X(100).                                             
PROCEDURE DIVISION.

EXEC CICS LINK
   PROGRAM ('PROG2')
   COMMAREA (WS-COMMAREA)
   LENGTH (100)
END-EXEC.

Load

Load command is used to load a program or a table. Following is the syntax of Load command −

EXEC CICS LOAD
   PROGRAM ('name')
END-EXEC.

Release

Release command is used to release a program or a table. Following is the syntax of Release command −

EXEC CICS RELEASE
   PROGRAM ('name')
END-EXEC.

Return

Return command is used to return the control to the next higher logical level. Following is the syntax of Return command −

EXEC CICS RETURN
   PROGRAM ('name')
   COMMAREA (data-value)
   LENGTH (data-value)
END-EXEC.

Interval Control Operations

The interval control operations are of the following two types −

ASKTIME

ASKTIME is used to request for current time and date or timestamp. We then move this value to the working storage variable inside the program. Following is the syntax of ASKTIME command −

EXEC CICS ASKTIME
   [ABSTIME(WS-TIMESTAMP)]
END-EXEC.

FORMATTIME

FORMATTIME formats the timestamp into the required format based on the options, which can be YYDDD, YYMMDD, or YYDDMM for date. DATESEP indicates the separator for the DATE as does the TIMESEP variable for TIME. Following is the syntax of FORMATTIME command −

EXEC CICS FORMATTIME
   ABSTIME(WS-TIMESTAMP)
   [YYDDD(WS-DATE)]
   [YYMMDD(WS-DATE)]
   [YYDDMM(WS-DATE)]
   [DATESEP(WS-DATE-SEP)]
   [TIME(WS-TIME)]
   [TIMESEP(WS-TIME-SEP)]
END-EXEC.


Advertisements
E-Books Store