简体   繁体   English

如何使用 cwbx.dll 和 AS400System 类从 C# 到 IBM i (iSeries) 设置库列表

[英]How to set library list using cwbx.dll and AS400System class from C# to IBM i (iSeries)

I use client access driver to make sql calls to IBM i (an iSeries).我使用客户端访问驱动程序对 IBM i(一个 iSeries)进行 sql 调用。 When using the driver I can specify a library list that will be used when issuing sql commands/functions.使用驱动程序时,我可以指定在发出 sql 命令/函数时将使用的库列表。

I now need to access an iSeries from C# and make calls to CL/RPGLE programs.我现在需要从 C# 访问 iSeries 并调用 CL/RPGLE 程序。 I found that I can create an AS400System object after adding a reference to cwbx.dll.我发现在添加对 cwbx.dll 的引用后,我可以创建一个 AS400System 对象。 However, I am not sure how to set a library list and am having trouble finding documentation on cwbx.dll.但是,我不确定如何设置库列表并且无法找到有关 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. CHGLIBL LIBL(<space-separated list of libraries>)的命令CHGLIBL LIBL(<space-separated list of libraries>)将强制 AS/400 用户库列表成为所需的列表。 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).此外,在调用 AS/400 程序(尤其是 CL 的)时,IMO、CWBX API 提供比 SQL 接口更多的错误详细信息。

Per this doc : "CWBX.DLL (The Programmatic interface) allows to do Data Transfer operations programmatically"根据此文档:“CWBX.DLL(编程接口)允许以编程方式进行数据传输操作”

That's not what you're wanting to do.那不是你想要做的。

You probably want to use the DB2 for i .NET provider .您可能希望使用DB2 for i .NET 提供程序

Documentation for the provider is installed when you select "Programmer's Toolkit" during the IBm iAccess installation.当您在 IBm iAccess 安装期间选择“程序员工具包”时,将安装提供程序的文档。

Did a little more digging, documentation for CWBX.DLL can be found in:进行了更多挖掘,CWBX.DLL 的文档可以在以下位置找到:
C:\\Program Files (x86)\\IBM\\Client Access\\MRI2924\\cwbx.hlp 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.仅通过 DatabaseUserLibraryList 对象传输数据。

The recommended way to call RPGLE / CL from .NET would be call them as an SQL stored procedure.从 .NET 调用 RPGLE/CL 的推荐方法是将它们作为 SQL 存储过程调用。 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.从技术上讲,考虑到操作系统基于对象的特性,盒子上的每个 *PGM(或 *SRVPGM 中的过程)对象都已经是一个存储过程,可以使用 SQL 调用命令隐式调用。 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.但是,建议使用带有EXTERNAL NAME子句的CREATE PROCEDURE语句显式定义 RPG / CL 接口到数据库,如下所示。

example from this article这篇文章的例子

Assume you have a *PGM named CUSTINFO, with the following program interface (aka *ENTRY PLIST)假设您有一个名为 CUSTINFO 的 *PGM,具有以下程序界面(又名 *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.在输入 CustNo 的情况下,其余参数用作输出。 Then you can explicitly define this program as an SQL stored procedure simply by running the following:然后,您可以通过运行以下命令,将该程序显式定义为 SQL 存储过程:

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
  • note I used the term "program interface".注意我使用了术语“程序接口”。 Technically it's the entry point or mainline procedure interface从技术上讲,它是入口点或主线过程接口

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 我正在尝试使用C#为AS400编码解决方案,在哪里可以找到cwbx.dll? - I'm trying to code solutions for an AS400 using C#, where can I find the cwbx.dll? 使用C#从NHibernate连接到AS400(iSeries)时出现错误RROR [08] [IBM] SQL30081N - Error RROR [08001] [IBM] SQL30081N when connecting to AS400 (iSeries) from NHibernate using C# C#-解码来自AS / 400 iSeries的数据 - C# - Decoding Data From an AS/400 iSeries 有没有办法使用SQL在IBM System i(aka iSeries / AS400)上更改用户密码? - Is there a way to change user password on IBM System i (aka iSeries / AS400) using SQL? 如何使用DLL将C ++类库导出到C#? - How to export a C++ class library to C# using a dll? IBM.Data.DB2.iSeries的iSeries的.NET / C#DB2&#39;FatalExecutionEngineError&#39; - .NET/C# DB2 for iSeries 'FatalExecutionEngineError' from IBM.Data.DB2.iSeries 如何在C#中将binary(4)参数的数组(*)传递给IBM iSeries api? - How to pass an array(*) of binary(4) parameter to IBM iSeries api in C#? 用C#编程IBM iSeries API QUSLSPL - Programming IBM iSeries API QUSLSPL in C# 如何从C#中的子文件夹导入.dll库 - How do I import .dll library from subfolder in C# 错误SQL30061N使用IBM.EntityFrameworkCore从Visual Studio 2017 c#中的DB2 iSeries提取数据 - Error SQL30061N pulling data from DB2 iSeries in Visual Studio 2017 c# using IBM.EntityFrameworkCore
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM