Q
Problem solve Get help with specific problems with your technologies, process and projects.

What happening to my subfile?

I am writing a program using subfiles. My subfile is doing something strange. When I call the program it displays on the last page of records in the subfile. I need it to display from the first record it finds down. I assume this can be corrected easily, but I can't find the answer.

I am writing a program using subfiles. My subfile is doing something strange. When I call the program it displays on the last page of records in the subfile. I need it to display from the first record it finds down. I assume this can be corrected easily, but I can't find the answer.
When you load a subfile, the field you specified as the subfile record number field...

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

Dig Deeper on Debugging

Have a question for an expert?

Please add a title for your question

Get answers from a TechTarget expert on whatever's puzzling you.

You will be able to add details on the next page.

Start the conversation

Send me notifications when other members comment.

Please create a username to comment.

-ADS BY GOOGLE

SearchDataCenter

Close