Displaying Messages

The following steps explain how to add logic to the procedure division file to display a message for an online form.

To display a message on the form

  1. Move the message category to CRT-ERROR-CAT. This line is optional. CRT-ERROR-CAT defaults to the program code if you do not move a value to it.
  2. Move the message number from the system message file to CRT-ERROR-NBR.

    For more information, see Doc for Developers: Application Development Workbench.

  3. Move the field number (-FN) of the field you want the cursor placed on to CRT-FIELD-NBR.

    In the following example, the form displays the message for message number 101 and puts the cursor on the GL20F2-GLM-ACCT-UNIT field. The form then waits for further input from the user.

    080000     PERFORM 840-FIND-GLNSET1.
    080100     IF (GLNAMES-NOTFOUND)
    080200         MOVE "GL20"                  TO CRT-ERROR-CAT
    080300         MOVE 101                     TO CRT-ERROR-NBR
    080400         MOVE GL20F2-GLM-ACCT-UNIT-FN TO CRT-FIELD-NBR
    080500         GO TO 210-END.