I spent thirty-seven years at one workplace, using the AS/400 throughout that time. Yet I never used subfiles there.

A subfile is an IBM i screen mechanism for displaying a list of records, such as search results.[1]

I have plenty of AS/400 experience. With subfiles, though, I still have experience to gain.

This time, I was working on displaying a product name in a subfile.

The screen shows twelve records at a time. On the second record of page two, the user enters a product code and returns control to the RPG program. The program looks up the product name and displays it on that row.

When it displays the list again, I want it to stay on page two.

Besides filling in the product name, I needed to think about our place in the list when the screen returned.

Updating the contents and deciding where to display them from are two things to consider separately.

First, the second row on the screen is not necessarily the second record in the whole list.

In a simple example showing twelve records per page from the beginning:

PositionRecord number within the subfile
First record on page two13
Second record on page two14

That position within the subfile is its relative record number, or RRN. It is separate from the product code.

The SFLRCDNBR keyword selects the page containing a specified RRN. With *TOP, the specified record becomes the first displayed record.[2]

So, in this example, making record 13 the first displayed record means passing 13 in the field defined with SFLRCDNBR(*TOP).

To obtain the current top position, there is also SFLSCROLL. When Enter returns control to the program, it returns the RRN at the top of the displayed subfile. That value can be used to position the next display.[3]

Which row needs its product name filled in? Which row should appear at the top of the screen?

They concern the same list, but they are slightly different pieces of information to retain.

This explanation assumes a subfile already loaded with multiple pages of records. If the contents are replaced or reordered, the saved position needs checking against the current list.

That is the display-position mechanism I wanted to organise in my mind again.

A product name appears beside the code the user entered. They can continue entering data on the same page. I want that sequence to feel natural to the person using the screen.

It is a small detail, but being able to carry straight on deserves attention when designing a screen.

I had set out to fill in a product name. The first thing that needed filling out turned out to be my experience with subfiles.

References

[1] IBM i 7.5: SFL keyword
[2] IBM i 7.5: SFLRCDNBR keyword
[3] IBM i 7.5: SFLSCROLL keyword

Sources checked on October 15, 2026. This is an explanation of the mechanism, not a report of a completed change tested on an IBM i system.

WRITTEN BYYoshio Taki

IBM i / AS/400 System Engineer