RE: Shelling out CRTLF via QCMDEXC -- question about success/failure

"Birgitta Hauser" <Hauser-bRAHsVz2yv4TVIZRl6KS/[email protected]> Tue, 9 Jun 2026 09:13:31 +0200
Newsgroups gmane.comp.hardware.ibm.midrange
Message-ID <[email protected]>
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 <[email protected]> On Behalf Of Rob Berendt
Sent: Monday, 8 June 2026 23:50
To: Midrange Systems Technical Discussion <[email protected]>
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 < [email protected]> 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: [email protected] To 
> subscribe, unsubscribe, or change list options,
> visit: https://lists.midrange.com/mailman/listinfo/midrange-l
> or email: [email protected]
> Before posting, please take a moment to review the archives at 
> https://archive.midrange.com/midrange-l.
>
> Please contact [email protected] for any subscription 
> related questions.
>
>
--
This is the Midrange Systems Technical Discussion (MIDRANGE-L) mailing list To post a message email: [email protected] To subscribe, unsubscribe, or change list options,
visit: https://lists.midrange.com/mailman/listinfo/midrange-l
or email: [email protected]
Before posting, please take a moment to review the archives at https://archive.midrange.com/midrange-l.

Please contact [email protected] for any subscription related questions.


-- 
This is the Midrange Systems Technical Discussion (MIDRANGE-L) mailing list
To post a message email: [email protected]
To subscribe, unsubscribe, or change list options,
visit: https://lists.midrange.com/mailman/listinfo/midrange-l
or email: [email protected]
Before posting, please take a moment to review the archives
at https://archive.midrange.com/midrange-l.

Please contact [email protected] for any subscription related questions.