CL Programming


Defining Messages

On the iSeries server, communication between procedures or programs, between jobs, between users, and between users and procedures or programs occurs through messages. A message can be predefined or immediate:

Your system comes with an extensive set of predefined messages that allow communication between programs within the system and between the system and its users. Each licensed program you order has a message file that is stored in the same library as the licensed program it applies to. For example, system messages are stored in the file QCPFMSG in the library QSYS.

The system uniquely identifies each predefined message in a message file by a 7-character code and defines it by a message description. The message description contains information, such as message text and message help text, severity level, valid and default reply values, and various other attributes. See the Add Message Description (ADDMSGD) command description in online help, or in the CL section of the Programming category in the iSeries Information Center.

All messages that are sent or received in the system are transmitted through a message queue. Messages that are issued in response to a direct request, such as a command, are automatically displayed on the display from which the request was made. For all other messages, the user, program or procedure must receive the message from the queue or display it. There are several IBM-supplied message queues in the system; these message queues are described later in this chapter (see Types of Message Queues).

The system also writes some of the messages that are issued to logs. A job log contains information related to requests entered for a job, the history log contains job, subsystem, and device status information. See Message Logging for more information on logging.

You can create your own message files and message descriptions. By creating predefined messages, you can use the same message in several procedures or programs but define it only once. You can also change and translate predefined messages into languages other than English (based on the user viewing the messages) without affecting the procedures and programs that use them. If the messages were defined in the procedure or program, the module or program would have to be recompiled when you change the messages.

In addition to creating your own messages and message files, the system message handling function allows you to:

When a message is sent, it is defined as one of the following types:

This chapter describes:


[ Top of Page | Previous Page | Next Page | Table of Contents | Index ]