IBM SC34-5764-01 Server User Manual


 
Quotation marks ensure that information in a program is processed exactly as typed. This is important in
the following situations:
v For output that must be lowercase or a mixture of uppercase and lowercase.
v To ensure that commands are processed correctly. For example, if a variable name in a program is the
same as a command name, the program can end in error when the command is issued. It is a good
programming practice to avoid using variable names that are the same as commands and to enclose all
commands in quotation marks.
Characters Input to a program
When reading input or passing input from another program, the language processor also changes
alphabetic characters to uppercase before processing them. To prevent translation to uppercase, use the
PARSE instruction.
For example, the following program reads input from the terminal and sends this information to the
terminal output device.
If the input is tyrannosaurus, the language processor produces the output:
TYRANNOSAURUS
To cause the language processor to read input exactly as it is presented, use the PARSE PULL instruction
instead of the PULL instruction.
PARSE PULL animal
Now if the input is TyRannOsauRus, the output is:
TyRannOsauRus
Exercises - Running and Modifying the Example Programs
You can write and run the preceding example. Now change the PULL instruction to a PARSE PULL
instruction and note the difference.
Passing Information to a program
When a program runs, you can pass information to it in several ways:
v By using PULL to get information from the program stack or terminal input device.
v By specifying input when calling the program.
Getting Information from the Program Stack or Terminal Input Device
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.
/************************** REXX ***********************************/
/* This REXX program gets the name of an animal from the input */
/* stream and sends it to the terminal. */
/*******************************************************************/
PULL animal /* Get the animal name.*/
SAY animal
Figure 6. Example of Reading Input and Writing Output
Writing and Running a REXX Program
14
CICS TS for VSE/ESA: REXX Guide