MESSAGE Depending on which syntax format you choose, MESSAGE performs one of the following tasks: o Puts the characters you specify into the message buffer if there is one. By default, DECTPU looks for a buffer named MESSAGE_BUFFER. Otherwise, the message is displayed at the current location on the device defined by SYS$OUTPUT (usually your terminal). o Fetches text associated with a message code and formats the text using FAO directives. The resulting text is put in the MESSAGE_BUFFER or, if now such buffer is present, is displayed on the device defined by SYS$OUTPUT. Syntax MESSAGE ({buffer | range | string} [, integer1]) OR MESSAGE ({keyword | integer2} [, integer3 [, FAO parameters]]) Parameters buffer A buffer whose contents you want displayed in the message area. range A range whose contents you want displayed in the message area. string A string to be displayed in the message area. integer1 An integer indicating the severity of the message placed in the message buffer. The allowable values and their meanings are as follows: Integer Meaning ----------------- 0 Warning 1 Success 2 Error 3 Informational keyword The DECTPU keyword representing the message code associated with the text to be fetched. integer2 The integer representing the message code associated with the text to be fetched. integer3 A bit-encoded integer controlling which portions of the message are fetched. If the message flags are not specified, or if the value of a message flag is set to zero, then the value specified by the SET (MESSAGE_FLAGS...) built-in is used. The meanings of the message flags are as follows: Bit DECTPU Constant Meaning ----------------------------------------------------------- 0 TPU$K_MESSAGE_TEXT Include text of message 1 TPU$K_MESSAGE_ID Include message identifier 2 TPU$K_MESSAGE_SEVERITY Include severity level indicator 3 TPU$K_MESSAGE_FACILITY Include facility name FAO parameters Strings and integers to be substituted into the text associated with the message code. The message code is specified by the first parameter. FAO directives for substituting strings and integers are provided within the message text. A maximum of 127 FAO parameters are allowed. For a description of the FAO directives, see the VMS System Services Reference Manual. For more information on the FAO built-in in DECTPU, see the description of that built-in in Chapter 4 of the DEC Text Processing Utility Manual. Comments The first syntax format puts the specified characters in the message buffer if one exists. If the message buffer is not associated with a message window, messages are written to the buffer but do not appear on the screen. The second syntax format causes DECTPU to fetch the text associated with a message code, format the text using FAO directives, and display the formatted message in the message buffer. The difference between this operation and the operation performed by MESSAGE_TEXT is that MESSAGE_TEXT simply returns the resulting string, while MESSAGE places the string in the message buffer. Examples 1. MESSAGE ("Nevermore!"); Writes the text "Nevermore!" in the message area. 2. The following procedure checks if the cursor is at the end of a line and writes the appropriate message: PROCEDURE user_test_eol the_mark := MARK (FREE_CURSOR); IF LENGTH (CURRENT_LINE = GET_INFO (the_mark, "offset") THEN user_at_eol := 1; ! yes -- return true MESSAGE ("Cursor is at the end of the line."); ELSE user_at_eol := 0; ! no -- return false MESSAGE ("Cursor not the at end of a line."); ENDIF; ENDPROCEDURE; 3. The following statement fetches the text associated with the message code TPU$_OPENIN and substitutes the string "FOO.BAR" into the message. All of the text of the message is fetched. The string "Error opening FOO.BAR as input" is displayed in the message buffer. MESSAGE (tpu$_openin, TPU$K_MESSAGE_TEXT, "FOO.BAR"); Related Topics MESSAGE_TEXT FAO