The simplest way to use EXCI from a procedural managed-code COBOL program is the EXEC CICS LINK macro. You can code an EXEC CICS LINK statement in a non-CICS COBOL program, then compile the program with the CICS preprocessor and the EXCI option, and the preprocessor will convert the LINK statement into an EXCI call. The LINK statement is similar to one in a CICS program, except that it also includes the APPLID parameter, which tells EXCI what region to contact. (To see how the APPLID is translated into a request URL for a specific region, see Configuring EXCI for the client.)
To compile a program for EXCI using EXEC CICS LINK, add CICSECM(EXCI=YES) to the compiler directives for the project.
When an EXCI LINK returns, it will populate a group item provided by the caller with any RESP and RESP2 codes and ABEND code from the server or called program, and possibly with an explanatory message. The format of this item is described in the IBM EXCI documentation, and is also shown in the example below.
01 my-data pic x(100) value "something". 01 my-data-len pic 9(8) comp value 100. 01 exci-return. 03 exci-resp pic 9(8) comp. 03 exci-resp2 pic 9(8) comp. 03 exci-abcode pic x(4). 03 exci-msg-len pic 9(8) comp. 03 exci-msg-ptr pointer. ... exec cics link applid("ESDEMO") program("MYPROG") commarea(my-data) length(my-data-len) retcode(exci-return) end-exec