Page at a time subfile

895 pts.
Tags:
AS/400 Subfiles
RPGLE
SQL
SQLRPGLE
I want to code loading a single page subfile in SQLRPGLE. How do I handle the page up and page down key, posotion to in that program?

thanks,

NG



Software/Hardware used:
SQLRPGLE

Answer Wiki

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

Hopefully I have remembered to include everything of import here. I didn’t include things like command key handling. You’ll obviously have to fill in the blanks. But having coded on this platform for 27 years (I can’t believe it!), I’ve found this to be a tried and true basic technique.

If you plan to load from a point in the data and be able to page down, use this technique. You can make it go back and forth, but I’ve found my users were quite satisfied with this method.

Note, If you aren’t allowing the user to select a subfile record and process it, you don’t need to save the relative record number or file keys. In that case, use READP after the end of the fill loop to position to the correct record for the next subfile page and skip the setll on pagedown.

DDS:
- Specify PAGEDOWN keyword with a response indicator
- Specify SFLEND keyword conditioned with a file read indicator
(I don’t normally use file access indicators, but in this case it works well)
- Specify a position to field on your subfile control record

Program:
- Loop
- Execute your format
- Check to see if the position to field is changed.
– If so, clear the subfile and using the position to field key(s), setll to your file, execute fill subroutine
- Did they page down?
– If so, setll with saved keys and restore your saved subfile relative record number, execute fill sub.
- Did they select a subfile record?
– If so, using the keys from the selected record, retrieve your data base file, do whatever you do…
(This changed the file keys and the relative record number. That’s why you save them.)
- End of loop

Fill subroutine:
Eval a counter to 0 (this is used to fill to the number of records on one page – we’ll pretend it’s 14)
Read with an eof indicator (we’ll use 99)
Dow not *in99 and counter < 14
add 1 to subfile relative rec#
set on subfile dsp indicator
write subfile detail record
add 1 to counter
read with indicator 99
enddo
save your last file position keys
save your subfile relative record number
-Normally I never use an indicator on a read. But the indicator 99 is turned on when actual end of file is reached. That will stop the + or *MORE from showing on your subfile at the proper time.)

—————-
Great work LeslieL
here’s a site you should check out

http://tutorialindia.com/as400/subfiles_ile_rpg_iv/process_single_page_subfiles.php

Phil

===============================
www.itjungle.com/fhg/fhg051309-story02.html
===============================

Discuss This Question: 6  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
  • aceofdelts
    A slight variation I use is to also specify the PAGEUP as well. This only hits if they roll back past the position-to. Program will READP for x records past position-to (x=number of records per screen) or until beginning-of-file. Use that record as an implicit "new position-to" and treat as if user entered that value as a reposition. A bit of a pain but now user can roll thru position-to without a "false" beginning-of-file error. Mike L.
    1,930 pointsBadges:
    report
  • Nutangujar
    Thanks you all... can i use embedded SQL to fetch records....especially how to handle PageUp in SQL...when we generally use ReadP operation.... Thanks, NG
    895 pointsBadges:
    report
  • philpl1jb
    sure you can - here's the link http://www.itjungle.com/fhg/fhg051309-story02.html cursor is openned as scrollable Then you can use fetch prior Phil
    49,940 pointsBadges:
    report
  • philpl1jb
    http://www.itjungle.com/fhg/fhg051309-story02.html link was repeated
    49,940 pointsBadges:
    report
  • Nutangujar
    sorry, but i could not access that link -NG
    895 pointsBadges:
    report
  • TomLiotta
    Try this link -- IT Jungle SQL FETCH Options 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