bdfp1m0l | Programming Concepts and Reference |
Table 6 lists a set of C functions that you can use to test a particular condition when you have called a C function.
Table 6. C Functions for Detecting Errors
Function | Condition |
---|---|
DF_OK | No errors indicated in SW00RTN. |
DF_EMPTY | Test if a subfile is empty. This function is available only after a delete operation that does not use fullfile processing and before the next TPFDF call. |
DF_ER | Any serious error indicated in SW00RTN. |
DF_ERBTR | B+Tree index error. |
DF_ERX | Any serious error indicated in SW00RTN except indexing errors. |
DF_NR | Record not found (any error indicated in SW00RTN requiring remedial action). |
DF_EF | End of file (any error indicated in SW00RTN requiring remedial action). |
DF_ERCNT | Numbers of errors detected during fullfile processing. |
DF_ERLST | Error in list of logical record numbers. |
DF_ERDSP | Error with the dfdsp function. |
DF_SERRC | System error issued by the TPFDF product. |
DF_TEST | Test specified bits in SW00RTN. |
The following describes the format, parameters, and normal return for these functions. In addition, there is an example of how you can use these functions.
int DF_OK(dft_fil *file);
int DF_EMPTY(dft_fil *file);
int DF_ER(dft_fil *file);
int DF_ERBTR(dft_fil *file);
int DF_ERX(dft_fil *file);
int DF_NR(dft_fil *file);
int DF_EF(dft_fil *file);
int DF_ERCNT(dft_fil *file);
int DF_ERLST(dft_fil *file);
int DF_ERDSP(dft_fil *file);
int DF_SERRC(dft_fil *file);
int DF_TEST(dft_fil *file, char cond);
cond Parameter Values .-|-------------. V | |----+-DFC_IOERR-+-+--------------------------------------------| +-DFC_RCDNF-+ +-DFC_FACE--+ +-DFC_ALG---+ +-DFC_BLOCK-+ +-DFC_EOF---+ +-DFC_SEQ---+ '-DFC_SM----' |
Table 7. Values for the cond Parameter
Value | SW00RTN Bit Tested | Condition |
---|---|---|
DFC_IOERR | Bit 0 | I/O or B+Tree index error. |
DFC_RCDNF | Bit 1 | One of the following:
|
DFC_FACE | Bit 2 | File address compute program (FACE) error. |
DFC_ALG | Bit 3 | One of the following:
|
DFC_BLOCK | Bit 4 | Data in block is corrupt. |
DFC_EOF | Bit 5 | End of file occurred during fullfile processing. |
DFC_SEQ | Bit 6 | Sequence error using dfrst function. |
DFC_SM | Bit 7 | Sort or merge error. |
Function DF_ERCNT returns the count of errors detected during
fullfile processing. All other functions return a nonzero value if the
tested condition is true; otherwise, the return is zero. Table 8 lists the conditions tested for each function.
Table 8. Normal Return Values for Error Detection C Functions
Function | Tested Condition |
---|---|
DF_OK | All SW00RTN bits are zero. |
DF_ER | One of the following SW00RTN bits is set to 1:
|
DF_ERBTR | Both SW00RTN #BIT0 and SW00RT2 #BIT4 are set to 1. |
DF_ERX | One of the following SW00RTN bits is set to 1:
|
DF_NR | One of the following SW00RTN bits is set to 1:
|
DF_EF | One of the following SW00RTN bits is set to 1:
|
DF_ERLST | Both SW00RTN #BIT1 and SW00RT2 #BIT0 are set to 1. |
DF_ERDSP | Both SW00RTN #BIT0 and SW00RT2 #BIT1 are set to 1. |
DF_SERRC | One of the following SW00RTN bits is set to 1:
|
The following example:
psgr_lrec = dfred_acc(psgr_file, DFRED_ALG, 0, in_mess); if (DF_ERX(psgr_file)) /* if error from read */ subfile_error(); /* perform error processing */ if (DF_TEST(psgr_file, DFC_ALG)) /* if subfile doesn't exist */ printf("INVALID NUMBER\n"); /* send message to operator */