z/OS TSO/E CLISTs
Previous topic | Next topic | Contents | Contact z/OS | Library | PDF


The DO-UNTIL-END sequence

z/OS TSO/E CLISTs
SA32-0978-00

The DO-UNTIL-END sequence creates a loop that executes at least once and continues until a specified condition is true.

To use the DO-UNTIL-END sequence, code:
DO UNTIL condition
⋮
  (action)
⋮
END

The condition must be either a comparative expression or a variable containing a comparative expression. You can code multiple conditions by joining expressions, variables, or both with logical operators.

The action can be one or more instructions. The CLIST executes the instructions within the sequence once, then tests whether the condition on the UNTIL clause is true. If the condition is false, the CLIST repeats the loop until the condition is true. When the condition is true, the CLIST ends the loop and executes the next instruction after the END statement.

For example, to repeat some instructions until a condition is true, you can code the following:
DO UNTIL &INPUT = YES  /* Perform action until condition is YES
⋮
  (action)
⋮
  WRITE Type YES if you are finished
  READ &INPUT;
END

The DO UNTIL sequence is useful for requesting input from a user. Because the decision is made after the input is received, the loop can continue or end depending on the value of the input.

Go to the previous page Go to the next page




Copyright IBM Corporation 1990, 2014