EasyManuals Logo

IBM TSO/E REXX User Manual

IBM TSO/E REXX
242 pages
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Page #65 background imageLoading...
Page #65 background image
Possible Solution
/******************************** REXX *****************************/
/* This exec requests the user to enter a month as a whole number */
/* from 1 to 12 and responds with the number of days in that */
/* month. */
/*******************************************************************/
SAY 'To find out the number of days in a month,'
SAY 'Enter the month as a number from 1 to 12.'
PULL month
SELECT
WHEN month = 9 THEN
days = 30
WHEN month = 4 THEN
days = 30
WHEN month = 6 THEN
days = 30
WHEN month = 11 THEN
days = 30
WHEN month = 2 THEN
days = '28 or 29'
OTHERWISE
days = 31
END
SAY 'There are' days 'days in Month' month '.'
Using Looping Instructions
There are two types of looping instructions, repetitive loops and conditional
loops. Repetitive loops allow you to repeat instructions a certain number of times,
and conditional loops use a condition to control repeating. All loops, regardless of
the type, begin with the DO keyword and end with the END keyword.
Repetitive Loops
The simplest loop tells the language processor to repeat a group of instructions a
specific number of times using a constant following the keyword DO.
DO 5
SAY 'Hello!'
END
When you run this example, you see five lines of Hello!.
Hello!
Hello!
Hello!
Hello!
Hello!
You can also use a variable in place of a constant as in the following example,
which gives you the same results.
number = 5
DO number
SAY 'Hello!'
END
Using Conditional Instructions
Chapter 4. Controlling the Flow Within an Exec 47

Table of Contents

Questions and Answers:

Question and Answer IconNeed help?

Do you have a question about the IBM TSO/E REXX and is the answer not in the manual?

IBM TSO/E REXX Specifications

General IconGeneral
BrandIBM
ModelTSO/E REXX
CategoryComputer Hardware
LanguageEnglish

Related product manuals