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

This thread ...

Replies:

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

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