Exposing Variables with PROCEDURE EXPOSE

About this task

To protect all but specific variables, use the EXPOSE option with the PROCEDURE instruction, followed by the variables that are to remain exposed to the subroutine or function.

The next example uses PROCEDURE EXPOSE in a subroutine.
Figure 1. Example Using PROCEDURE EXPOSE in Subroutine
/******************************* REXX ********************************/
/* This program uses a PROCEDURE instruction with the EXPOSE option  */
/* to expose one variable, number1, in its subroutine.  The other    */
/* variable, number2, is set to null and the SAY instruction         */
/* produces this name in uppercase.                                  */
/*********************************************************************/
 number1 = 10
 CALL subroutine
 SAY number1 number2          /* produces 7  NUMBER2 */
 EXIT

 subroutine: PROCEDURE EXPOSE number1
 number1 = 7
 number2 = 5
 RETURN
The next example is the same except PROCEDURE EXPOSE is in a function instead of a subroutine.
Figure 2. Example Using PROCEDURE EXPOSE in a Function
/******************************* REXX ********************************/
/*  This program uses a PROCEDURE instruction with the EXPOSE option */
/*  to expose one variable, number1, in its function.                */
/*********************************************************************/
 number1 = 10
 SAY pass() number1                  /* Produces 5  7 */
 EXIT

 pass: PROCEDURE EXPOSE number1
 number1 = 7
 number2 = 5
 RETURN number2

For more information about the PROCEDURE instruction, see section PROCEDURE.


Task Task

Feedback


Timestamp icon Last updated: Tuesday, 7 January 2014


http://pic.dhe.ibm.com/infocenter/cicsts/v5r1/topic/com.ibm.cics.rexx.doc//dfhrx/dfhrx00054.html