# 7.8 PAUSE Statement

The PAUSE statement temporarily suspends program execution until the user or system resumes execution. The PAUSE statement is a deleted feature in Fortran 95; it was obsolescent in Fortran 90. Compaq Fortran fully supports features deleted in Fortran 95.

The PAUSE statement takes the following form:

  PAUSE [pause-code]
  pause-code
  Is an optional message. It can be either of the following:
  - A scalar character constant of type default character.
  - A string of up to six digits; leading zeros are ignored. (Fortran 90 and FORTRAN 77 limit digits to five.)

Rules and Behavior

If you specify pause-code, the PAUSE statement displays the specified message and then displays the default prompt.

If you do not specify pause-code, the system displays the following default message:

    FORTRAN PAUSE

The following prompt is then displayed:

- On OpenVMS systems, the system prompt
- On Tru64 UNIX and Linux systems:

      PAUSE prompt>

- On WNT and W9* systems:

      Fortran Pause - Enter command<CR> or <CR> to continue.

Effect on OpenVMS Systems

The effect of PAUSE differs depending on whether the program is an interactive or batch process, as follows:

- If a program is an interactive process, the program is suspended until you enter one of the following commands:
  - CONTINUE resumes execution at the next executable statement.
  - DEBUG resumes execution under control of the OpenVMS Debugger.
  - EXIT terminates execution.

  In general, most other commands also terminate execution.

- If a program is a batch process, the program is not suspended. If you specify a value for pause-code, this value is written to SYS$OUTPUT.

Effect on Tru64 UNIX and Linux Systems

The effect of PAUSE differs depending on whether the program is a foreground or background process, as follows:

- If a program is a foreground process, the program is suspended until you enter the CONTINUE command. Execution then resumes at the next executable statement.

  Any other command terminates execution.

- If a program is a background process, the behavior depends on `stdin`, as follows:
  - If `stdin` is redirected from a file, the system displays the following (after the pause code and prompt):

        To continue from background, execute 'kill -15 n'

    In this message, `n` is the process id of the program.

  - If `stdin` is not redirected from a file, the program becomes a suspended background job, and you must specify `fg` to bring the job into the foreground. You can then enter a command to resume or terminate processing.

Effect on WNT and W9* Systems

The program waits for input on `stdin`. If you enter a blank line, execution resumes at the next executable statement.

Anything else is treated as a DOS command and is executed by a `system( )` call. The program loops, letting you execute multiple DOS commands, until a blank line is entered. Execution then resumes at the next executable statement.

Examples

The following examples show valid PAUSE statements:

    PAUSE 701
    PAUSE 'ERRONEOUS RESULT DETECTED'

For More Information:

- On `stdin`, see your user manual or programmer's guide.
- On obsolescent features in Fortran 95 and Fortran 90, as well as features deleted in Fortran 95, see Appendix A.

Previous Page Next Page Table of Contents