Hi James
There is now an SQL scalar function, QCMDEXC, that came out in 7.3 - not
sure if that would work. It executes a command and returns a 1 if
successful, -1 if not. Here's an example from a presentation I have
given, where QCMDEXC executes CRTBNDCL on each member of a source PF -
WITH FF AS (SELECT TRIM(TABLE_SCHEMA) || '/' || TRIM(TABLE_PARTITION)
PGMNAME,
TRIM(TABLE_SCHEMA) || '/' || TRIM(TABLE_NAME) SRCNAME
FROM SYSPARTITIONSTAT
WHERE TABLE_SCHEMA = 'VHAMBERG' AND TABLE_NAME = 'GOODBADSRC')
SELECT SRCNAME,
PGMNAME,
CASE
WHEN QSYS2.QCMDEXC('CRTBNDCL PGM(' || PGMNAME || ') SRCFILE(' || SRCNAME
|| ')') = 1
THEN 'Compile succeeded'
ELSE 'Compile failed' END AS COMPILE_RESULT
FROM FF;
You could also consider using the QCAPCMD API - it is like QCMDEXC
command but has an error code parameter, like other system APIs. It also
has an options control block that has a message retrieve key for use in
RTVMSG, IIRC.
*Regards*
*Vern Hamberg*
IBM Champion 2025 <cid:part1.JkohftY5.hyFobvHj@centurylink.net> CAAC
(COMMON Americas Advisory Council) IBM Influencer 2023
On 6/8/2026 4:31 PM, James H. H. Lampert via MIDRANGE-L wrote:
I've got a project in which I will be using a QCMDEXC call to shell
out a CRTLF (from a generated source member). What is the easiest way
for the calling program to determine whether the CRTLF was successful?
--
JHHL