Running Maintenance Programs From Batch Files

You may choose to run some DP4 maintenance programs from batch files. It is useful to know, therefore, that when DP4 programs such as DBCHECK, DBBACKUP and REORGDB terminate, they return an exit code to the operating system. This exit code is a number between 0 and 5 that indicates the completion status. An error code of zero indicates that the DP4 utility completed successfully. Any other value indicates an abnormal termination. The meanings of the return codes are given in the following table:

Return Code Meaning
0

The utility completed successfully

1 The utility terminated abnormally
2 The user interrupted and terminated the utility abnormally (e.g. with Alt+F4 on Windows)
3

The utility terminated with a DP4 system error

4

The utility terminated with a DP4 fail error

5

Serious configuration problem

These values can be tested in batch/script files, for example in DOS/Windows/OS/2 by using the IF batch command with the ERRORLEVEL parameter. This allows batch file processing to be altered based on the exit code returned from the DP4 utility.