Monday, September 26, 2011

Sample code: Call REXX program from COBOL program

IBM supplied routine "IRXJCL" can be used to call a REXX program from a COBOL program.

ID DIVISION.
PROGRAM-ID.  CBLTRX.
ENVIRONMENT DIVISION.
DATA DIVISION.
WORKING-STORAGE SECTION.
01  CALL-IRXJCL          PIC X(6) VALUE "IRXJCL" .
01  CALL-PARM.
    05  PARM-LEN        PIC S9(4) BINARY VALUE 6.
    05  PARM-VALUE      PIC X(6)  VALUE "REXPGM".
*
PROCEDURE DIVISION.
    CALL CALL-IRXJCL USING CALL-PARM.
    DISPLAY "RETURN CODE = " RETURN-CODE.
    STOP RUN.


JCL to execute the module


//STEP0001 EXEC PGM=CBLTRX
//STEPLIB  DD  DISP=SHR,DSN=&SYSUID..COBOL.LOAD
//SYSEXEC  DD  DISP=SHR,DSN=&SYSUID..REXX
//SYSOUT   DD  SYSOUT=*
//*

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.