How to use API to access DB2 file on iSeries

435 pts.
Tags:
AS/400
IBM DB2
Gredon would like to access (search, read, insert, update and delete) a DB2 file on the iSeries with an API. He said he's searched the IBM manual, but he couldn't find the APIs that he can use. Can you help him? -- Michelle Davidson, editor, Search400.com

Answer Wiki

Thanks. We'll let you know when a new response is added.

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.

/s/Sheldon Linker

======================================================

The APIs would likely be the Call Level Interface (CLI) APIs. In other environments, these would probably be called “ODBC”.

Tom

Discuss This Question: 1  Reply

 
There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy
  • JPLamontre
    why DB2 API ? there is so much DB2 APIs embbeded in SQL ! look at http://search400.techtarget.com/tip/1,289483,sid3_gci1131143,00.html?track=NL-17&ad=530051 or http://iseries-toolkit.sourceforge.net/open-source.html there can be some ideas
    0 pointsBadges:
    report

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Thanks! We'll email you when relevant content is added and updated.

Following