Assuming the user exists on both machines, is there ever a situation where
CONNECT TO requires an ID / password...some security setting, DB config,
etc.?
-----Original Message-----
From: MIDRANGE-L <midrange-l-bounces@xxxxxxxxxxxxxxxxxx> On Behalf Of Rob
Berendt
Sent: Tuesday, February 1, 2022 4:46 PM
To: Midrange Systems Technical Discussion <midrange-l@xxxxxxxxxxxxxxxxxx>
Subject: RE: SQL stored procedure question
Instead of three part naming can you do a CONNECT TO first?
Rob Berendt
--
IBM Certified System Administrator - IBM i 6.1 Group Dekko Dept 1600 Mail
to: 7310 Innovation Blvd, Suite 104
Ft. Wayne, IN 46818
Ship to: 7310 Innovation Blvd, Dock 9C
Ft. Wayne, IN 46818
http://www.dekko.com
-----Original Message-----
From: MIDRANGE-L <midrange-l-bounces@xxxxxxxxxxxxxxxxxx> On Behalf Of
smith5646midrange@xxxxxxxxx
Sent: Tuesday, February 1, 2022 4:23 PM
To: 'Midrange Systems Technical Discussion' <midrange-l@xxxxxxxxxxxxxxxxxx>
Subject: SQL stored procedure question
CAUTION: This email originated from outside of the organization. Do not
click links or open attachments unless you recognize the sender and know the
content is safe.
I am starting this in the Technical group instead of the RPG group because I
don't think it is an RPG specific problem.
I am foraging into the land of SQL stored procedures with nothing but Google
to help me and can't find an example of what I need.
I wrote an SQLRPGLE program that will be called by a stored procedure. It
has one IN parm and one INOUT parm for a "return" code that tells me what
happened (different values for different results, not just success or
failure status).
I have an SQLRPGLE program that will be executing the stored procedure on
various machines. I started with this statement and parm2 did have the
expected value.
Exec sql call machine1.myLib.myProc(:parm1, :parm2);
My problem is that the machines that it will be called on vary and are soft
coded in a driver file so I can't do hardcoded like this.
If machineToCall = 'machine1';
Exec sql Call machine1.myLib.myProc(:parm1, :parm2);
Endif;
If machineToCall = 'machine2';
Exec sql Call machine2.myLib.myProc(:parm1, :parm2);
Endif;
My thought was to build the string and do an "execute immediate from
:sqlstring" but I don't know how to deal with parm2 because it will no
longer be a variable. I considered have it return a one row result set but
that seems like a hokey work around.
I'm sure there has to be some way to do this and since I am writing the
entire thing from scratch, I can take it any direction that I need to.
Can someone provide some details of how to softcode the machine name on the
call with an input part and have it return a value?
Thanks.
--
This is the Midrange Systems Technical Discussion (MIDRANGE-L) mailing list
To post a message email: MIDRANGE-L@xxxxxxxxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit:
https://lists.midrange.com/mailman/listinfo/midrange-l
or email: MIDRANGE-L-request@xxxxxxxxxxxxxxxxxx
Before posting, please take a moment to review the archives
at
https://archive.midrange.com/midrange-l.
Please contact support@xxxxxxxxxxxxxxxxxxxx for any subscription related
questions.
Help support midrange.com by shopping at amazon.com with our affiliate link:
https://amazon.midrange.com
As an Amazon Associate we earn from qualifying purchases.