Testing for Exit Status

The following examples show how you can test for the exit status (exit_status).

Windows Example

This example tests for the exit_status in a Windows .cmd file:

dbutility process datasource

IF %ERRORLEVEL%==2 goto reorg

exit

:reorg

echo DMSII reorganization has occurred

sendmail "message"

where sendmail is a hypothetical user application that sends a notification to you.

UNIX Example

The following example, written for the UNIX Korn shell (ksh), determines whether or not the value of the exit status (that appears after you run the dbutility program) indicates that a DMSII reorganization was detected. If a reorganization was detected, it echoes a message and runs the sendmail program:

dbutility process datasource

if [$? -eq 2]

then

echo "DMSII reorganization has occurred"

sendmail "message"

fi

where sendmail is a hypothetical user application that sends a notification to you.