Variable values, Exercises - identifying valid variable names – IBM SC34-5764-01 User Manual

Page 42

Advertising
background image

v

The first character cannot be 0 through 9 or a period (.)

v

The variable name cannot exceed 250 bytes. For names containing DBCS characters, count each
DBCS character as 2 bytes, and count the shift-out (SO) and shift-in (SI) as 1 byte each.

v

SO (X'0E') and SI (X'0F') must delimit DBCS characters within a DBCS name. Also note that:
– SO and SI cannot be contiguous.
– Nesting of SO / SI is not permitted.
– A DBCS name cannot contain a DBCS blank (X'4040').

v

The variable name should not be RC, SIGL, or RESULT, which are REXX special variables. More about
special variables appears later in this book.

Examples of acceptable variable names are:

ANSWER

?98B

A

Word3

number

the_ultimate_value

Also, if OPTIONS ETMODE is the first instruction in your program, the following are valid DBCS variable
names, where < represents shift-out, > represents shift-in, X, Y, and Z represent DBCS characters, and
lowercase letters and numbers represent themselves.

<.X.Y.Z>

number_<.X.Y.Z>

<.X.Y>1234<.Z>

Variable Values

The value of the variable, which is the value the variable name represents, might be categorized as
follows:

v

A constant, which is a number that is expressed as:

An integer (12)
A decimal (12.5)
A floating point number (1.25E2)
A signed number (-12)
A string constant (' 12')

v

A string, which is one or more words that may or may not be within quotation marks, such as:

This value can be a string.
'This value is a literal string.'

v

The value from another variable, such as:

variable1 = variable2

In the preceding example, variable1 changes to the value of variable2, but variable2 remains the same.

v

An expression, which is something that needs to be calculated, such as:

variable2 = 12 + 12 - .6

/* variable2 becomes 23.4 */

Before a variable is assigned a value, its value is the value of its own name translated to uppercase. For
example, if the variable new has not been assigned a value, then

SAY new

produces

NEW

Exercises - Identifying Valid Variable Names

Which of the following are valid REXX variable names?

1. 8eight

2. £25.00

3. MixedCase

4. nine_to_five

5. result

Using Variables and Expressions

20

CICS TS for VSE/ESA: REXX Guide

Advertising