Statement: Terminates program execution before the end of the program unit.
Syntax
If you specify stop-code, the effect differs depending on its form, as follows:
Return code stop-code
In QuickWin programs, the following is displayed in a message
box:
Program terminated with Exit Code stop-code
In both cases, the program returns a status of stop-code to the operating system as an integer.
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.
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