The key to understanding how to do this is that DB2 tables are AS/400 files. (Actually, they’re members of AS/400 files, but generally there is only one member in the file.) So, to access these tables, you open the file, define records as you usually define records in RPG or structures in C/C++, use record read/write/seek/delete calls (all starting with _R, such as _Rreadk, et cetera), and close the file at the end.
Note that there will be a separate vector of null flags if the file allows, and that VARCHAR fields are stored as a 16-bit integer, followed by a fixed-length number of characters.
Linker Systems, Inc.
Outside of North America use +1-949-552-1904
The APIs would likely be the <a href=”http://publib.boulder.ibm.com/infocenter/iseries/v5r4/index.jsp?topic=/apis/database2.htm”>Call Level Interface (CLI) APIs</a>. In other environments, these would probably be called “ODBC”.