MESSAGE SUBFILE MADE EASY
Page 1 of 1
MESSAGE SUBFILE MADE EASY
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.
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.
Similar topics
» CMD Documention Made easy
» sflnxtchg - subfile next change
» MESSAGE FOR YOU
» Send Message to Job log
» Message & Message Queue
» sflnxtchg - subfile next change
» MESSAGE FOR YOU
» Send Message to Job log
» Message & Message Queue
Page 1 of 1
Permissions in this forum:
You cannot reply to topics in this forum