The SYNAD parameter of the DCB or DCBE macro specifies the address of an error routine that is to be given control when an input/output error occurs. You can use this routine to analyze exceptional conditions or uncorrectable errors. I/O errors usually occur asynchronously to your program, but the access method calls your SYNAD routine synchronously to macros that your program issues.
If an I/O error occurs during data transmission, standard error recovery procedures that are provided by the operating system try to correct the error before returning control to your program. These error recovery procedures generally are asynchronous to your program. An uncorrectable error usually causes an abnormal termination of the task. However, if you specify the address of an error analysis routine (called a SYNAD routine) in the DCB or DCBE macro, that routine can try to correct or ignore the error and prevent an abnormal termination. The routine is given control when the application program issues the access method macro that requires the buffer that received the uncorrectable error. For the queued access methods this generally means after enough PUT or GET macros to fill BUFNO-1 buffers past the failing block. For the basic access methods this means when your program issues a CHECK macro for the failing DECB.
For BDAM, BSAM, BPAM, and QSAM, the control program provides a pointer to the status indicators shown in Figure 1. The block being read or written can be accepted or skipped, or processing can be terminated.
Table 1 shows the exception code bits for QISAM.
Exception Field | Code Bit | CLOSE | Code GET | Set PUT | by PUTX | SETL | Condition If On |
---|---|---|---|---|---|---|---|
DCBEXCD1 | 0 | Type K | Record Not Found | ||||
1 | Type I | Nonvalid actual address for lower limit | |||||
2 | X | Space not found for adding a record | |||||
3 | X | Nonvalid request | |||||
4 | X | Uncorrectable input error | |||||
5 | X | X | X | Uncorrectable output error | |||
6 | X | X | Block could not be reached (input) | ||||
7 | X | X | Block could not be reached (update) | ||||
DCBEXCD2 | 0 | X | Sequence check | ||||
1 | X | Duplicate record | |||||
2 | X | Data control block closed when error routine entered | |||||
3 | X | Overflow record | |||||
4 | X | Incorrect record length | |||||
5-7 | Reserved for future use |
If a data set is being created (load mode), the SYNAD exit routine is given control when the next PUT or CLOSE macro instruction is issued. If a failure to write a data block occurs, register 1 contains the address of the output buffer, and register 0 contains the address of a work area containing the first 16 bytes of the IOB; for other errors, the contents of register 1 are meaningless. After appropriate analysis, the SYNAD exit routine should close the data set or end the job step. If records are to be subsequently added to the data set using the queued indexed sequential access method (QISAM), the job step should be terminated by issuing an abend macro instruction. (Abend closes all open data sets. However, an ISAM data set is only partially closed, and it can be reopened in a later job to add additional records by using QISAM.) Subsequent execution of a PUT macro instruction would cause reentry to the SYNAD exit routine, because an attempt to continue loading the data set would produce unpredictable results.
If a data set is being processed (scan mode), the address of the output buffer in error is placed in register 1, the address of a work area containing the first 16 bytes of the IOB is placed in register 0, and the SYNAD exit routine is given control when the next GET macro instruction is issued. Buffer scheduling is suspended until the next GET macro instruction is reissued.
If the error is encountered during closing of the data control block, bit 2 of DCBEXCD2 is set to 1 and the SYNAD exit routine is given control immediately. Otherwise, the SYNAD exit routine is given control when the next GET macro instruction is issued.