VSAM return codes

When failing return codes are received from z/OS® XL C/C++ VSAM I/O functions, you can access the __amrc structure to help you diagnose errors. The __amrc_type structure is defined in the header file stdio.h (when the compiler option LANGLVL(LIBEXT) is used).

Note: The __amrc struct is global and can be reset by another I/O operation (such as printf()).
The following fields of the structure are important to VSAM users:
__amrc.__code.__feedback.__rc
Stores the VSAM R15.
__amrc.__code.__feedback.__fdbk
Stores the VSAM error code or reason code.
__amrc.__RBA
Stores the RBA after some operations. The __amrc.__RBA field is defined as an unsigned int, and therefore will only contain a 4-byte RBA value. This field will be set to -1 when the RBA is beyond 4GB in an extended addressable VSAM data set. In this case, the __XRBA field should be used.
__amrc.__XRBA
The 8 byte relative byte address returned by VSAM after an ESDS or KSDS record is written out. For an RRDS, it is the calculated value from the record number. It may be used in subsequent calls to flocate().
__amrc.__last_op
Stores a code for the last operation. The codes are defined in the header file stdio.h.
__amrc.__rplfdbwd
Stores the feedback code from the IFGRPL control block.

You can set up a SIGIOERR handler to catch read or write system errors. See Debugging I/O programs for more information.