× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



Looks to me like two strings are being passed to qcmdexc:


QSYS2.QCMDEXC(
'call ' || 'PROGRAM ' || '(' || COY
,
AC || ')'
)



On Wed, Sep 14, 2022 at 6:20 AM Rob Berendt <rob@xxxxxxxxx> wrote:

Don,
There are two different things in play here.
QCMDEXC, the stored procedure
QCMDEXC, the scalar function.
The stored procedure came out much earlier. When you use CALL
QSYS2.QCMDEXC... you are using the stored procedure. When you use select
..., qsys2.qcmdexc(..., from... you are using the scalar function.
For a list of what level of os and ptf's needed check out:
https://www.ibm.com/support/pages/node/1119123
Basically the stored procedure was part of the base of 7.3.
Can you tell me at what 7.3 DB2 group level did the function come out by
looking at the link above?
See also: WRKPTFGRP
However, since you are only 6 months behind, and DB2 7.3 is up to level
30, I would think you should have it. I could not find a history of when
level 24 came out.
Are you sure you're ordering group ptfs also and not just the cume?

For a definitive search you could try:
select *
from qsys2.sysfuncs
where SPECIFIC_SCHEMA='QSYS2' and ROUTINE_NAME='QCMDEXC';
This is different than
select *
from qsys2.sysprocs
where SPECIFIC_SCHEMA='QSYS2' and ROUTINE_NAME='QCMDEXC';

For 7.3 documentation on the scalar function see:
https://www.ibm.com/docs/en/i/7.3?topic=services-qcmdexc-scalar-function

See also:
https://www.ibm.com/support/pages/ibm-i-group-ptfs-level

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 Don
Brown via MIDRANGE-L
Sent: Wednesday, September 14, 2022 2:35 AM
To: Midrange Systems Technical Discussion <midrange-l@xxxxxxxxxxxxxxxxxx>
Cc: Don Brown <DBrown@xxxxxxxxxx>
Subject: RE: Run SQL Scripts using qsys2.qcmdexc

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.


This works

call qsys2.qcmdexc('rmvlible msddcb');

We are on 7.3 and about 6 months behind latest PTF's

call qsys2.qcmdexc('rmvlible msddcb')
Return Code = 0
Statement ran successfully (3 ms)


Don




From: "Birgitta Hauser" <Hauser@xxxxxxxxxxxxxxx>
To: "'Midrange Systems Technical Discussion'"
<midrange-l@xxxxxxxxxxxxxxxxxx>
Date: 14/09/2022 04:30 PM
Subject: RE: Run SQL Scripts using qsys2.qcmdexc
Sent by: "MIDRANGE-L" <midrange-l-bounces@xxxxxxxxxxxxxxxxxx>



Have you checked if the QCMDEXC function exists within the QSYS2 library.
May be you are not on the current PTF level or are missing some PTFs

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 07:36
To: Javier Sanchez <javiersanchezbarquero@xxxxxxxxx>
Cc: Don Brown <DBrown@xxxxxxxxxx>; Midrange Systems Technical Discussion
<midrange-l@xxxxxxxxxxxxxxxxxx>
Subject: Re: Run SQL Scripts using qsys2.qcmdexc

This also fails with the same error ...

select A.*,
case
when qsys2.qcmdexc('addlible msddcb') = 1 then 'Success'
else 'Failed'
end as "Status"
from msddcb.accountsn A;



Don




From: "Javier Sanchez" <javiersanchezbarquero@xxxxxxxxx>
To: "Midrange Systems Technical Discussion"
<midrange-l@xxxxxxxxxxxxxxxxxx>
Cc: "Don Brown" <DBrown@xxxxxxxxxx>
Date: 14/09/2022 02:21 PM
Subject: Re: Run SQL Scripts using qsys2.qcmdexc



I'm not sure, but the argument to the scalar function looks like it
resolves
into two strings rather than one because of the comma. That prototypes to
a
function that does not exist. I see too many unnecessary "concats" there.
Try to rebuild the final string that becomes only one.
Maybe that's it.

JS


El mar, 13 sept 2022 a las 20:39, Don Brown via MIDRANGE-L (<
midrange-l@xxxxxxxxxxxxxxxxxx>) escribió:
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




--
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

--
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




--
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
--
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.

This thread ...

Replies:

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

This mailing list archive is Copyright 1997-2024 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].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.