iSeries *MSGW error message capture

115 pts.
Tags:
AS/400
AS/400 jobs
MSGW
MSGW status
Is there a way to capture the actual error msg or msg number (i.e. CPF4128) for a job that is in *MSGW status. I have captured the job name/user/job number and just need to get the message text.

Software/Hardware used:
AS400 V6

Answer Wiki

Thanks. We'll let you know when a new response is added.

The first step must be determining the cause of the *MSGW status because that status can arise from two different conditions.

  • A job may send a message that requires a response.
  • A job may issue RCVMSG (or call the QMHRCVM API) against a non-program message queue.

Both of those will put the job in *MSGW, but you should only be interested in the first condition. You need to know when to ignore the second condition.

Further, even for the first condition, there won’t necessarily a useful MessageID. It might simply be an impromptu message:

SNDUSRMSG MSG('Enter some reply (y/N)?') VALUES(Y N)
MSGRPY(&REPLY)

From a batch program, that would show CPA2401in QSYSOPR (or whatever message queue was assigned.) It would also show CPA2401 as the ‘sender copy’ in the joblog of the batch job.

In general, you would use the List Job Log Messages (QMHLJOBL) API to see what messages have been sent within a job. You would need to use the Open List of Job Log Messages (QGYOLJBL) API (and the associated Process Open List APIs) if the joblog messages exceeded a user space limit.

You first find a job in MSGW status. You then run through its messages to see if the MSGW status came because of an *INQ (Inquiry) message. That means that an *INQ has been sent but not yet replied to. (You need to skip over and ignore any that have previously been answered.) If no unanswered *INQ messages exist, then it’s not a MSGW job that you’re interested in.

When you find an unanswered *INQ message, you’ll be able to extract the related message identifier. Be aware that the message might have been answered between the time you resolved the joblog messages and the time you located a message of interest to you.

These are not trivial APIs. If you run into specific problems, it will be best to create a new question and include code for comment.

Tom

Discuss This Question: 3  Replies

 
There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy
  • bvining
    If you know the job that is waiting on a message then the Retrieve Job Information (QUSRJOBI) API, using format JOBI0200, will give you the message key of the message being waited on. With message handler APIs, and this key, you can determine the message ID (along with a lot of other things). The Retrieve Job Information API is documented here and the message handler APIs available to you here. Bruce Vining
    6,540 pointsBadges:
    report
  • TomLiotta
    Bruce! Wow! Great update! I wish I'd seen that V5R4 update a couple years ago, but you can bet that it won't be forgotten. Thanks much! Tom
    125,585 pointsBadges:
    report
  • TomLiotta
    I wish I’d seen that V5R4 update... Correction -- it's V6R1. I was sure that I saw it in V5R4 info at the time that I looked previously, but it's documented starting at V6R1 now. I must have misread earlier. Tom
    125,585 pointsBadges:
    report

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Thanks! We'll email you when relevant content is added and updated.

Following