SFLCLR (Subfile Clear) keyword for display files

You use this record-level keyword on the subfile-control record format so that your program can clear the subfile of all records. This keyword differs from the SFLDLT keyword in that the subfile is not deleted.

It differs from the SFLINZ keyword in that after being cleared, the subfile contains no data. Clearing the subfile does not affect the display. However, after being cleared, the subfile contains no active records.

This keyword has no parameters.

When active records already exist in the subfile and all are to be replaced, your program can send an output operation to the subfile-control record format after selecting SFLCLR. This clears the subfile and permits your program to write new records to the subfile (by issuing output operations to the subfile record format while incrementing the relative record number). Issuing an output operation to an already active subfile record causes an error message to be returned to your program.

If SFLCLR is in effect on an output operation and no records exist in the subfile, SFLCLR is ignored.

This optional keyword is valid only for the subfile-control record format. Display size condition names are not valid for this keyword.

An option indicator is required for this keyword to prevent the IBM® i operating system from clearing the subfile on every output operation to the subfile-control record format.

Example

The following example shows how to specify the SFLCLR keyword.

|...+....1....+....2....+....3....+....4....+....5....+....6....+....7....+....8
00010A          R SFLR                      SFL
     A*
     A*            (at least one displayable field)
     A*
00020A          R SFLCTLR                   SFLCTL(SFLR)
00030A                                      SFLPAG(17)
00040A                                      SFLSIZ(17)
00050A  01                                  SFLDSP
00060A  01                                  SFLDSPCTL
00070A N01                                  SFLCLR
     A

The subfile is displayed when option indicator 01 is set on for an output operation to SFLCTLR, and the subfile is cleared when option indicator 01 is set off for an output operation to SFLCTLR. Normally, the option indicators specified for SFLCLR are the reverse of the option indicators specified for the SFLDSP and SFLDSPCTL keywords.