SFLSIZ (Subfile Size) keyword for display files

You use this record-level keyword on the subfile-control record format to specify the number of records in the subfile.

The maximum number of records allowed is 9999. This keyword is required for the subfile-control record format.

The format of the keyword is:
SFLSIZ(number-of-records-in-subfile | &number-of-records-in-subfile-field);

The number-of-records-in-subfile parameter can be specified in 2 ways; as a number or program-to-system field. The program-to-system field must be defined with a length of 5 and data type S.

P-fields can be used for the size of the subfile when using SFLEND with the *SCRBAR parameter. The application can communicate to the IBM® i operating system the number of records that the applications will be adding to the subfile. Therefore, the scroll bar can show a better picture of the subfile.

Note: The value for the p-field must be greater than the subfile page value. If the value of the p-field is not greater than the subfile page value, the size of the subfile will be page value plus one.

Subfile size equals subfile page

When you specify the same parameter values for SFLSIZ and the SFLPAG keyword, you can specify option indicators for fields in the subfile record format. (This is called field selection.)

When the subfile is built, the records can vary in length depending on which fields are selected, and each output operation places records into successive positions within the subfile. When the subfile is displayed, each record can require a different number of display lines. The number of records that actually fit in the subfile depends on the fields selected for each record written to the subfile.

If the last subfile record written to the subfile fits exactly into the subfile, a status message (CPF5003) is returned to your program. If the last subfile record written to the subfile overflows the subfile, a notify message (CPF5043) is returned to your program.

The specified SFLPAG value is increased to equal the maximum number of records that fit on the display if the number of subfile records to be displayed do not occupy a full display.

The SFLSIZ value is increased by the same value. For example, if SFLPAG(13) and SFLSIZ(13) are specified, and the subfile record format and SFLLIN value are specified such that three records can fit on a single display line, SFLPAG and SFLSIZ are increased to 15.

Option indicators are not valid for this keyword. Display size condition names are valid and are required if the number of records within the subfile changes depending on the display size. You cannot use display size condition names for this keyword when a program-to-system field is used as a parameter for it.

Subfile size does not equal subfile page

When you specify different parameter values for SFLPAG keyword and SFLSIZ, the SFLSIZ value specifies the number of records that can be placed into the subfile. If your program places a record with a relative record number larger than the SFLSIZ value into the subfile, the subfile is automatically extended to contain it (up to a maximum of 9999 records). The parameter value you specify should be large enough to accommodate the maximum number of records you normally have in the subfile.

Example

The following example shows how to specify the SFLSIZ keyword.

|...+....1....+....2....+....3....+....4....+....5....+....6....+....7....+....8
00010A          R SFLR                      SFL
00020A  21        FIELD1        78      2  2
00030A  22        FIELD2        40      3  2
00040A*
00050A          R SFLCTLR                   SFLCTL(SFLR)
00060A                                      SFLPAG(5)
00070A                                      SFLSIZ(5)
00080A                                      SFLDSP
00090A                                      SFLDSPCTL
     A

Your program issues the following output operations:

Output operation to Option indicators set Result
SFLR 21 on 22 off Only FIELD1 written to subfile
SFLR 21 on 22 on FIELD1 and FIELD2 written to subfile
SFLR 21 off 22 on Only FIELD2 written to subfile
(The IBM i operating system sends status message CPF5003 to your program.)    
SFLCTLR No indicator necessary Subfile displayed

The resulting display is as follows:

Figure 1. Subfile display
A figure of the display produced by the SFLSIZ example.

In Figure 1, a fourth record cannot be written to the subfile because there is no room on the display for it (SFLPAG(5) has been specified in the DDS).