A_ODBC_ERROR_MAP_FILE configuration variable

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 on the following page, 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:

A_ODBC_ERROR_MAP_FILE  c:\ODBC\MAP

There is no default value for this variable.

Guidelines for creating a map file

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:

  • Begin comment lines with #. Blank lines are also considered comments.
  • Break the rest of the file into sections, with each section header comprising all the information enclosed in brackets from the data source error function.

    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]
    
  • Include two fields in each line in the section: the internal error number, and an ACUCOBOL-GT mapping string.

    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:

    -346 E_NOT_FOUND

    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:

    • E_SYS_ERR
    • E_PARAM_ERR
    • E_TOO_MANY_FILES
    • E_MODE_CLASH
    • E_REC_LOCKED
    • E_BROKEN
    • E_DUPLICATE
    • E_NOT_FOUND
    • E_UNDEF_RECORD
    • E_DISK_FULL
    • E_FILE_LOCKED
    • E_REC_CHANGED
    • E_MISMATCH
    • E_NO_MEMORY
    • E_MISSING_FILE
    • E_PERMISSION
    • E_NO_SUPPORT
    • E_NO_LOCKS

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.