Keyword; Assignment - IBM TSO/E REXX User Manual

Table of Contents

Advertisement

EDIT ---- USERID.REXX.EXEC(TIMEGAME)------------------- COLUMNS 009 080
COMMAND ===>
****** ************************ TOP OF DATA ************************************
000001 /************************** REXX ****************************/
000002 /* This is an interactive REXX exec that asks a user for the*/
000003 /* time and then displays the time from the TIME command.
000004 /************************************************************/
000005 Game1:
000006
000007 SAY 'What time is it?'
000008 PULL usertime
000009
000010
000011 IF usertime = '' THEN
000012
SAY "O.K. Game's over."
000013 ELSE
000014
DO
000015
SAY "The computer says:"
000016
/* TSO system */ TIME
000017
END
000018
000019 EXIT
****** *********************** BOTTOM OF DATA **********************************

Keyword

A keyword instruction tells the language processor to do something. It begins with a
REXX keyword that identifies what the language processor is to do. For example,
SAY (line 7) displays a string on the screen and PULL (line 8) takes one or more
words of input and puts them into the variable usertime.
IF, THEN (line 11) and ELSE (line 13) are three keywords that work together in one
instruction. Each keyword forms a clause, which is a subset of an instruction. If the
expression that follows the IF keyword is true, the instruction that follows the THEN
keyword is processed. Otherwise, the instruction that follows the ELSE keyword is
processed. If more than one instruction follows a THEN or an ELSE, the
instructions are preceded by a DO (line 14) and followed by an END (line 17). More
information about the IF/THEN/ELSE instruction appears in "Using Conditional
Instructions" on page 42.
The EXIT keyword (line 19) tells the language processor to end the exec. Using
EXIT in the preceding example is a convention, not a necessity, because
processing ends automatically when there are no more instructions in the exec.
More about EXIT appears in "EXIT Instruction" on page 57.

Assignment

An assignment gives a value to a variable or changes the current value of a
variable. A simple assignment instruction is:
number = 4
In addition to giving a variable a straightforward value, an assignment instruction
can also give a variable the result of an expression. An expression is something
that needs to be calculated, such as an arithmetic expression. The expression can
contain numbers, variables, or both.
number = 4 + 4
number = number + 4
Syntax of REXX Instructions
SCROLL ===> HALF
/* Put the user's response
into a variable called
"usertime" */
/* User didn't enter a time */
/* command */
Chapter 2. Writing and Running a REXX Exec
*/
13

Hide quick links:

Advertisement

Table of Contents
loading

Table of Contents