IBM SC34-5764-01 Manual page 66

Cics transaction server for vse/esa
Table of Contents

Advertisement

Control Flow within a Program
/******************************** REXX *******************************/
/* This program uses a DO WHILE loop to keep track of window seats
/* in an 8-seat commuter airline.
/*********************************************************************/
window_seats = 0
passenger = 0
DO WHILE (passenger < 8) & (window_seats \= 4)
/******************************************************************/
/* Continue while the program has not yet read the responses of
/* all 8 passengers and while all the window seats are not taken. */
/******************************************************************/
PULL window
passenger = passenger + 1 /* Increase number of passengers by 1 */
IF window = 'Y' THEN
window_seats = window_seats + 1 /* Increase window seats by 1 */
ELSE NOP
END
SAY window_seats 'window seats were assigned.'
SAY passenger 'passengers were questioned.'
Figure 23. Possible Solution
DO UNTIL Loops
DO UNTIL loops in a flowchart appear as follows:
DO UNTIL
instruction(s)
expression
True
END
As REXX instructions, the flowchart example looks like:
DO UNTIL expression
instruction(s)
END
Use DO UNTIL loops when a condition is not true and you want to execute the loop until the condition is
true. The DO UNTIL loop tests the condition at the end of the loop and repeats only when the condition is
false. Otherwise, the loop executes once and ends. For example:
44
CICS TS for VSE/ESA: REXX Guide
/* Initialize window seats to 0 */
/* Initialize passengers to 0
/* Gets "Y" or "N" from input stream */
False
/* expression must be false */
*/
*/
*/
*/

Hide quick links:

Advertisement

Table of Contents
loading

This manual is also suitable for:

Rexx

Table of Contents