DP4 programs have a common standard for exit codes across operating systems. All programs use these exit codes unless otherwise noted. In operating systems which support batch files and testing of error levels these can be tested in the normal way. [Note that under Windows 95 an MS-DOS batch file cannot test the error level of a Windows program as the program is run aynchronously. To run a Windows program synchronously from an MS-DOS batch file under Windows 95 specify start /w before the name of the program. Under Windows NT programs are only run asynchronously if start is specified explicitly]
It should be noted that trm_run_program() does NOT return exit code information. Nor is it available in QAB.
| Exit Code | Meaning |
|---|---|
| 0 | Normal completion
The program ran to completion successfully. For example in MAPPOST,QABUTIL and COPYDB it would mean that no fatal errors occured when posting the file. In DBBACKUP,DBRESTOR,DBCHECK it would mean the database was successfully backed up/restored/checked. |
| 1 | Abnormal completion
The program encountered a program specific error during processing, or the user aborted it by escaping when asked for a database name. For example in MAPPOST,QABUTIL and COPYDB it would mean that an error occured when posting a file to the database. In DBBACKUP,DBRESTOR,DBCHECK it would mean the database was not successfully backed up/restored/checked. |
| 2 | User termination
The user terminated the program by pressing Ctrl+S,Ctrl+C or Alt+F4, or by pressing Esc when prompted to load a log disk, or when warned that the program could not update the database. |
| 3 | System error
The program terminated when a call to sys_error() was generated. |
| 4 | Fail error
The program terminated when a call to sys_fail() was generated. |
| 5 | DP4 Interface error
The program could not communicate with or could not load the database manager or terminal manager. |
| 7 | Special Exit Code
|
| All other values | Unused
No other return codes are used by standard DP4 utilities. A user written program can terminate with any exit code by calling dp4_halt(n). |
When DBRECOV is run it writes a message to SYSLOG.PRN specifiying a return code.
This return code is NOT the program exit code. It is 00 if DBRECOV ran succesfully. Otherwise it is the number of the message which DBRECOV displayed (or would display if -silent was not specified). In particular retcode 03 means DBRECOV was run against a database which did not require DBRECOV. retcode 05 means the rollback log was missing.
You can check the meaning of the return code by using MAPEDIT/MAPMAKE to examine the DBRECOV map set on the system database.
DBCHECK behaves in a similar manner and the return code in SYSLOG.PRN represents a map number from the DBCHECK mapset on the system database.