× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



Position-to is really quite easy in a load-all. With a scroll bar there is no programming of course. But since we don't use the scroll bar because... well... because we don't I guess, we need to use plan B.

When there is a value in the position to field, then start reading the subfile (not the original data) from record 1. If the position value is above the subfile value then eval the subfile record number into the *top RRN field. If <= then leave the subroutine. ( <= gives you a the nearest hit on display line 2. You may prefer using just < )

Here is an example of sorting by column that I did a few years ago.

http://tinyurl.com/kjsno

and

http://tinyurl.com/s8225

Wilt, Charles wrote:
-----Original Message-----
From: rpg400-l-bounces+cwilt=meaa.mea.com@xxxxxxxxxxxx [mailto:rpg400-l-bounces+cwilt=meaa.mea.com@xxxxxxxxxxxx] On Behalf Of Alan Shore
Sent: Thursday, August 03, 2006 12:25 PM
To: RPG programming on the AS400 / iSeries
Subject: Re: Even more embedded SQL.... Thank you EVERYBODY


Booth - you and I must be on the same wavelength, or in mutual mind-meld
mode or something.
I want to take time to thank everyone who has replied to my question, with
suggestions, ideas, thoughts, other questions and especially examples.

I think I have a handle on everything that I need in relation to what is
required for SQL and Dynamic sort building, but what bothers me is the
position to aspect of SQL, where the file data is rebuilt, with the first record being equal to or greater than the value that was requested to be positioned to. The problem of paging up from that point (before the first
record) will mean yet another re-creation.
So I was thinking of a couple of things
1/. Load the first 9,999 records into a load all sub-file.
If the user wants to go above that, recreate the data and load the next
9,999 records etc. etc.
If the user wants to position to a value AND its within this 9,999 NO
PROBLEM
If its outside the range , recreate the data and load the applicable 9,999
records into the sub-file.

"Position to" with a load-all subfile?  How are you going to do that?
Save the subf RRN and key so you can have a particular page put back
out.

Have you thought about the effect that having multiple sortable columns
would have?  If the results are sorted by color, then as a user I'd want
to position to a color.  If the results are sorted by name, then I'd
want to position to by name.


2/. Create a file (via DDS) with all the fields defined
COL1, COL2, COL3, COL4, COL5, COL6, COL7 and an additional field which is in effect equal in size to ALL the fields CONCATENATED. This field would now be the key of the file, and depending upon what sort is required, build
this field accordingly
for example
if the sort is COL1, COL2, COL3, COL4, COL5, COL6, COL7, the this key field
is created as
COL1 concat COL2 concat COL3 concat COL4 concat COL5 concat COL6 concat
COL7
and then use regular RPG to handle the page up, page down, position to
page-at-a-time sub-file
Anybody any thoughts on either of these 2 ideas?



The problem with this idea is that DB I/O is pretty expensive.  You'd
get much better performance writing to a user space instead.

HTH,



Charles Wilt
--
iSeries Systems Administrator / Developer
Mitsubishi Electric Automotive America
ph: 513-573-4343
fax: 513-398-1121


As an Amazon Associate we earn from qualifying purchases.

This thread ...

Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.