# 5 Control Statements

Statements normally execute in the order in which they are written. However, you can alter the normal order of execution by transferring control to another section of a program unit or a subprogram. Transfer of control can be conditional or unconditional. Conditional transfer occurs only when specified conditions are met at a certain point in a program unit. Unconditional transfer occurs each time a certain point is reached in a program unit.

A control statement (or construct) transfers control to a point within the same program unit or to another program unit. Such a statement governs iterative processing, suspension of program execution, and program termination.

On Alpha processors, a control construct (CASE, DO, and IF) can be given a symbolic name. The name must be a unique identifier in the program unit, and must appear on the initial line and terminal line of the construct. On the initial line, the name is separated from the statement keyword by a colon (:), for example, [name:]SELECT CASE.

The following are control statements or constructs:

- CALL (see Section 5.1)

  Invokes a subroutine subprogram.

- CASE (Alpha only) (see Section 5.2)

  Executes one block of constructs or statements.

- CONTINUE (see Section 5.3)

  Transfers control to the next executable statement.

- DO and DO WHILE (see Section 5.4)

  Execute a block of statements repetitively. Also discussed in this section are the EXIT and CYCLE statements, which can modify execution of a DO loop on Alpha processors.

- END (see Section 5.5)

  Marks the end of a program unit.

- GOTO (see Section 5.6)

  Transfers control within a program unit.

- IF (see Section 5.7)

  Conditionally transfers control, or executes a statement or block of statements.

- PAUSE (see Section 5.8)

  Temporarily suspends program execution.

- RETURN (see Section 5.9)

  Returns control from a subprogram to the calling program unit.

- STOP (see Section 5.10)

  Terminates program execution.

Previous Page Next Page Table of Contents