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 <c400-l-bounces@xxxxxxxxxxxxxxxxxx> On Behalf Of Patrik
Schindler
Sent: Monday, 29 December 2025 9:18 AM
To: Bare Metal Programming IBM i (AS/400 and iSeries)
<c400-l@xxxxxxxxxxxxxxxxxx>
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:C400-L@xxxxxxxxxxxxxxxxxx>
C400-L@xxxxxxxxxxxxxxxxxx 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:C400-L-request@xxxxxxxxxxxxxxxxxx>
C400-L-request@xxxxxxxxxxxxxxxxxx Before posting, please take a moment to
review the archives at <https://archive.midrange.com/c400-l>
https://archive.midrange.com/c400-l.


As an Amazon Associate we earn from qualifying purchases.

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.