STOP

Statement: Terminates program execution before the end of the program unit.

Syntax

STOP [stop-code]

stop-code
(Optional) A message. It can be either of the following:

Effect on Windows Systems

If you specify stop-code, the effect differs depending on its form, as follows:

If you do not specify stop-code, the STOP statement writes the following default message to the standard error device and terminates program execution:

  Stop - Program terminated.

The program returns a status of zero to the operating system.

Effect on OpenVMS Systems

If you specify stop-code, the STOP statement displays the specified message at your terminal, terminates program execution, and returns control to the operating system.

If you do not specify stop-code, no message is displayed.

Effect on Tru64 UNIX and Linux Systems

If you specify stop-code, the STOP statement writes the specified message to the standard error device and terminates program execution. The program returns a status of zero to the operating system.

If you do not specify stop-code, no message is output.

Compatibility

CONSOLE STANDARD GRAPHICS QUICKWIN GRAPHICS WINDOWS DLL LIB

See Also: EXIT

Examples

The following examples show valid STOP statements:

STOP 98
STOP 'END OF RUN'

DO
  READ *, X, Y
  IF (X > Y) STOP 5555
END DO

The following shows another example:

      OPEN(1,FILE='file1.dat', status='OLD', ERR=100)
      . . .
 100  STOP 'ERROR DETECTED!'
      END