I use client access driver to make sql calls to IBM i (an iSeries). When using the driver I can specify a library list that will be used when issuing sql commands/functions.
I now need to access an iSeries from C# and make calls to CL/RPGLE programs. I found that I can create an AS400System object after adding a reference to cwbx.dll. However, I am not sure how to set a library list and am having trouble finding documentation on cwbx.dll. Has anyone else been able to use this object to set a library list?
Asked and answered, I know. But here's my answer to the question posed.
The command CHGLIBL LIBL(<space-separated list of libraries>)
in a cwbx.Command call will force the AS/400 user library list to be the list needed. It also forces the library list to be in the same order as specified.
Also, IMO, the CWBX APIs provide more error details than the SQL interface when calling AS/400 programs (especially CL's).
Per this doc : "CWBX.DLL (The Programmatic interface) allows to do Data Transfer operations programmatically"
That's not what you're wanting to do.
You probably want to use the DB2 for i .NET provider .
Documentation for the provider is installed when you select "Programmer's Toolkit" during the IBm iAccess installation.
Did a little more digging, documentation for CWBX.DLL can be found in:
C:\\Program Files (x86)\\IBM\\Client Access\\MRI2924\\cwbx.hlp
It doesn't appear that you can manipulate the library list for a command. Only a data transfer via the DatabaseUserLibraryList object.
The recommended way to call RPGLE / CL from .NET would be call them as an SQL stored procedure. Technically, given the object based nature of the OS, every *PGM (or procedure in a *SRVPGM) object on the box is already a stored procedure and can be called implicitly using the SQL call command. However, it's beneficial and recommended to explicitly define the RPG / CL interface to the DB using the CREATE PROCEDURE
statement with the EXTERNAL NAME
clause as shown below.
example from this article
Assume you have a *PGM named CUSTINFO, with the following program interface (aka *ENTRY PLIST)
D CustInfo PI
D CustNo 5P 0
D Name 15A
D City 25A
D State 2A
D Active 1P 0
Where CustNo is input, the rest of the parms are used as output. Then you can explicitly define this program as an SQL stored procedure simply by running the following:
CREATE PROCEDURE GetCustInfo
(IN CustNo DEC (5,0), OUT Name CHAR (15), OUT City CHAR(25),
OUT St CHAR(2), OUT Act DEC(1,0))
EXTERNAL NAME MYLIB/CUSTINFO
LANGUAGE RPGLE
PARAMETER STYLE GENERAL
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.