DSPATR (Display Attribute) Keyword for Display Files--Examples

Figure 142 shows how to specify the DSPATR(SP) keyword with an input-only field (showing the recommended data contents as a character string).

Figure 142. Specifying the DSPATR(SP) Keyword with Input-Only Field

|...+....1....+....2....+....3....+....4....+....5....+....6....+....7....+....8
00110A            SPFLD         50I  I  5  4'? * OPTION 1'
00120A                                      DSPATR(SP)
     A

No data can be typed into field SPFLD. When the field is selected with the light pen, the data returned in field SPFLD would be:

>_*_OPTION_1

where _ represents a blank.

Figure 143 shows that when the work station user selects a field with the light pen, both the MDT bit and the first character of that field are changed. When the field is selected, the MDT bit is set on, changing the first character of the field to >. If the same field is selected again, the MDT bit is set off and the first character becomes ?.

By specifying a switch character, your program prevents the first character of data from being changed to > or ? when the field is selected by the light pen. If the MDT bit is on when your program sends an input operation to the record format, the contents of the field are returned to your program as a user-changed field.

If you use DSPATR(MDT) to set on the MDT of a field that can be selected by the light pen, then you should either omit the MDTOFF keyword from other record formats or you should read that field before displaying any record format with MDTOFF in effect.

Figure 143 shows what could happen.

Figure 143. Specifying the DSPATR(MDT) Keyword to Set on a Field for Selection by Light Pen

|...+....1....+....2....+....3....+....4....+....5....+....6....+....7....+....8
00010A          R LIGHTPEN
00020A            FLD1          10   I  5  2'> * $12.50'
00030A                                      DSPATR(SP MDT)
00040A*
00050A          R RCD2                      OVERLAY MDTOFF
00060A            FLD1          10   B 11  2
     A

If the program displays LIGHTPEN, then displays RCD2, then reads LIGHTPEN, and the work station user does not select FLD1 with the light pen, the MDT of FLD1 is turned off by the display of RCD2.

Also, the switch character of FLD1 is returned as ?, even though the field was not selected, and the switch character appears as >. The MDT and the switch character are in opposing states.

Figure 144 shows how to specify the DSPATR keyword with P-field usage:

Figure 144. Specifying the DSPATR keyword with P-Fields

|...+....1....+....2....+....3....+....4....+....5....+....6....+....7....+....8
A          R RECORD                   2DSPATR(&PFLD1);
A            FLD1           5A     2  6DSPATR(&PFLD2);
A            FLD2           5A     2  6DSPATR(&PFLD2);
A            PFLD1          1A  P
A            PFLD2          1A  P
A