SFLMSG (Subfile Message) and SFLMSGID (Subfile Message Identifier) keywords for display files

You use these record-level keywords on the subfile-control record format to identify a message to be displayed on the message line when your program performs an output operation to the subfile-control record format.

Your program has the responsibility to reverse the images of any fields and to position the cursor appropriately in the subfile being displayed.

The formats of the keywords are:
SFLMSG('message-text' [response-indicator])
SFLMSGID(msgid [library-name/]msg-file [response-indicator] [&msg-data])

SFLMSG keyword

Specify SFLMSG as you do the ERRMSG keyword. The parameters specify a message text and, optionally, a response indicator. The message text is the message to be displayed.

If you specify a response indicator, it should be the same as the option indicator used to condition SFLMSG. On the input operation that follows the display of the error message, the IBM® i operating system turns off the indicator. If the response and option indicators are the same, they are both turned off. One exception to this rule is that if the response indicator is also specified for another keyword, such as CHANGE, CAnn, or CFnn, the on/off setting of the response indicator is based on the results of the function provided by the CHANGE or CFnn keyword.

When a response indicator is specified, the first 50 characters of the message text are also used as indicator text. Separate response indicator text is not valid for SFLMSG.

SFLMSGID keyword

Specify SFLMSGID as you do the ERRMSGID keyword.

For SFLMSGID, the parameters specify:
  • The message identifier for the message to be displayed
  • The message file and, optionally, the library
  • A response indicator
  • A msg-data field name

The response indicator, if specified, should be the same as the option indicator used to condition the SFLMSGID keyword. On the subsequent input operation, after the display of the error message, the IBM i operating system turns off the indicator. However, if the response indicator is also specified on another keyword, such as CHANGE, CAnn, or CFnn, the on/off setting of the response indicator is based on the results of the function provided by the CHANGE, CAnn, or CFnn keyword.

Note: Indicator text cannot be specified on the SFLMSGID keyword.

The msg-data field, if specified, contains the replacement text for the specified message. The field must exist in the record format, and the field must be defined as a character field (data type A) with usage P. For more information about how replacement text works, see the Send Program Message (SNDPGMMSG) command.

Conditions occurring during message display

The display of messages using SFLMSG and SFLMSGID is similar to the display of messages by the IBM i operating system when field validation errors are detected. An important difference from ERRMSG and ERRMSGID is that the program, and not the IBM i operating system, must position the cursor to the appropriate field within the subfile, reverse the image of that field within the subfile, and also optionally reverse the image of more than one field at a time. On the 5250 workstation, blinking cursor and message highlighting are allowed.

Note: The SFLDSP keyword must be in effect for SFLMSG and SFLMSGID to be processed.

Restoration of reversed image fields

See the Restoration of reversed image fields section in ERRMSG (Error Message) and ERRMSGID (Error Message Identifier) keywords for display files.

Priority among selected keywords

You can specify either SFLMSG or SFLMSGID several times for a single subfile-control record format. In your program, set option indicators to select a particular message to be displayed and to select particular fields to be displayed in reverse image. Several fields can be displayed in reverse image in different records of a subfile when the subfile is displayed again. However, only one message can be displayed at one time.

If more than one error message is selected at a time, the IBM i operating system displays the first of the following keywords:

  1. ERRMSG (If more than one ERRMSG keyword is selected, the first one selected is displayed.)
  2. ERRMSGID (If more than one ERRMSGID keyword is selected, the first one selected is displayed.)
  3. SFLMSG (If more than one SFLMSG keyword is selected, the first one selected is displayed.)
  4. SFLMSGID (If more than one SFLMSGID keyword is selected, the first one selected is displayed.)
  5. Message fields (M in position 38) (If more than one message field is selected, the first one selected is displayed.)

Multiple subfile messages (SFLMSG and SFLMSGID) are allowed on error subfiles.

Option indicators are valid for these keywords.

Example

The following example shows how to specify the SFLMSG and SFLMSGID keywords.

|...+....1....+....2....+....3....+....4....+....5....+....6....+....7....+....8
00010A          R SFLR                      SFL
00020A*
00030A*           (at least one displayable field)
00040A*
00050A          R SFLCTLR                   SFLCTL(SFLR)
00060A                                      SFLPAG(17)
00070A                                      SFLSIZ(17)
00080A                                      SFLDSP SFLDSPCTL
00090A  11                                  SFLMSGID(USR0006 PAYROLL/UMSGF1 +
00100A                                      11 &RPLTXT);
00110A  12                                  SFLMSGID(USR0007 PAYROLL/UMSGEF1 +
00120A                                      12 &RPLTXT);
00130A            RPLTXT        78A  P
     A