The midrange architecture has fast, sophisticated message handling facilities you may use to send and receive messages in your own HLL programs. You should take care to use messages in a manner consistent with the way OS/400 uses messages.
Messages should be used by programs to provide a constant dialogue, so that for each step that a user takes an error, a diagnostic or a completion message is given.
All program messages should be externally defined, and retrieved at run time from the system application message file. Using external messages gives you:
Note: The OS/400 message severity conventions should be followed.
For more information, refer to the AS/400 CL Programmers Guide.
As far as possible, make use of existing OS/400 messages—doing so reduces the amount of work you have to do, both in specification and to translate message text into other national languages. Programs should trap and resend the messages they receive.

If you need the diagnostic messages to appear as well on the calling programs queue, you can use the V2R2 QMHMOVPM API.

Message substitution variables should be used where helpful—they can be particularly useful in conjunction with input capable subfiles, as the variables can be used to distinguish which line in the subfile is in error. For example, on a subfile panel that shows many products, ‘Product code &1 not found’ (where &1 is the missing product) will be more useful than just ‘Product code not found’.
Add message:

Use in program:

| Copyright © 2011 CA. All rights reserved. | Tell Technical Publications how we can improve this information |