Position to in load all subfile

2505 pts.
Tags:
Subfile
I have done a position to in a load all subfile by checking if the position to field is not empty, then chain the file with that key and display records from there onwards. But am facing this issue, after the subfile is displayed, I am not able to do a page up. It gives error "roll up or down past the last or first record in subfile" Is there any way to handle this. If I do a position to with 10, it should display records from 10 onwards and when I do page up, I need records before 10

Software/Hardware used:
AS400

Answer Wiki

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

Discuss This Question: 9  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
    ...when I do page up, I need records before 10   You have read-previous through the database file until you get to 10 records before the first record in your subfile. Then reload the subfile from that point.   And note that this is not the same as positioning in a load-all subfile. You are not doing a load-all, and you're not positioning in the subfile -- you're positioning in the database file instead. For that, you should be doing a page-at-a-time subfile..   Tom
    125,585 pointsBadges:
    report
  • TomLiotta
    Typo correction: "You have to read-previous through the database file...".   Tom
    125,585 pointsBadges:
    report
  • NeilD
    In order to do positioning in a load all subfile you need to read through the subfile (chain count sflrcd) and when record is found (using a field comparison statement such as " If posord = order"; load rrn = count.When the sfl is redisplayed (not rebuilt) it will show the page that your position to exists on. In order to place this record at the top od the page, use the SFLRCDNBR(*TOP) statement in the DDS.Hope this gets you on the right track.Neil
    450 pointsBadges:
    report
  • philpl1jb
    NeilD has it.  SFLRCDNBR(*TOP) ... when this control record keyword is active you must provide the associated variable with a valid rrn within the subfile.
    49,850 pointsBadges:
    report
  • TomLiotta
    Unfortunately, this is not a load-all subfile, so SFLRCDNBR(*TOP) won't help.   That is, according to the description in the question, the subfile logic in the program is "load all". But the program logic outside of the subfile does not load all of the needed database records into the subfile. There are database records before the first subfile record. Going to the top of the subfile will not give any ability to scroll back to see previous database records.   If previous database records need to be viewed through the subfile, then the subfile must be reloaded.   ...then chain the file with that key and display records from there onwards.   The so-called "Position to" field is used to determine the first database record to load into the subfile. It's not used to 'position' within a previously loaded subfile. That's why there is no capability to scroll back before that row in the subfile. The first loaded database record doesn't have any subfile records before it.   Unless, of course, the problem description is wrong.   Tom
    125,585 pointsBadges:
    report
  • NeilD
    Effectively, the 'mistake' the OP is making is attempting to chain the file with the Position To field and then rebuilding the subfile thus removing the ability to page backwards. As has been said, this can't be done with a load all subfile - the alternative is either re-write as a 'page at a time' subfile or follow my suggestion where the sfl records are accessed (via do loop looking for a comparison) and setting the sflrcdnbr to the rrn of the matching sfl record.
    450 pointsBadges:
    report
  • philpl1jb
    I would do what Neil is proposing.  But checking my book -- 1999 I loaded from the file. Works fine for page-at-a-time. But for the load-all or add-a-page-at-a-time subfile my design of 1999 required the user to enter a new search value to move up in the file. Still it was extremely simple code and there is something to be said for that.
    49,850 pointsBadges:
    report
  • harith
    when I do page up, I need records before 10 Load the all record which ever you want display, in to Load all subfile,When ever position to field has a value just find RRN for that particular record either from Subfile  or Database And move that RRN value to SFLRCDNBR,  subfile will show the page where that record has If u do the Page Up / Page Down also its works fineā€¦ You dnt need to Reload the subfile But My suggestion is use Single Page Subfile
    170 pointsBadges:
    report
  • TomLiotta
    You dnt need to Reload the subfile.    The likely situation is that there are more records in the database file than the maximum that can be loaded into a subfile (otherwise all records would have been loaded). If that's true, the subfile will need to be reloaded as soon as a database record is requested that isn't in the subfile. It doesn't matter if page-up or -down causes the message that was reported.   Even a page-at-a-time subfile must be reloaded for that.   However, the page-at-time subfile logic has an advantage of using common logic. The logic needed for a load-all subfile that handles the same situation would be less familiar to any developer who worked on the program in the future.   But the OP still hasn't clarified the situation. We still aren't sure what problem is being discussed. The clues in the question argue for a reload as a direct "solution". But it seems that a page-at-a-time subfile is the correct logic that should be used.   Tom
    125,585 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