Hi Birgitta

This function has been a fantastic addition, but it doesn't give us the MSGID of the error. That might be a good Idea to submit, unless the _EXCP_MSGID is available. That isn't an SQL variable, right?

Another question is which releases James has to support. I'd suggested the QCMDEXC SQL function to him, but also *QCAPCMD*. Both that and *system *have been available for many releases.

*Regards*

*Vern Hamberg*

IBM Champion 2025 <cid:part1.E4S03TeF.XaBTnLAf@centurylink.net> CAAC (COMMON Americas Advisory Council) IBM Influencer 2023


On 6/9/2026 2:13 AM, Birgitta Hauser wrote:
Why not using something like this?

Select QCMDEXC('CRTLF FILE(YOURDTALIB/' concat Trim(SYSTEM_TABLE_MEMBER) concat ') ' concat
'SRCFILE(' concat Trim(System_Table_Schema) concat '/' concat
Trim(System_Table_Name) concat ') ' concat
'SRCMBR(' concat Trim(System_Table_Member) concat ') '),
a.*
from SysPartitionStat a
Where System_Table_Schema = 'HSCOMMON05'
and System_Table_Name = 'QDDSSRC'
and System_Table_Partition = 'ABCDE'
and Source_Type = 'LF';

If everything is okay QCMDEXC will return 1 if everything was executed correctly and -1 if an error occurred.
Errors if a member does not exist can be avoided when selecting the source member from the SysPartitionStat view

Mit freundlichen Grüßen / Best regards

Birgitta Hauser
Modernization – Education – Consulting on IBM i
Database and Software Architect
IBM Champion since 2020

"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)
"Learning is experience … everything else is only information!" (Albert Einstein)


-----Original Message-----
From: MIDRANGE-L<midrange-l-bounces@xxxxxxxxxxxxxxxxxx> On Behalf Of Rob Berendt
Sent: Monday, 8 June 2026 23:50
To: Midrange Systems Technical Discussion<midrange-l@xxxxxxxxxxxxxxxxxx>
Subject: Re: Shelling out CRTLF via QCMDEXC -- question about success/failure

Although I would avoid DDS here is a sample using it

-- I injected an error (member does not exist) CALL QSYS2.QCMDEXC('CRTLF FILE(ERPLXF/IIML0UI) SRCFILE(ERPLXS/QDDSSRC)') ; SELECT * from table(qsys2.joblog_info('*')) A where message_id<>'SQL0443'
order by ordinal_position desc
;
select NATIVE_TYPE, S.*
from qsys2.sysfiles S
where SYSTEM_TABLE_SCHEMA='ERPLXF'
AND SYSTEM_TABLE_NAME='IIML01';

On Mon, Jun 8, 2026 at 5:31 PM James H. H. Lampert via MIDRANGE-L <midrange-l@xxxxxxxxxxxxxxxxxx> 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 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 contactsupport@xxxxxxxxxxxxxxxxxxxx for any subscription
related questions.


--
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 athttps://archive.midrange.com/midrange-l.

Please contactsupport@xxxxxxxxxxxxxxxxxxxx for any subscription related questions.



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.