To cause the language processor to read input exactly as it is presented, use the
PARSE PULL instruction.
PARSE PULL animal
Then if you responded to the example with TyRannOsauRus, you would see on
the screen:
Exercises - Running and Modifying the Example Execs
Write and run the preceding Example of Reading and Re-displaying Input. Try
various input and observe the output. Now change the PULL instruction to a PARSE
PULL instruction and observe the difference.
Passing Information to an Exec
When an exec runs, you can pass information to it in several ways, two of which
are:
v Through terminal interaction
v By specifying input when invoking the exec.
Using Terminal Interaction
The PULL instruction is one way for an exec to receive input as shown by a
previous example repeated here.
The PULL instruction can extract more than one value at a time from the terminal
by separating a line of input, as shown in the following variation of the previous
example.
TYRANNOSAURUS
TyRannOsauRus
Example of an Exec that Uses PULL
/**************************** REXX *********************************/
/* This exec adds two numbers and displays their sum.
/*******************************************************************/
SAY 'Please enter a number.'
PULL number1
SAY 'Now enter a number to add to the first number.'
PULL number2
sum = number1 + number2
SAY 'The sum of the two numbers is' sum'.'
Variation of an Example that Uses PULL
/**************************** REXX *********************************/
/* This exec adds two numbers and displays their sum.
/*******************************************************************/
SAY 'Please enter two numbers.'
PULL number1 number2
sum = number1 + number2
SAY 'The sum of the two numbers is' sum'.'
Preventing Translation to Uppercase
Chapter 2. Writing and Running a REXX Exec
*/
*/
21