Expanding subfile in OS/400

1150 pts.
Tags:
IBM iSeries
iseries v5r4
OS/400
RPGLE
HI, I am doing a small program on expanding subfile(page forward). ITs working fine till display. BUt if I press the page down till the last page its fine,after that too (last page is shown) if i press pagedown the last record is getting added again and again and so the subfile size is getting expanded even the end of file is displayed.Plz tell me where i am wrong. thanks

Software/Hardware used:
os/400,V5 R4

Answer Wiki

Thanks. We'll let you know when a new response is added.

When you are done adding records to the subfile you need to tell the subfile you are done adding records to it. You do this by specifying the SFLEND keyword on the SFLCTL record of the display file with an indicator. You would then turn on the indicator specified on the SFLEND keyword.

The subfiles I write I usually put the SFLEND indicator on the read operation so when I reach the end of the file it automatically turns on the SFLEND keyword.

DSPF:

A R SFLCTL SFLCTL(SFL)
A SFLSIZ(0016)
A SFLPAG(0015)
A 51 SFLDSP
A N55 SFLDSPCTL
A 55 SFLCLR
A 56 SFLEND(*MORE)

RPG program:

READ SOMEFILE 56

Discuss This Question: 5  Replies

 
There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy
  • TomLiotta
    The SFLEND keyword on the subfile control record is how your program tells the operating system whether or not there are more records available for the subfile. When you write the subfile control record with SFLEND enabled, the OS knows that you have written the last record to the subfile. Because of that, the OS also knows that the user should not be allowed to scroll down any farther. If you never send a signal to the OS that you're done building the subfile, it will keep returning to your program to get more records. And if your program keeps writing subfile records, they will continue being displayed on new pages. You reached end-of-file on your input file, so you can't read any new records. But the values from the last record are still in the I/O buffer. Those same values are being copied into new subfile records over and over again. So, first, signal the OS with SFLEND when you are done adding records to the subfile. The OS will stop asking for more subfile pages. And second, stop writing subfile records after you've reached end-of-file on your input file. No more copies of the last record will be written to subfile records. Tom
    125,585 pointsBadges:
    report
  • philpl1jb
    I would put a conditioning indicator on the PageDn or RollUp key so that it is inactive when all the records are in the subfile. With that inactive DDS will respond to the page down key with a bottom of page message instead of returning to the RPG program. Phil
    50,185 pointsBadges:
    report
  • philpl1jb
    Add also the SFLEND discussed by Tom and Krethan. Phil
    50,185 pointsBadges:
    report
  • TomLiotta
    I would put a conditioning indicator on the PageDn or RollUp key so that it is inactive when all the records are in the subfile. That might need a little clarification. As long as subfile records exist on a page other than the current page shown on the display, the Page/Roll keys are "active" regardless of the existence of the keywords or the state of a conditioning indicator. E.g., if there is a second page and the subfile is displaying page 1, you can't stop the user from scrolling to page 2. The only effects are at the top or ottom of a subfile. The presence or absence of the keywords (or alternatively, the state of a conditioning indicator) determines whether the OS displays an error message or returns control to the program. In combination with SFLEND, the keywords are what returns control to the program to allow generating a new subfile page. That's why SFLEND and PageDown should have opposite indicator states. The indicator can be set on to signal the OS that the end of the subfile has been reached, and the opposite state then disables the PageDown key. So the user presses PageDown at end-of-subfile and the "End of subfile" message is displayed rather than control returning to the program for a new page. The program already knows that no more pages can be created, so it doesn't want control. Tom
    125,585 pointsBadges:
    report
  • Krethan
    I agree that disabling the page down and up keys after the subfile has been ended. OS/400 will not pass control back to the RPG program when there is no need.
    25 pointsBadges:
    report

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Thanks! We'll email you when relevant content is added and updated.

Following