Message Numbers and Titles
Published By | Date | Version | Knowledge Level | Keywords |
---|---|---|---|---|
Revelation Technologies | 02 JUN 1991 | 2.1X | INTERMEDIATE | MESSAGES, SYS.MESSAGES, PAGED, MESSAGE |
By default, the messages posted by Advanced Revelation display the message number in the upper left hand portion of the border. Under some circumstances you may not want these numbers to display. You may also want to display a message that has a title in the border. This technical bulletin provides some ideas for achieving both of these objectives.
Message Numbers
Whenever Advanced Revelation displays a message whose template is stored in the MESSAGES or SYS.MESSAGES file, the subroutine adds the message template key into the border. This helps you identify the message number should you wish to edit the message.
There is no direct way to cause this message number to be suppressed. However, there are several methods you can try that indirectly cause the message template key to be left out. These are:
- Display the message as a paged message. This can be done as a permanent change or a dynamic one.
- Bypass the direct display of a message on file, and cause it instead to be displayed as if it were a custom message.
Paged Messages
A message type of "M" is displayed as a paged message. Paged messages do not display a message template key in the border.
Note: Paged messages are documented in Technical Bulletin #12.
A message type of "M" is a display-only message that is cleared when the user presses [Esc]. As such, it is a suitable substitute for the common "A" type message. However, you cannot use an "M" type message in place of a "UB", "R", or other message type that returns data such as a video image ("UB" type) or user response ("R" type).
To make a message a permanent "M"-type message, edit the message template record in the MESSAGES or SYS.MESSAGES file and change the first field to "M". A permanent change of this type is necessary if the message will be called by Advanced Revelation itself, which is the situation for most standard error messages (for example, error message 202).
If you are calling messages yourself by making calls to MSG, you can change the message type dynamically. Because the message type is the first attribute of the map argument, you can simply pass this as part of your message call. For example, to display error message 202 as an M-type message, use this syntax:
CALL MSG("202", "M", "", "CUSTOMERS")
Indirect display
When you call MSG with a custom message (that is, one that does not have a message template on file), no message template key is displayed in the border. Another method of suppressing the message template key, therefore, is to "fool" MSG into thinking that a standard system message is in fact custom message.
One way to do this is to trap the call to MSG, and then attempt to read the message record from the MESSAGES or SYS.MESSAGES file, just as MSG does. If the message is found in either of these places, you can in turn pass it as a literal to MSG, which will then display it without a message number. This is a straightforward process, as the message record can be passed as-is via the second argument.
An alternative message processor is illustrated in Figure 1. This routine accepts the same arguments as MSG, and attempts to find the message in the standard locations. If the message isn't found there, this routine assumes that the message key is a literal value, and passes it accordingly. If the message record is on file, the MSG_NO parameter is nulled out (to prevent MSG itself from finding the message record), and the message record passed as the map argument.
To take advantage of this routine, call it instead of calling MSG. For example, a code fragment in one of your programs might look like this:
OPEN 'CUSTOMERS' TO CUSTOMERS.FILE ELSE TEXT = '202' CALL MYMSG(TEXT,'','','') STOP END
The normal error message will display, but there will be no message number in the border.
Message Titles
You can change messages on file to display a title by adding one to the message template record. The eighth field contains information about the border type and the title, with the two attributes separated by a text mark (@TM). If you add a title to a message template record, you must also indicate your preference for a border type (1-5) – if you leave this attribute blank, there will be no border on the message.
You can add a title to a message on-the-fly, but only if you are passing a full message map when calling MSG. For example, this code displays the system message 202 with a title:
MAP = XLATE("SYS.MESSAGES", "202", "", "") MAP<8> = 1 : @TM : "Title" CALL MSG("", MAP, "", "")
Examples
Figure 1
SUBROUTINE MYMSG(MSG_NO,MAP,RESP,PARMS) SAVE_MAP = MAP MAP = XLATE("MESSAGES", MSG_NO, "", "X") IF MAP ELSE MAP = XLATE("SYS.MESSAGES", MSG_NO, "", "X") END IF MAP THEN MSG_NO = "" END ELSE MAP = SAVE_MAP END CALL MSG(MSG_NO, MAP, RESP, PARMS) RETURN