DosErrClass receives a non-zero return value from another control-program function as input. It then classifies the return value, tells where in the system the error occurred, and recommends a corrective action.
In the following example, an attempt is made to delete a nonexistent file. The return value is then passed to DosErrClass so that more information about the error can be obtained, including any corrective actions that can be taken.
#define INCL_DOSMISC
#include <os2.h>
#define FILE_DELETE "JUNK.FIL"
ULONG ulError;
ULONG ulClass;
ULONG ulAction;
ULONG ulLocus;
APIRET ulrc;
ulError = DosDelete(FILE_DELETE); /* File name path */
ulrc = DosErrClass(ulError, /* Return value to be analyzed */
&ulClass, /* Error classification */
&ulAction, /* Recommended corrective action */
&ulLocus); /* Where the error occurred */
When called by a family-mode application, this function can return a valid error classification only for errors that have actually occurred. Also, the classifications of a given return value might not be the same for family-mode and OS/2-mode applications.