Returns an optional exit code set by the application, when the AVM process ends.
Data type: INTEGER
Access: Readable/Writeable
Applies to: SESSION system handle
The attribute allows the application to optionally set a program exit code. This provides meaningful feedback to the shell script and allows the creation of automation scripting around the termination of the ABL application.
This attribute is set to the Unknown value (?) if not set by the application.
Windows allows positive integer values (0-32767). UNIX restricts this to the range of 0 through 255 (inclusive). If you attempt to set an improper value for your platform, a runtime error is raised.
If an AVM process running as an AppServer or WebSpeed agent sets an EXIT-CODE value, a runtime error is raised.
The exit code specified by SESSION:EXIT-CODE can be printed from a bash shell as shown in the following example:
$PROEXE -p MyTest.p -b
echo $?
In Windows, the exit code can be printed from the command line as shown below:
In Windows PowerShell the pseudo-environment variable is called by $LastExitCode instead of %errorlevel%.
Other shells in Windows may restrict the exit code to a smaller range than 0-32767. For example, Cygwin limits the value to the same range as Unix (0-255) and returns only the lower 8 bits of the value. For example, if the application sets the exit code to 300, the exit code displayed from a Windows command prompt (cmd.exe) is 300, while in Cygwin it is 44 (the lower 8 bits):
Integer value
Binary value
300
00000000 00000000 00000001 00101100
44
00000000 00000000 00000000 00101100
It is important to keep this in mind when choosing exit code values.