Re: return() and retain job log

<rob-VGj5NKMg/[email protected]> Wed, 31 Dec 2025 13:30:37 +1100
Newsgroups gmane.comp.lang.as400.c
Message-ID <[email protected]>
Hi Patrik,

To cause the system to consider a job has "aborted", and thus produce a
joblog spool file, the job must send an *ESCAPE type message with a severity
*GE to the End severity on the *JOBD used to submit that job (Img-1).

Note: The escape msg must be sent to the subsystem routing PGM, usually
QCMD. (see Img-2)  If you have a "non-standard" *SBSD with your own routing
PGM, then you will have to see how that considers a job to have aborted.

If you're not familiar with sending messages, ref: Send Program Message
(QMHSNDPM) API

HTH

Robert

And happy new year

 



 

 



 

-----Original Message-----
From: C400-L <[email protected]> On Behalf Of Patrik
Schindler
Sent: Monday, 29 December 2025 9:18 AM
To: Bare Metal Programming IBM i (AS/400 and iSeries)
<[email protected]>
Subject: [C400-L] return() and retain job log

 

Hello,

 

when a batch job fails, the job log is not deleted but retained as spooled
file.

 

I would have expected that when I submit a C program to batch and it returns
with != 0, the batch job would be indicated to have failed. This is not the
case.

 

What would be the correct way to indicate failure from a C program to the
operating system, so the job log (with possibly contained debug output from
Qp0zLprintf) isn't discarded?

 

A typical "batch job failed" condition occurs when e. g. a syntax error
prevents batch mode compilation of a program. The job log is retained then.

 

I assume the needle is deeply buried in the haystack of the Job Management
PDF, but I fail to see it.

 

Thanks for hints towards a solution!

 

:wq! PoC

 

--

This is the Bare Metal Programming IBM i (AS/400 and iSeries) (C400-L)
mailing list To post a message email:  <mailto:[email protected]>
[email protected] To subscribe, unsubscribe, or change list options,

visit:  <https://lists.midrange.com/mailman/listinfo/c400-l>
https://lists.midrange.com/mailman/listinfo/c400-l

or email:  <mailto:[email protected]>
[email protected] Before posting, please take a moment to
review the archives at  <https://archive.midrange.com/c400-l>
https://archive.midrange.com/c400-l.

-- 
This is the Bare Metal Programming IBM i (AS/400 and iSeries) (C400-L) mailing list
To post a message email: [email protected]
To subscribe, unsubscribe, or change list options,
visit: https://lists.midrange.com/mailman/listinfo/c400-l
or email: [email protected]
Before posting, please take a moment to review the archives
at https://archive.midrange.com/c400-l.