User Tools

Site Tools


runcode_return_program_exit_code_.htm
Navigation:  Language Reference > 13 - Built-in Functions >====== RUNCODE (return program exit code) ====== Previous pageReturn to chapter overviewNext page

RUNCODE( )

blk2blue.jpg

The RUNCODE procedure returns the exit code passed to the operating system from the command executed by the RUN statement. This is the exit code passed by the HALT statement in Clarion programs and is the same as the DOS ERRORLEVEL. RUNCODE returns a LONG integer which may be any value that is returned to DOS as an exit code by the child program.

The child program may only supply a BYTE value as an exit code, therefore negative values are not possible as exit codes. This fact allows RUNCODE to reserve these values to handle situations in which an exit code is not available:

 0 normal termination

-1 program terminated with Ctrl-C

-2 program terminated with Critical error

-3 TSR exit

-4 program did not run (check ERROR())

Return Data Type:     LONG

Example:

RUN('Nextprog.exe')                !Run next program

IF RUNCODE() = -4

IF ERROR() = 'Not Enough Memory'  !If program didn't run for lack of memory

 MESSAGE('Insufficient memory')   !display a message

 RETURN                           !and terminate the procedure

ELSE

 STOP(ERROR())                    !terminate program

END

END

See Also:

RUN

HALT

runcode_return_program_exit_code_.htm.txt · Last modified: 2021/04/15 15:57 by 127.0.0.1