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 #70 background imageLoading...
Page #70 background image
regardless of whether the user enters "quit", "QUIT", or "Quit", the language
processor translates the input to uppercase before comparing it to "QUIT".
Conditional Loops
There are two types of conditional loops, DO WHILE and DO UNTIL. Both types of
loops are controlled by one or more expressions. However, DO WHILE loops test
the expression before the loop executes the first time and repeat only when the
expression is true. DO UNTIL loops test the expression after the loop executes at
least once and repeat only when the expression is false.
DO WHILE Loops
DO WHILE loops in a flowchart appear as follows:
As REXX instructions, the flowchart example looks like:
DO WHILE expression /* expression must be true */
instruction(s)
END
Use a DO WHILE loop when you want to execute the loop while a condition is true.
DO WHILE tests the condition at the top of the loop. If the condition is initially false,
the loop is never executed.
You can use a DO WHILE loop instead of the DO FOREVER loop in the example
using the LEAVE Instruction on page 50. However, you need to initialize the loop
with a first case so the condition can be tested before you get into the loop. Notice
the first case initialization in the beginning three lines of the following example.
Example Using DO WHILE
/******************************** REXX *****************************/
/* This exec uses a DO WHILE loop to send data sets to the system */
/* printer. */
/*******************************************************************/
SAY 'Enter the name of a data set to print.'
SAY 'If there are no data sets, enter QUIT.'
PULL dataset_name
DO WHILE dataset_name \= 'QUIT'
"PRINTDS DA("dataset_name")"
SAY dataset_name 'printed.'
SAY 'Enter the name of the next data set.'
SAY 'When there are no more data sets, enter QUIT.'
PULL dataset_name
END
SAY 'Good-bye.'
DO WHILE
END
expression
True
False
instruction(s)
Using Looping Instructions
52
z/OS V1R1.0 TSO/E REXX Users Guide

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