ERRSFL (Error Subfile) Keyword for Display Files--Example

Figure 165 shows how to specify the ERRSFL keyword.

Figure 165. Specifying the ERRSFL Keyword

|...+....1....+....2....+....3....+....4....+....5....+....6....+....7....+....8
00010A                                      MSGLOC(24)
00020A                                      ERRSFL
00030A          R RCD1
00040A            FIELD1        5A   B  2  3
00050A  10                                  ERRMSGID(MSG0001 MSGF1 10 &MDTA);
00060A            FIELD2        5A   B  5  7
00070A                                      ERRMSG('ERROR MSG 1' 11)
00080A            FIELD3        4S   I  7  7RANGE(1000 9999)
00090A                                      CHKMSGID(MSG0002 MSGF1 &MDTA1);
00100A            FIELD4       10A   B  8  7CHECK(VN)
00110A            MDTA         78A   P
00120A            MDTA1         4A   P
     A

In this example, when RCD1 is read from the display, any previous messages in the error subfile are cleared. Then, if FIELD3 does not contain a value in the range 1000 to 9999 and FIELD4 does not contain a valid name, the system places the message MSG0002 and the system message associated with CHECK(VN) in the error subfile and displays the error subfile on line 24 of the display. The user can view the messages by pressing the Page Up and Page Down keys.

When RCD1 is read again from the display, the previous messages in the error subfile are cleared. Then, if FIELD3 and FIELD4 are valid, control returns to the application. If FIELD1 and FIELD2 are not valid, when the application writes RCD1 to the display with indicators 10 and 11 on, the system places the message MSG0001 and the text ERROR MSG 1 in the error subfile and displays the error subfile on line 24 of the display. The user can view the messages by pressing the Page Up and Page Down keys.