How to Prevent Translation to Uppercase

The language processor generally translates alphabetic characters to uppercase before processing them. The alphabetic characters can be within a program, such as words in a REXX instruction, or they can be external to a program and processed as input. You can prevent the translation to uppercase as follows:

Characters within a program

To prevent translation of alphabetic characters in a program to uppercase, simply enclose the characters in single or double quotation marks. The language processor does not change numbers and special characters, regardless of whether they are in quotation marks. Suppose you use a SAY instruction with a phrase containing a mixture of alphabetic characters, numbers, and special characters; the language processor changes only the alphabetic characters.

SAY The bill for lunch comes to £123.51!

results in:

THE BILL FOR LUNCH COMES TO £123.51!

(This example assumes none of the words are the names of variables that have been assigned other values.)

Quotation marks ensure that information in a program is processed exactly as typed. This is important in the following situations:

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.

Figure 6. Example of Reading Input and Writing Output
 /************************** 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

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.