Calling EGL generated CICS program from Native CICS Program:
To test this scenario, we have created a Native CICS program M010925 and EGL generated CICS program P01925. Here Native CICS program M010925 acts as Main program and RBD Generated program P01925 acts as sub program.
At the same, we are passing a numeric parameter from main program to sub program. Here is sample code snippets of Main and Sub programs.
1.M010925.cbl
In this Native COBOL CICS program, we have defined a numeric variable A-2. This program calls the RBD Generated CICS program through LINK statement and passing numeric data through COMMAREA.
IDENTIFICATION DIVISION.
PROGRAM-ID. M010925.
DATA DIVISION.
WORKING-STORAGE SECTION.
01 A-2 PIC S9(9) COMP-4.
PROCEDURE DIVISION.
MOVE 10 TO A-2.
DISPLAY 'VALUE OF A-2 BEFORE CALLING'A-2.
EXEC CICS LINK PROGRAM('P010925')
COMMAREA(A-2)
END-EXEC
DISPLAY 'VALUE OF A-2 AFTER CALLING:'A-2.
STOP RUN.
2.P010925.egl
In this scenario, We need to create EGL program as sub program and should accept one integer parameter. Here is the sample snippet of EGL sub program which accepts a integer variable.
package pkg1;
program P010925 type BasicProgram(a int) {}
function main()
syslib.writeStdout("Valued that came from native cics program is "+a);
a=15;
end
end
Note: We need to do Add linkage part in Build Descriptor before generating the EGL program as Sub program. Provide the PARMFORM as COMMDATA and PGMTYPE as EGL in newly created Linkage part of the Build Descriptor.

Output :
Run the Native CICS program by attaching it with a transaction id. In the CICS job spool, we can see the integer value assigned to variable A-2 from Main and Sub programs as below: