DB2 Stored Procedure V4R4 without ILE C/400
0 pts.
0
Q:
DB2 Stored Procedure V4R4 without ILE C/400
We have an older iSeries running V4R4. We user Rumba/400 for AS400 access, and we've run into a problem using the Rumba ODBC driver for linked server access from our SQL server to our AS400 (The ODBC driver periodically fails when the linked server is used heavily). Because of this, we've been doing everything we can to avoid using the linked server, and instead use OPENROWSET() wherever possible. This works well as long as we don't need to do an update, insert, delete, or execute a program on the as400. When we need to do any of those, we seem to be stuck using the linked server on our SQL server.

I have set up several stored procedures to run RPG or CL programs, and they all work well for what we need (they're in DTS packages).

We're currently trying to replace an update using the linked server with something more stable. The first thing we tried was to use an update openrowset(), but, it seems we are limited to 1 row at a time which can be rather ugly. After that, I tried putting the SQL into a CL program, and creating a stored procedure to call the external program (SQL based stored procedures require ILE C/400 to compile). This works fine except that no result set is returned, so again, we can't use OPENROWSET since it expects a resultset.

My first thought was that since it would be good to know the number of rows updated anyway, simply adding a result set of the returned rows would be the easiest solution. but, I can't seem to find any documentation online as to how to return a result set in RPG or CL.

Granted, my experience in RPG, and CL is very limited, so, I could easily be overlooking something very obvious.

Any ideas? (purchasing ILE C/400 isn't an option at this time unfortunately)

thanks in advance,
Kevin
ASKED: Aug 4 2006  11:00 AM GMT
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
0
0 pts.
0
A:
 RATE THIS ANSWER
0
Click to Vote:
  •   0
  •  0
  • AddThis Social Bookmark Button
You have to install ILE C/400. You are trying to implement functionality that does not exist in your old system. The only solution we have found that works reliably is for the remote server to call an SQL stored procedure.
RPG and CL do not return result sets. You can go back to FTPing batch files or upgrade.
Last Answered: Aug 4 2006  11:20 AM GMT by costevet   0 pts.
0
0
Discuss This Answer:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _



_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

Hoffman   0 pts.  |   Aug 7 2006  10:36AM GMT

Upgrade you OS on the iSeries to v5r4, use the OLEDB provider that comes with Client Access for your SQL Link Server…. Also if you have SQL on the iSeries (try strsql from a command line) you can return a record set from an RPG-SQL program.

 

JPLamontre   0 pts.  |   Aug 7 2006  4:13PM GMT

this sample in free rpg (sorry for not-free-V4R4) returns a result set.

I have found it at
 <a href="http://www.iseriesnetwork.com/isnetforums/showthread.php?p=168208#poststop" title="http://www.iseriesnetwork.com/isnetforums/showthread.php?p=168208#poststop" target="_blank">http://www.iseriesnetwork.com/isnetforum…</a>

h dftactgrp(*no)

fCstMst1 if a e k disk prefix(’CS.’)

d cs e ds qualified extname(CSTMSTPF)
d CustRS pr
d pRows 10i 0
d CustRS pi
d pRows 10i 0

d CustList ds occurs(100)
d CSTMST 481a

d i s 10i 0
/free

i = 0;
setll *Loval CstMst1;
read CstMst1;
dow not %eof(CstMst1);

if i >= pRows;
leave;
endif;

i = i + 1;
%occur(CustList) = i;
CSTMST = cs;

read CstMst1;
enddo;
exsr setResult;

*inlr = *On;

begsr setResult;
/end-free
C/EXEC SQL
C+ SET RESULT SETS ARRAY:CustList FOR:I ROWS
C/END-EXEC
/free
endsr;

/end-free

 
0