A D1DRRN 4S 0H SFLRCDNBR
...is incremented as each record is loaded. This field needs to be set back to 1 once the subfile has been built, because the page that contains the record whose record number is in that field is the page that will be displayed first -- that's why you see the last page in the subfile.
This is a useful feature. When you read the subfile, you can set the SFLRCDNBR field to the RRN of the first record in error (for example), or to the RRN of the record at the top of the page the user was displaying when control returned to your program, which allows you to show the same page to the user when you return control back to the screen.
There are plenty of tutorials on subfiles. These are some I recommend:
Back to Basics: Introduction to Subfiles
Back to Basics: Self-Extending Subfiles
Become the Master of Your Subfile Domain
This was first published in February 2007