The prepared CALL command must be a string, i.e. emedded in Quotes!
Something like this:
QSYS2.QCMDEXC('''call PROGRAM (''' concat CharParm concat ''', ' concat
NumParm concat ')''')
Mit freundlichen Grüßen / Best regards
Birgitta Hauser
Modernization ? Education ? Consulting on IBM i
"Shoot for the moon, even if you miss, you'll land among the stars." (Les
Brown)
"If you think education is expensive, try ignorance." (Derek Bok)
"What is worse than training your staff and losing them? Not training them
and keeping them!"
?Train people well enough so they can leave, treat them well enough so they
don't want to.? (Richard Branson)
-----Original Message-----
From: MIDRANGE-L <midrange-l-bounces@xxxxxxxxxxxxxxxxxx> On Behalf Of Don
Brown via MIDRANGE-L
Sent: Mittwoch, 14. September 2022 04:39
To: midrange-l@xxxxxxxxxxxxxxxxxx
Cc: Don Brown <DBrown@xxxxxxxxxx>
Subject: Run SQL Scripts using qsys2.qcmdexc
I am trying to use qcmdexc in a iACS Run SQL Scripts and it is failing
If I run call qsys2.qcmdexc('addlible msddcb'); This works
If I try the following the error indicates it can not find qcmdexc in
qsys2
select A.*,
case
when QSYS2.QCMDEXC('call ' || 'PROGRAM ' || '(' || COY, AC || ')' ) =
1 then 'Success'
else 'Failed'
end as "Status"
from msddcb.accountsn A;
I have tried putting call in front but that made no difference
What am I missing ?
I copied this basically from an example I found.
The error is
select A.*, case when qsys2.qcmdexc('addlible msddcb') = 1 then 'Success'
else 'Failed' end as "Status" from msddcb.accountsn A SQL State: 42704
Vendor Code: -204 Message: [SQL0204] QCMDEXC in QSYS2 type *N not found.
Cause . . . . . : QCMDEXC in QSYS2 type *N was not found. If the member
name is *ALL, the table is not partitioned. If this is an ALTER TABLE
statement and the type is *N, a constraint or partition was not found. If
this is not an ALTER TABLE statement and the type is *N, a function,
procedure, trigger or sequence object was not found. If a function was not
found, QCMDEXC is the service program that contains the function. The
function will not be found unless the external name and usage name match
exactly. Examine the job log for a message that gives more details on which
function name is being searched for and the name that did not match.
Recovery . . . : Change the name and try the request again. If the
object is a node group, ensure that the DB2 Multisystem product is installed
on your system and create a nodegroup with the CRTNODGRP CL command. If an
external function was not found, be sure that the case of the EXTERNAL NAME
on the CREATE FUNCTION statement exactly matches the
case of the name exported by the service program. Failed statements: 1
Don
--
This email has been scanned for computer viruses. Although MSD has taken
reasonable precautions to ensure no viruses are present in this email, MSD
cannot accept responsibility for any loss or damage arising from the use of
this email or attachments..
--
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.