This document covers the following topics:
To explicitly mark the end of a statement, you can place a semicolon (;) between the statement and the next statement. This can be used to make the program structure clearer, but is not required.
The END
statement is used to mark
the end of a Natural program, function, subprogram,
external subroutine or helproutine.
Every one of these objects must contain an END
statement as the last
statement.
Every object may contain only one END
statement.
The STOP
statement is used to
terminate the execution of a Natural application. A STOP
statement executed
anywhere within an application immediately stops the execution of the entire
application.
The TERMINATE
statement
stops the execution of the Natural application and also ends the Natural session.
During the development of a Natural application and in test situations, the user should
be able to interrupt a running Natural application that does not respond anymore, for
example, due to an endless loop. As the Natural session should not need to be killed,
the running Natural application can be interrupted via the typical system interrupt key
combination (for example, CTRL+BREAK for Windows or CTRL+C for
Linux). The Natural error NAT1016 is raised and the runtime error processing is
activated. The error can be handled by an ON
ERROR
processing.
In a production environment, this feature will typically need to be disabled, because the application may not be able to recover from a user interrupt at an arbitrary program location.
The Natural profile parameter RTINT
determines whether interrupts are allowed.
By default, interrupts are not allowed.
If this parameter is set to ON
, a running Natural application may be
interrupted with the interrupt key combination of the operating system (for example, for
Windows: CTRL+BREAK; for Linux: typically CTRL+C, but can be
reconfigured using the stty
command).
Natural catches this interrupt request and then offers the user the following possibilities:
Perform standard error processing by raising a NAT1016 error.
Continue application processing (cancel interrupt).
The choice is shown in a window that is opened after catching the interrupt signal.