PMS Information Systems
Welcome to PMS Information Systems - IBM i (AS/400) Forum !!!

Get Answers for all your queries on IBM i (AS/400).

MESSAGE SUBFILE MADE EASY

View previous topic View next topic Go down

MESSAGE SUBFILE MADE EASY

Post  maran on Fri Dec 30, 2011 3:28 pm

Message subfiles are special subfiles designed to hold--you guessed it--messages.

Message subfiles have some unique properties that make them very useful.

They load themselves automatically from messages on a given program message queue.

Message subfiles also allow users to view the second-level help text associated with a message, without any additional programming effort.

Message subfiles make it possible to setup a consistent set of information, warning, or error messages in a message file for a given program or application, and to display those messages to the user with the greatest of ease.

How to implement the message subfile:

Set up a message file (*MSGF) containing the messages you want to use in your application. You can use an existing message file or create your own. You should not usually modify system-supplied message files, such as QCPFMSG. Message files are created with the CRTMSGF command. New messages can be added via the ADDMSGD command or the WRKMSGF command.

Define a message subfile in your display file.

Code your application program to send program messages to the program message queue. The best way to accomplish this in RPG is to use the QMHSNDPM (Send Program Message) API. You can also use the SNDPGMMSG command, but the best place to use that command is in a CL program.

After displaying the message subfile, clear the messages from the program message queue using the QMHRMVPM (Remove Program Message) API, use the command RMVMSG in a CL program

Note: For every call stack entry, which can be an OPM program or an ILE procedure, there exists a corresponding program message queue with the same name. This is important to know, especially when you start dealing with ILE and, potentially, multiple call stack entries. The good news is that you don't have to do any work to set up those queues. Just know that with ILE you have to know which call stack entry you are dealing with.

maran
Admin

Posts : 442
Join date : 2009-07-24

View user profile http://pmsinformationsystem.forumotion.net

Back to top Go down

View previous topic View next topic Back to top

- Similar topics

 
Permissions in this forum:
You cannot reply to topics in this forum