WHILE

Use the WHILE statement to test a condition and execute statements within the body of the WHILE loop as long as the condition is true.

Refer to IF for condition syntax.

Syntax


This picture shows the syntax of the WHILE statement.

Example

WHILE I > 0  DO
 I = I - I;
  SEND_KEY ( ENTER );
ENDWHILE

Procedure

To use the 3270 Script window’s Statements menu to define a WHILE statement, follow this procedure:

  1. From the Welcome window, click on Applications —> 3270 Servers
  2. Selecting the WHILE statement : Click Statements —> Conditional.

    The system displays the Conditional Definition window.

  3. Click the button next to WHILE condition DO.
  4. Defining the condition : To define the condition, follow Steps 4 through 10 in the procedure for IF.
  5. Adding the statement to the script : Click OK.

    The WHILE statement is added to the script.

  6. Defining DO statements : Use the Statements menu to define the statement that you want to execute when the WHILE condition is true. Refer to the statement description for instructions.

    The statement is added to the script following the DO keyword.

  7. Repeat Step 6 for each action to be performed when the WHILE condition is true.