Because there are so many drivers available for ODBC, you may find that data source error codes don’t necessarily map well to COBOL error codes. To solve this problem, Acu4GL for ODBC allows you to create an error map file to map native database errors to COBOL errors. Create this file using the guidelines described below, and then use the configuration file variable, A_ODBC_ERROR_MAP_FILE, to indicate the name and location of the file you created.
For example, specify this in the rum time configuration file if the file used for mapping is called MAP, and this file is located in the directory C:\ODBC:
There is no default value for this variable.
Although you can check your data source documentation for error code information, the easiest way to determine what error codes need to be mapped to more appropriate COBOL codes is through trial and error. As users use Acu4GL for ODBC, they may report receiving error messages that don’t make sense based on their situation. Research these errors and try to determine a more appropriate COBOL error response.
When you create your error map file, use the following guidelines:
For example, if the data source returns this error:
OdbcOneInfo: State: S1000, Native Error: -346 [Visigenic][ODBC Informix 5 Driver][Informix]Could not update a row in the table.
make your section header:
[Visigenic][ODBC Informix 5 Driver][Informix]
Using the same example, if you wanted to map the Visigenic Informix driver error, -346 Could not update a row in the table to the COBOL error, Not found, you would include this line in the section:
Other Visigenic Informix error maps would follow in the same section. If you use other drivers, you could use multiple sections.
The valid values for the second field are as follows:
Through experience, we have discovered specific ways to better map errors for some drivers. For a list of these driver error mapping suggestions, look at the file odbcerrs on your installation disks.