Messages are used to communicate between users and programs.

On the IBM® i operating system, communication between procedures or programs, between jobs, between users, and between users and procedures or programs occurs through messages. Messages can be sent:

  • From one system user to another system user, even if the receiver of the messages is not currently using the system
  • From one original program model (OPM) program or Integrated Language Environment® (ILE) procedure to another OPM program or ILE procedure
  • From a program or procedure to a system user, even if the receiver of the messages is not currently using the system

A message can be predefined or immediate:

  • A predefined message is created and exists outside the program that uses it. Predefined messages are stored in message files and have a message number. An example of a system predefined message is:
    CPF0006  Errors occurred in command.
  • An immediate message is created by the sender at the time it is sent. An immediate message is not stored in a message file. An example of an immediate message received at a display station is:
    From  . . . :   QSYSOPR      06/12/05   10:50:54
    System going down at 11:00; please sign off

Interactive system users can send only immediate messages and replies.

OPM programs or ILE procedures can send immediate messages or predefined messages with user-defined data. In addition, programs or procedures can:

  • Receive messages
  • Retrieve a message description from a message file and place it into a program variable
  • Remove messages from a message queue
  • Monitor for messages

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.

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.

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.