Defining Messages

The Message Definition utility (msgmnt) lets you define messages used to process errors and information in online and batch programs. You can define a message for a specific product line and program, or you can define a message that is global to the product line (independent of the program).

To define a message

  1. On the Program Definition form, press Define (F6) and choose Messages. (Skip step 2.)

    - or -

    On the Program Definition form, press Action (F4) and choose Transfer.

    - or -

    From the Environment Utilities or Application Development Workbench menu, choose Programmer Utilities, then Program Maintenance Tools.

    - or -

    At the command prompt type msgmnt (Skip step 2).

  2. Choose Message Definition.
  3. On the Message Definition form, fill in the fields as described in the following table.
    In this field Type or Select (F4)
    Product Line The product line for which you want to define messages.
    Category

    The category (for example, program code or system) for which you want to define messages.

    When you enter a category, the system displays the numbers (100–999) and their corresponding messages for the selected product line or category.

    If you leave this field blank, the system displays the messages that are global to the product line. Global numbers range from 1 to 99.

    Number The message number.
    Xlate Whether the message is flagged for translation. The default is Yes. You use this flag in conjunction with the Dump Application Messages (dmpappmsg) and Load Application Messages (ldappmsg) utilities to control whether you dump or load translatable messages.
    Message

    Up to 60 characters of message text. To indicate a variable, use an integer inside curly brackets—for example, {0}, {1}, and so on. You can use up to five variables, {0} to {4}.

    Note:  Important The 60-character limit applies to the length of the message text plus the length of the text the variables translate to.
  4. Press OK twice.

The following example of message text (typed in the Message field) produces a message that inserts the employee number, employee name, company number, and company name.

Employee {0} {1} works at {2} [3} company.

To implement this message, EM101PD must contain the following lines of code:

MOVE "EM101"                              TO CRT-ERROR-CAT.
MOVE EMP-NUM                              TO CRT-ERR-VAR1.
MOVE EMP-LASTNAME                         TO CRT-ERR-VAR2.
MOVE EMP-COMNUM                           TO CRT-ERR-VAR3.
MOVE EMP-COMNAME                          TO CRT-ERR-VAR4.
MOVE 20                                   TO CRT-MSG-NBR.
PERFORM 780-PRINT-MSG.

The following message appears for employee 1934, last name of Smith at company number 53892, which is ACME Shoelaces.

Employee 1934 SMITH works at 53892 ACME Shoelaces company.