Specifying Values When Calling a program

About this task

Another way for a program to receive input is through values you specify when you call the program. For example to pass the two numbers 42 and 21 to a program named ADD, you could use the CICS command:
REXX add 42 21
The program ADD uses the ARG instruction to assign the input to variables as shown in the following example.
Figure 1. Example of a program That Uses the ARG Instruction
/**************************** REXX ******************************/
/*  This program receives two numbers as input, adds them, and  */
/*  produces their sum.                                         */
/****************************************************************/
 ARG number1 number2
 sum = number1 + number2
 SAY 'The sum of the two numbers is' sum'.'

ARG assigns the first number 42, to number1, and the second number 21, to number2.

If the number of values is fewer or more than the number of variable names after ARG or PULL, errors can occur, as the following sections describe.


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/valinv.html