× 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.



Jonathan Mason wrote:

>I like the idea, but doesn't this mean
>that you're reading the data twice
>before writing the record to the subfile?
>
>For example:
>
>a) Read record from database file
>b) Write record to QTEMP file
>c) Repeat until end of file...
>
>d) Read record from QTEMP file
>e) Write record to subfile
>f) Repeat until page full or end of file...

Actually.....:

 a) Read record from database file
 b) Write record to subfile
 c) Repeat until end of file...
c1) display subfile
c2) read user's selected column to sort on

 d) Write subfile to "KEYED" QTEMP file with
      fields filled and sort column in "KEY" field
d1) Read QTEMP file
 e) Write record to subfile
 f) Repeat until page full or end of file...


>Presumably the extra key field is a character
>field long enough to hold the largest field on
>the subfile.

Exactly....

Tony Carolla worte:

> What if some of the subfile columns are
> numeric, some are alpha, and some are
> dates?  Could you create one key field
> that could be loaded with all of these
> data types?

The extra key field is a character field long enough to hold the largest
field in the subfile.  The other fields match the subfile which are used to
reload it in the "KEYED" or sorted order.   When filling the "Keyed" field,
I convert the numeric or dates to alpha...  either using a MOVE {RPG III} or
EVAL "KEYED" = %editc(sort_column:'X') {RPG IV}.

Eurrat Saylor, Jr.


----- Original Message -----
From: "Tony Carolla" <carolla@xxxxxxxxx>
To: "RPG programming on the AS400 / iSeries" <rpg400-l@xxxxxxxxxxxx>
Sent: Tuesday, March 29, 2005 6:54 PM
Subject: Re: Sorting and filtering subfiles


> That sounds like an interesting way of doing it (easier than seven temp
files)
>
> <snip>
> > I write out the subfile to a work file in qtemp,
> > which has the same fields with one extra "KEY" field.  I load the sorted
> > columns data into both the matching field and the "KEY" field, then
reload
> > the subfile from the indexed work file in QTEMP.
> <snip>
>
> What if some of the subfile columns are numeric, some are alpha, and
> some are dates?  Could you create one key field that could be loaded
> with all of these data types?
>
>
> --
> "Enter any 11-digit prime number to continue..."
> --
> This is the RPG programming on the AS400 / iSeries (RPG400-L) mailing list
> To post a message email: RPG400-L@xxxxxxxxxxxx
> To subscribe, unsubscribe, or change list options,
> visit: http://lists.midrange.com/mailman/listinfo/rpg400-l
> or email: RPG400-L-request@xxxxxxxxxxxx
> Before posting, please take a moment to review the archives
> at http://archive.midrange.com/rpg400-l.
>
>



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.