About this task
The PULL instruction is one way for
a program to receive input. Repeating
an earlier example shows this. Here is how to call the ADDTWO program:
REXX addtwo
Here
is the ADDTWO program.
Figure 1. Example of a program That
Uses PULL/**************************** REXX ******************************/
/* This program adds two numbers and produces their sum. */
/****************************************************************/
PULL number1
PULL number2
sum = number1 + number2
SAY 'The sum of the two numbers is' sum'.'
The PULL instruction can extract more than one value at a time
from the terminal by separating a line of input. The following variation
of the example shows this.
REXX addtwo 42 21
Figure 2. Variation of
an Example that Uses PULL/**************************** REXX ******************************/
/* This program adds two numbers and says their sum */
/****************************************************************/
PULL number1 number2
sum = number1 + number2
SAY 'The sum of the two numbers is' sum'.'
The PULL instruction extracts the numbers
42 and
21 from the terminal.