110 pts.
 Writing system errors to QPJOBLOG system file
Ped wrote in with this question recently: "From an ILE-C program, how do I code to write 'system errors' to the QPJOBLOG system file?" Can you help him out? -- Michelle Davidson, editor, Search400.com

Software/Hardware used:
ASKED: November 14, 2005  9:25 PM
UPDATED: November 20, 2009  6:09 AM

Answer Wiki:
first, I assume you ask about QPJOBLOG job spool, I don't know qpjoblog as system file. If true, you have to send a message to the caller with the api QMHSNDPM. it is documented on ibm infocenter. I have samples, but in RPG. If interested, look at http://jplamontre.free.fr/AS400/JP4INC-RPGLE.TXT and search DIE, it's a procedure that send to caller a message for aborted current program
Last Wiki Answer Submitted:  November 15, 2005  1:55 am  by  JPLamontre   0 pts.
All Answer Wiki Contributors:  JPLamontre   0 pts.
To see all answers submitted to the Answer Wiki: View Answer History.


Discuss This Question:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _


 

You can write to the joblog using the system API “Qp0zLprintf” (documented within the Inforcenter).

I have a sub-procedure that I use (WrtJoblog) which encapsulates a call to this API and can be called from any ILE program. I also have a command front end for a CL program that calls the sub-procedure so I can write messages to the job log at will.

If you want the source for the procedure, prototypes, commands, etc, let me know and I’ll send it off list.

Jonathan

 370 pts.

 

It’s not clear what the situation is.

If it’s a “system error”, how are you detecting it? If it’s an error that occurs in your program, all you should need to do is not handle it — it will be handled by a default handler and propagate up to the job’s external message queue, which is what the “job log” is.

If it’s an error that is returned in an error structure from an API, then you’ll need to send it as a message if you want it logged. The short story is simply that you’ll send a program message to the *EXT program message queue. See the Send Program Message (QMHSNDPM) API for details. And note that you’ll probably want to send it as a *DIAG message.

Tom

 109,995 pts.