I have an application using a subfile that uses the sfldrop. On request, it drops down three lines of more detailed information for the user. The possible size of this subfile (over 9,999 records) has caused problems, we need to modify it one page at a time. The problem is we lose the sfldrop.
Without the sfldrop my subfile becomes very bulky and cumbersome for the user -- they see a lot more information then they need. How can we eliminate this problem and make it more efficient for the user.
First, use a self-extending subfile. In this type of subfile, you load a single page and display it. If the user presses Page Down (Roll Up), control returns to your program and you load the next page, adding to the data already in the subfile. SFLDROP works in this situation.
You can detect which state the subfile is in in your program, and which subfile RRN is first on the currently-displayed page. You can also detect which subfile RRN the cursor is on when control returns.
When you add a page of data, set the subfile RRN field to the RRN of the first record you added in the new page before redisplaying the screen. That will make the screen show the page containing that record - if the subfile is in drop-down mode, other values of the RRN may cause it to skip ahead one or more pages, which will confuse the user.
Lastly, 2,500 records is a lot in a subfile. No user is going to page that far. So look at putting in fields in the screen header to let the user select a subset of the data, so that he can 'home in' on the data he wants to see rather than having to page through loads of screens full to gather the data he wants.
This is the DDS for the subfile control record for a self-extending subfile with SFLDROP:
A R D@CSFC TEXT('Subfile control') A BLINK A SFLCTL(D@CSF) A SFLSIZ(5) A SFLPAG(4) A SFLDSPCTL A N40 SFLCLR A 40 SFLDSP A 40 SFLEND A N13 SFLFOLD(CF11) A 13 SFLDROP(CF11) A SFLMODE(&MODE) A SFLCSRRRN(&CRRN) A RTNCSRLOC(*WINDOW &CROW &CCOL) A RTNCSRLOC(*RECNAME &CREC &CFLD) A OVERLAY PUTOVR A D1DRRN 4S 0H SFLRCDNBR(CURSOR) A D1TRRN 5S 0H SFLSCROLL * Hidden fields for cursor location, subfile RRN and mode : A CREC 10 H TEXT('Cursor record') A CFLD 10 H TEXT('Cursor field') A CROW 3S 0H TEXT('Cursor row') A CCOL 3S 0H TEXT('Cursor column') A CRRN 5S 0H TEXT('Subfile cursor RRN') A MODE 1 H TEXT('Subfile mode')
Indicator 13 is used to force the subfile into the mode you want. It is switched in your program by function key F11.
Indicator 40 is used to clear or display the subfile.
The field MODE contains '1' if the subfile is in TRUNCATED mode, or '0' if it is in FOLDED mode (dropped).
The Cxxx fields tell your program where the cursor is when control returns to your program. We don't use all of them - CRRN is the most useful.
SFLRCDNBR(CURSOR) positions the cursor on the subfile record identified by D1DRRN, which is the Subfile RRN defined in your program.
SFLSCROLL's field D1TRRN contains the subfile RRN on the first line of the page on the display when control returns to your program.
Given all this information, you should be able to create an amended program that will load a page at a time, increasing the size of the subfile as it does so, and which will know exactly where it is in the subfile whenever control returns to it, so that it can keep the screen in the same place for non-roll-up operations, and place the screen correctly when a new page is added.
Dig Deeper on Integrated File System (IFS)
Related Q&A from John Blenkinsop
When an error occurs on an IBM command, the diagnostic messages are sent first, then an escape message, which you can monitor. On AS/400 you see the ... Continue Reading
Learn how to 'append data to the file' with the FTP DIR command, and eliminate the hassle of having to end the FTP session and restart to view ... Continue Reading
RPGIV will 'think of' incoming integer fields as binary, and then will redefine them in the program structures as PACKED. So, when you chain a record... Continue Reading
Have a question for an expert?
Please add a title for your question
Get answers from a TechTarget expert on whatever's puzzling you.