Re: return() and retain job log

<rob-VGj5NKMg/[email protected]> Fri, 2 Jan 2026 14:19:22 +1100
Newsgroups gmane.comp.lang.as400.c
Message-ID <[email protected]>
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 <[email protected]> On Behalf Of
rob-VGj5NKMg/[email protected]
Sent: Friday, 2 January 2026 2:05 PM
To: 'Bare Metal Programming IBM i (AS/400 and iSeries)'
<[email protected]>
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 <[email protected]> On Behalf Of Patrik
Schindler
Sent: Friday, 2 January 2026 1:42 AM
To: Bare Metal Programming IBM i (AS/400 and iSeries)
<[email protected]>
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-VGj5NKMg/[email protected]:

> 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: [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.

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

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