Previous Topic: Sending MessagesNext Topic: Sending a Message to Other Users


Sending a Message to the Current User

You can send a message predefined in the DDLDCMSG area of the dictionary to the current user, the log file, or both. The message definition can also specify other destinations (for example, the user's console). Additionally, the specified message indicates the action to be taken after the message is written; such action can include the following:

Retrieving Predefined Messages

One typical use for dictionary-defined messages is to retrieve predefined messages from the DDLDCMSG area rather than include all possible messages in program variable storage.

Messages stored in the dictionary can contain symbolic parameters. Symbolic parameters, identified by an ampersand (&). followed by a two-digit number, can appear in any order within the message. Symbolic parameters provide flexibility in message management.

Steps to Send a Predefined Message

To send a predefined message, perform the following steps:

  1. If you are using symbolic parameters, initialize the appropriate variable-storage locations.
  2. Issue a WRITE LOG statement that specifies the appropriate variable-storage locations for symbolic parameters, user reply, and message text.

Note: You can specify your own message prefix (to distinguish your messages from DC/UCF system messages) by using the MESSAGE PREFIX IS parameter on the WRITE LOG statement.

Example of Sending a Message from the Dictionary

The program excerpt below uses the following message from the DDLDCMSG area of the dictionary:

INPUT DATA IS IN ERROR; DATA FIELD: &01.  &02.

The symbolic parameters allow you to transmit more meaningful messages.

 DATA DIVISION.
 WORKING-STORAGE SECTION.
 01  SYMBOLIC-PARAMETERS.
   03 ERR-1.
     05 ERR-1-TEXT              PIC X(15).
     05 ERR-1-END               PIC X.
   03 ERR-2.
     05 ERR-2-TEXT              PIC X(15).
     05 ERR-2-END               PIC X.
   03 ERR-DEPT-ID               PIC X(6)    VALUE 'DEPT-ID'
   03 ERR-NONNUMERIC            PIC X(10)   VALUE 'NONNUMERIC'.
 01  MESSAGES.
     05 MESSAGE-AREA.           PIC X(80).
     05 MESSAGE-AREA-END        PIC X.
 PROCEDURE DIVISION.
     BIND MAP SOLICIT.
     BIND MAP SOLICIT RECORD SOLICIT-REC.
*
     MAP IN USING SOLICIT.
*** IF ERROR, INITIALIZE FIELDS FOR SYMBOLIC PARMS ***
     IF SOLICIT-DEPT-ID NOT NUMERIC
        THEN MOVE ERR-DEPT-ID TO ERR-TEXT-1
             MOVE ERR-NONNUMERIC TO ERR-TEXT-2
             GO TO SOLICIT-ERROR.
        .
        .
 SOLICIT-ERROR.
*** USE WRITE LOG STATEMENT TO COPY    ***
*** DICTIONARY MESSAGE WITH PARMS INTO ***
*** PROGRAM VARIABLE STORAGE           ***
     WRITE LOG MESSAGE ID 9001080
        PARMS FROM ERR-1 TO ERR-1-END
              FROM ERR-2 TO ERR-2-END
        TEXT INTO MESSAGE-AREA TO MESSAGE-AREA-END
         TEXT IS ONLY.
*** MAP OUT USING MESSAGE FROM DATA DICTIONARY ***
     MAP OUT USING SOLICIT
        MESSAGE IS MESSAGE-AREA TO MESSAGE-AREA-END.
     DC RETURN
        NEXT TASK CODE 'DEPTDIS'.