Set the Clipper return code

     ERRORLEVEL([<nNewReturnCode>]) --> nCurrentReturnCode


     <nNewReturnCode> is the new return code setting.  This can be a
     value between zero and 255.  The default value at startup is zero.  If
     not specified, ERRORLEVEL() reports the current setting without
     assigning a new value.


     ERRORLEVEL() returns the current Clipper exit code as a numeric
     value, if one has been set using ERRORLEVEL() with an argument;
     otherwise, it returns zero.


     ERRORLEVEL() is a dual purpose environment function.  It returns the
     current Clipper return code and optionally sets a new return code.
     The return code is a value set by a child process so the parent process
     can test the termination state of the child process.  Typically, the
     parent process is DOS and the child process is an application program.
     Retrieve a return code with the DOS ERRORLEVEL command or INT 21
     Function 4Dh.

     When a Clipper program terminates, the return code is set to 1 if the
     process ends with a fatal error.  If the process ends normally, the
     return code is set to zero, or the last ERRORLEVEL() set in the program.

     Typically, you would set a return code with ERRORLEVEL() to indicate an
     error state to the program that invoked the current Clipper program.
     In most cases this is the application batch file.  Here you would test
     the return code using the DOS ERRORLEVEL command.  Refer to your DOS
     manual for more information.


     .  ERRORLEVEL() is not updated after a RUN command terminates.
        To obtain the return code of the invoked program, you must create an
        assembler or C routine that queries the child process return code
        using INT 21 Function 4Dh.  Refer to your DOS documentation for more


     .  This example saves the current Clipper return code, then
        sets a new value:

        nOldCode := ERRORLEVEL()      // Get current error level
        ERRORLEVEL(1)                 // Set new error level

     .  This example uses ERRORLEVEL() to set a return code that can
        be tested by the parent process:

        #define ERR_FILE_MISSING      255
        #define ERR_POST_INCOMPLETE   254
        IF !FILE("Sysfile.dbf")
           @ 0, 0
           @ 1, 0
           @ 0, 0 SAY "Fatal error: System ;
                       file is missing...quitting"

 Files   Library is CLIPPER.LIB.

See Also: QUIT

One response to “C5_ERRORLEVEL

  1. Pingback: C5_QUIT | Viva Clipper !

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.