Statement: Terminates program execution before the end of the program unit.
If stop-code is specified, the STOP statement does the following:
Writes the specified message to the standard error device.
Writes one or more of the following messages to the standard error device indicating which IEEE floating-point exceptions are signaling:
IEEE_DIVIDE_BY_ZERO is signaling
IEEE_INVALID is signaling
IEEE_OVERFLOW is signaling
IEEE_UNDERFLOW is signaling
Terminates program execution. If stop-code is a character constant, a status of zero is returned. If stop-code is an integer, a status equal to stop-code is returned.
If stop-code is not specified, the program is terminated, no message is printed, and a status of zero is returned.
In QuickWin programs, the following is displayed in a message box:
Program terminated with Exit Code stop-code
Effect on Linux* and Mac OS* Systems
Operating system shells (such as bash, sh, csh, etc.) work with one byte exit status. So, when stop-code is an integer, only the lowest byte is significant. For example, consider the following statement:
STOP 99999
In this case, the program returns a status equal to 159 because integer 99999 = Z'1869F', and the lowest byte is equal to Z'9F', which equals 159.