Tailoring the SQLCODE mapping
By default, Db2 Connect maps SQLCODEs and tokens from each IBM mainframe database server to the appropriate Db2® SQLCODEs. You can tailor the SQLCODE mapping if you want to override the default SQLCODE mapping or if you are using a IBM mainframe database server that does not have SQLCODE mapping (not an IBM database server).
About this task
The following files are copies of the default SQLCODE
mapping:
- dcs1dsn.map maps Db2 for z/OS® SQLCODEs.
- dcs1ari.map maps Db2 Server for VM and VSE SQLCODEs.
- dcs1qsq.map maps IBM® Db2 for IBM i SQLCODEs.
No mapping is required for Db2 on Linux® or UNIX operating systems.
Each mapping file is an ASCII file, which is created and edited using an ASCII editor. At initial installation, the file is stored in the map directory in the installation path.
Procedure
If you want to create an SQLCODE mapping for a database server that is not an IBM database server or override the default SQLCODE mapping:
Example
&&
-007 , -007 , (1)
-010
-060 , -171 , (2)
...
-204 , -204 , (c1.2c)
...
-633 , -206 , (,c1i)
-30021 , -30021 , (c1c,c2c)
cc00 , +000
...
U , -969 , (s)
P , +965 , (s)
The following descriptions correspond to the matching line
number in the previous figure:
- The SQLCODE is mapped from -007 to -007. The first input token received from the IBM mainframe database server is used as the first output token, and it defaults to CHAR. No other tokens are transferred.
- The SQLCODE is mapped from -010 to -010 (no output SQLCODE is specified). No tokens are put into the output SQLCA.
- The SQLCODE is mapped from -060 to -171. The first input token received from the IBM mainframe database server is discarded. The second is used as the first token in the output SQLCA, and it is CHAR. There is no second token in the output SQLCA.
- The SQLCODE is mapped from -204 to -204. The first and second tokens received from the IBM mainframe database server are CHAR. These two input tokens are combined to form one CHAR output token, which will be the first output token in the SQLCA.
- The SQLCODE is mapped from -633 to -206. The first input token received from the IBM mainframe database server is CHAR. It is converted to INTEGER and is used as the second token in the output SQLCA. The first token in the output SQLCA is null, as indicated by a comma.
- The SQLCODE is mapped from -30021 to -30021. The first and second input tokens received from the IBM mainframe database server are CHAR, and they are used as the first and second tokens in the output SQLCA.
- All SQLCODEs in SQLCAs with SQLSTATEs in the 00 class will be mapped to SQLCODE +000.
- All undefined SQLCODEs are mapped to -969. This option should be used only if all mappable codes are listed, including all those that are identical and require no mapping. The (s) option indicates that the token list to be returned in the SQLERRMC field of the SQLCA includes the original SQLCODE, followed by the product the error occurred in, followed by the original token list. If the U entry is not included, all unlisted codes are passed without any mapping.
- All undefined positive SQLCODEs are mapped to +965. This option should be used only if all mappable codes are listed, including all those that are identical and require no mapping. The (s) option indicates that the token list to be returned in the SQLERRMC field of the SQLCA includes the original SQLCODE, followed by the product the warning occurred in, followed by the original token list. If the P entry is not included, all unlisted positive codes are passed without any mapping.