Note: the member QMHSNDPM in QSYSINC/H has the prototype for the call:

void QMHSNDPM (char *, /* Message identifier */
void *, /* Qualified message file name */
void *, /* Message data or text */
int, /* Length of message data or text */
char *, /* Message type */
void *, /* Call stack entry */
int, /* Call stack counter */
void *, /* Message key */
void *, /* Error code */

-----Original Message-----
From: C400-L <c400-l-bounces@xxxxxxxxxxxxxxxxxx> On Behalf Of
rob@xxxxxxxxxxxxx
Sent: Friday, 2 January 2026 2:05 PM
To: 'Bare Metal Programming IBM i (AS/400 and iSeries)'
<c400-l@xxxxxxxxxxxxxxxxxx>
Subject: Re: [C400-L] return() and retain job log

Hi Patrik,
I'm not a C programmer so I can't give an example in C, I just follow this
forum as every so often there's some interesting uses of APIs.
What I've done below is provide the values for each of the required
parameters that I would use.
HTH

Required Parameters Group:
1 Message identifier Input Char(7)
'CPF9898'
2 Qualified message file name Input Char(20)
'QCPFMSG *LIBL'
3 Message data or immediate text Input Char(*)
'any text you want to describe the error' (not null terminated)
4 Length of message data or immediate text Input Binary(4)
Length of above string
5 Message type Input Char(10)
'*ESCAPE'
6 Call stack entry Input Char(*) or Pointer
'*PGMBDY'
Note: I use this value so it will jump over all intermediate procedures to
the calling PGM boundary.
7 Call stack counter Input Binary(4)
1
8 Message key Output Char(4)
A 4 char variable to receive the message key of the message just sent,
though as this is an *ESCAPE msg, it will end your PGM at this point.
9 Error code I/O Char(*)
Standard API error structure

-----Original Message-----
From: C400-L <c400-l-bounces@xxxxxxxxxxxxxxxxxx> On Behalf Of Patrik
Schindler
Sent: Friday, 2 January 2026 1:42 AM
To: Bare Metal Programming IBM i (AS/400 and iSeries)
<c400-l@xxxxxxxxxxxxxxxxxx>
Subject: Re: [C400-L] return() and retain job log

Hello Robert,

images aren't passed through the list.


Am 31.12.2025 um 03:30 schrieb rob@xxxxxxxxxxxxx:

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).

Thanks. So the C style return value aren't honored.

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.

Thanks for the hint. The send pgm message API hat a lot of options, and I
have not yet achieved a comfortable level of understanding about messages.
But I'll try.

:wq! PoC


--
This is the Bare Metal Programming IBM i (AS/400 and iSeries) (C400-L)
mailing list To post a message email: C400-L@xxxxxxxxxxxxxxxxxx To
subscribe, unsubscribe, or change list options,
visit: https://lists.midrange.com/mailman/listinfo/c400-l
or email: C400-L-request@xxxxxxxxxxxxxxxxxx Before posting, please take a
moment to review the archives at 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: C400-L@xxxxxxxxxxxxxxxxxx To
subscribe, unsubscribe, or change list options,
visit: https://lists.midrange.com/mailman/listinfo/c400-l
or email: C400-L-request@xxxxxxxxxxxxxxxxxx Before posting, please take a
moment to review the archives at 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.