Call an AS/400 stored procedure
How can I invoke a stored procedure that I create on DB2/AS/400 with RDO for Visual Basic 6.0 applications?
In order to call an AS/400 stored procedure via VB your best shut is using OLE DB provider. For example, the one provided by Client Access Express.
Steps:
1. Get mdac up and running -- This is the microsoft part.
2. Create the procedure on the AS/400 using one of the compilers (i.e rpg' cobol' c' pure sql).
3. Register the procedure using the create function as follows:
CREATE PROCEDURE QGPL.myproc
(parm1 OUT CHAR(10), parm2 OUT CHAR(10))
(EXTERNAL NAME QGPL.pgmname LANGUAGE CL SIMPLE CALL)
4. Embed the code for procedure call, an example can be found here:
ANE Classics: More AS/400 Client/Server Programming with ADO and VBA
It is easy and it works. Note that on the AS/400 your program will be called by an AS/400 host server with user name quser.