CICS XCTL sample logic way to call remote program

The below is the sample CICS program on how to use ‘XCTL’ to call sub program which is in the same logical level. You can read where XCTL and CALL can be used in CICS.

The key point is in XCTL you cannot expect control is returned


 ID DIVISION.
 PROGRAM-ID. HAS.
 DATA DIVISION.
 WORKING-STORAGE SECTION.
 77 TID PIC X(4).
 77 MSG PIC X(50) VALUE 'IMPORTANT OF LINK PROGRAM'.
 77 A PIC X(35) VALUE 'THIS IS MAIN PROGRAM'.
 77 B PIC X(35) VALUE 'NOW CONTROL MOVE TO SUB'.
PROCEDURE DIVISION.
 EXEC CICS 
 RECEIVE INTO (TID) 
 LENGTH(LENGTH OF TID) 
 END-EXEC.
 
 EXEC CICS 
 SEND FROM(MSG) 
 END-EXEC.
 
 EXEC CICS RECEIVE END-EXEC.
 EXEC CICS SEND FROM(A) ERASE END-EXEC.
 EXEC CICS RECEIVE END-EXEC.
 EXEC CICS SEND FROM(B) END-EXEC.
 EXEC CICS RECEIVE END-EXEC.
 
 EXEC CICS XCTL
 PROGRAM('SUB')
 END-EXEC.
 
 EXEC CICS 
 RETURN 
 END-EXEC.

How to call Remote Sub program

The ‘LINK’ command can be used both the purposes of calling a sub program of lower logical level and sub program located in remote system.

In ‘LINK’ you can expect control is returned.

The sample LINK syntax

LINK

>>-LINK--PROGRAM(name)------------------------------------------>

>--+-------------------------------------------------------------------------+-->
   +-COMMAREA(data-area)--+--------------------+--+------------------------+-+   
   |                      '-LENGTH(data-value)-'  '-DATALENGTH(data-value)-' |   
   '-CHANNEL(name)-----------------------------------------------------------'   

>--+------------------------------------------------------------+-><
   +-INPUTMSG(data-area)--+-------------------------+-----------+   
   |                      '-INPUTMSGLEN(data-value)-'           |   
   '-+-------------------+--+--------------+--+---------------+-'   
     '-SYSID(systemname)-'  '-SYNCONRETURN-'  '-TRANSID(name)-'
Advertisements

Author: Srini

Experienced software developer. Skills in Development, Coding, Testing and Debugging. Good Data analytic skills (Data Warehousing and BI). Also skills in Mainframe.