Hi Dan,

While we've never used the JBA supplied chpm1cad.dll, I have written programs in VB6 that use the Client Access Object Library to call AS400 programs and update data in files. As you're talking about reverse-engineering the function I'm assuming that you or someone in your organisation could transpose this VB code into C or whatever PC side language you use.

First, you need to add the Client Access Object Library dll to your project references. The dll is usually installed as part of the Client Access installation and should be in C:\Program Files\IBM\Client Access\Toolkit\Typelib and is called cwbautsv.tlb

Once you have declared that, you need to add a few parameters to the declarations area on the VB6 project

Dim dbConn As New cwbDatabaseConnection
Dim mySQL As New cwbDatabaseSQL
Dim myDB2 As New cwbDatabaseDB2
Dim myFmt As New cwbDatabaseDataFormat
Dim errObj As New cwbErrorMessage
Dim mySys As New cwbRemoteCallConversation
Dim myCmd As New cwbCommand

To be frank, I had to guess my way round how these things are supposed to function, so I've got no real technical explanation about what they actually do.

If I have a file on the system for example QGPL/USERS which has 3 fields USERID, DESC, USRCLS to add or update records, I would use the code below

(this code would be at the start of a sub routine)

errObj.cwbsvSetup 'this lets you capture errors
dbConn.cwbdbSetup "SYSNAM", errObj 'SYSNAM is the name of the system used when setting up the client access profile
dbConn.convert65535 = True
dbConn.cwbdbStartServer errObj
myDB2.cwbdbSetup dbConn, errObj
myDB2.cwbdbOverrideFile "QGPL", "USERS", "USERS", "MYFILE", errObj 'the first 2 parms are the library and filename, the 3rd is the file member name, the 4th is the name you want to use in the update/add
mySQL.cwbdbSetup dbConn, myFmt, errObj

(this code would add records to the file, you need to include values for all the fields in the file)
mySQL.cwbdbExecuteImmediate "SQL1", "INSERT Into MYFILE Values('LEE', 'Lee Greenwood','Secofr')

(this code would update a record)
mySQL.cwbdbExecuteImmediate "SQL1", "UPDATE MYFILE Set USRCLS='USER' where USERID='LEE'"


To call a program you only need 2 lines to make the connection
errObj.cwbsvSetup
mySys.cwbrcStartConversation "SYSNAM", "SOMERANDOMTEXT" 'Again parm 1 is the AS400 name defined when you setup Client Access on the PC, the 2nd parm seems a bit pointless

Then this line to run the command
myCmd.cwbrcRunCmd mySys, "CLRPFM FILE(QGPL/USERS)", errObj

To call a program with parameters
myCmd.cwbrcRunCmd mySys, "CALL LIB/PGM PARM('x' 'y')", errObj

Hope this helps

Lee.

-----Original Message-----
From: system21-bounces@xxxxxxxxxxxx [mailto:system21-bounces@xxxxxxxxxxxx] On Behalf Of Dan Thomas
Sent: 04 August 2010 21:54
To: SYSTEM21@xxxxxxxxxxxx
Cc: Brad Hudson
Subject: [SYSTEM21] RPC mechanism to call AS400 programs from a 64-bit Windows client

Is anyone using a generic RPC mechanism to call AS400 programs from a 64-bit Windows client (Windows Server 2003 64-bit Standard Edition is what we are using)?



We purchased eSupply from JBA years ago. We are no longer on support and even back then support for eSupply was limited. We have developed our own eCommerce applications, but still use an eSupply dll named chpm1cad.dll. We do have RPG source code for JBA, but not for this dll.
We use three functions within the dll to a) make a connection to a proxy program on the AS400 (named jbachp), b) pass in the AS400 program name and parameters to it, and c) close the connection to the proxy.



The current problem we are having is that IIS running on 64-bit windows is returning an error when we try to call the 32-bit dll. Hopefully I'll be able to write a wrapper to get around that, but if not, our best bet is probably to find a generic RPC mechanism for the AS400 that has a 64-bit Windows client component. In a worst-case scenario, if the jbachp proxy was providing some vital function that a generic RPC doesn't handle, we could always reverse-engineer the client side and completely replace the dll. I don't think the format of the data sent over the wire is very complicated, aside from a possible ASCII to EBCDIC conversion (which might be done in the server side proxy instead).





Dan Thomas

Vice President

RxCrossroads

Office: 502-213-1208

Cell: 502-296-8045

Fax: 502-753-8356

dthomas@xxxxxxxxxxxxxxxx <mailto:dthomas@xxxxxxxxxxxxxxxx>



This information transmitted is intended only for the person or entity to which it is addressed and may contain confidential and/or privileged material, the disclosure of which is governed by applicable law. Any review, retransmission, dissemination or other use of, or taking of any action in reliance upon, this information by persons or entities other than the intended recipient is prohibited. If you received this in error, please contact me and destroy the materials contained in this message.



_______________________________________________
This is the System 21 Users (SYSTEM21) mailing list To post a message email: SYSTEM21@xxxxxxxxxxxx To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/system21
or email: SYSTEM21-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives at http://archive.midrange.com/system21.


*********************************************************************
Titan Europe PLC
Registered in England No. 301 8340
Registered Office: Bridge Road, Cookley, Kidderminster, Worcestershire, United Kingdom. DY10 3SD
*********************************************************************
Please note that the Company reserves the right to monitor both
incoming and outgoing e-mails and therefore the sender and recipient
of such e-mails should have no expectation of privacy in this regard.
_____________________________________________________________________
This message has been checked for all known viruses by Star Internet
delivered through the MessageLabs Virus Scanning Service. For further
information visit http://www.star.net.uk/stats.asp

This thread ...

Follow-Ups:
Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2020 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].