2012年1月29日 星期日

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=*
//*

2012年1月21日 星期六

REXX DO Loop

Processing can be controlled in a DO loop in a number of ways:
ITERATE :Stops processing in a loop and returns to the start of the loop and
continues with the next item in the loop.
LEAVE :Stops processing the DO loop, and continues processing with the
next instruction after the loop.
LEAVE label :Stops processing a DO loop inside another DO loop returning
processing to DO loop with 'label' as the counter
                                                                             
E.g DO O = 1 to 10
DO n = 1 to 10
DO m = 1 to 10
if m = 2 then ITERATE /* go back to m */
if m = 5 then LEAVE /* go back to n */
if m = 7 then LEAVE O /* go back to O */
end
end
end

Chinese New Year



I would like to wish you all a happy Chinese New year!

2012年1月12日 星期四