Intel® Fortran Compiler Classic and Intel® Fortran Compiler Developer Guide and Reference

ID 767251
Date 3/22/2024
Public

A newer version of this document is available. Customers should click here to go to the newest version.

Document Table of Contents

PAUSE

Statement: Temporarily suspends program execution and lets you execute operating system commands during the suspension. The PAUSE statement is a deleted feature in the Fortran Standard. Intel® Fortran fully supports features deleted in the Fortran Standard.

PAUSE [pause-code]

pause-code

(Optional) 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. (Standard Fortran limits digits to five.)

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 Windows* systems:

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

  • On Linux* systems:

    PAUSE prompt>

For alternate methods of pausing while reading from and writing to a device, see READ and WRITE.

Effect on Windows* 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.

Effect on 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 stdinis 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, nis the process id of the program.

    • If stdinis not redirected from a file, the program becomes a suspended background job, and you must specify fgto bring the job into the foreground. You can then enter a command to resume or terminate processing.

Example

The following examples show valid PAUSE statements:

  PAUSE 701
  PAUSE 'ERRONEOUS RESULT DETECTED'

The following shows another example:

  CHARACTER*24 filename
  PAUSE 'Enter DIR to see available files or press RETURN'   &
 &' if you already know filename.'
  READ(*,'(A\)') filename
  OPEN(1, FILE=filename)
  . . .