SLNO (Starting Line Number) keyword for display files

You use this record-level keyword to specify a starting line number for the record format you are defining.

If specified, SLNO adjusts the actual line numbers for each field in the record format. If you do not specify SLNO, fields in the record format are displayed on the lines you specify for them in positions 39 through 41.

The format of the keyword is:
SLNO(n | *VAR)
You can specify one of two parameter values for this keyword:
  • Specify n, where n is a value between 1 and 27. All fields in the record format are offset n-1 lines down the display from their specified locations. If SLNO(1) is specified, the record format must not contain a field starting at line 1, position 1.
  • Specify *VAR to enable your program to set the starting line number at runtime before displaying the record format. At file creation time, the IBM® i program sets the starting line number to one. A warning message appears at file creation time if the record contains a field starting at line 1, position 1. If your program does not set the starting line number or sets it to zero, the IBM i operating system assumes its value is one. If your program sets the starting line number to a value such that the first field in the record format does not all fit on the display, or sets it to a negative value, the IBM i operating system sends a notify message (CPF5002) to your program, and the record is not displayed. If the starting line number is set to one and the record format contains a field starting at line 1, position 1, the IBM i operating system sends an error message (CPF5398) to your program. The record is not displayed.

    To calculate the line on which a field is actually displayed, subtract one from the line number specified in positions 39 through 41 and add the starting line number to the result. The record format begins on the line specified with SLNO unless a field is defined at line 1, position 1. In that case, the beginning attribute byte is in the last position of the previous line and the starting line of the format is one less than that specified by SLNO.

    When *VAR is specified, no field in the record can occupy the last position on the display.

If a CLRL(nn) or CLRL(*END) keyword is also in effect for this record when it is to be displayed, lines on the display are cleared beginning with the starting line number for the format.

If you use the SLNO(*VAR) keyword with the OVERLAY keyword but without the CLRL keyword and then write the record several times, each time with a different starting number, the previous record is deleted before the new record displays.

The IBM i program checks the starting line number to determine whether the previous output operation to the record had the same starting line number if you use the SLNO keyword with the following keywords:

ERRMSG
ERRMSGID
PUTOVR
PUTRETAIN

If the starting numbers are the same, the actions specified by the ERRMSG, ERRMSGID, PUTOVR, or the PUTRETAIN keyword is performed.

If the starting line numbers are not the same, the ERRMSG, ERRMSGID, PUTOVR, or PUTRETAIN keyword is ignored, and the record format displays with the lines adjusted to the new value.

The SLNO keyword is not allowed in a record format that has one of the following keywords specified:

ASSUME
KEEP
SFL
SFLCTL
USRDFN

SLNO cannot be specified for the record format specified by the PASSRCD keyword.

Option indicators are not valid for this keyword.

Example

The following example shows how to specify the SLNO keyword.

|...+....1....+....2....+....3....+....4....+....5....+....6....+....7....+....8
00010A          R RECORD1                   SLNO(*VAR)
00020A            FIELD1         5   I  2  2
00030A            FIELD2         5   B  3  2
00040A
00050A          R RECORD2                   SLNO(2)
00060A            FIELD3         5     10  2
00070A            FIELD4         5   B 10 13
     A

In this example, when the starting line number is zero or one, FIELD1 is displayed on line 2 and FIELD2 is displayed on line 3, as specified. When the starting line number is set to 2 in your program, FIELD1 is displayed on line 3 (2 - 1 + 2 = 3) and FIELD2 is displayed on line 4 (2 - 1 + 3 = 4).

FIELD3 and FIELD4 are always displayed on line 11 (2 - 1 + 10 = 11).