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



very impressive that you caught that.  

The method that Scott described below is similar to the way that I have it.  I 
found out that it won't work when I was half way thru.

-----Original Message-----
From: rpg400-l-bounces+lim.hock-chai=arch.com@xxxxxxxxxxxx
[mailto:rpg400-l-bounces+lim.hock-chai=arch.com@xxxxxxxxxxxx]On Behalf
Of Joe Pluta
Sent: Thursday, August 18, 2005 5:19 PM
To: 'RPG programming on the AS400 / iSeries'
Subject: RE: a need for speed


I don't think this will work when there are multiple suffix ranges for a
single terminal in a prefix.  Instead, you'll get a single suffix range
for that terminal and lose any suffix ranges for other terminals in
between.

In this specific case, I think you'd just get one range for JSN.

Unfortunately, because the suffix is changing with every record, there
is no way to use terminal as a "level break".  A sequential read is
really the only answer.

The other option is to fix the program that writes to this file and flag
the first record in each range.  That is, when you write a record, check
the previous record.  If the previous record is NOT of the same
terminal, set a Boolean field called NEWRANGE to true.  Also, you have
to check the next record and if it belongs to the same terminal and has
NEWRANGE=true, set NEWRANGE=false.

Now, create an index over records with NEWRANGE=true.  Read a record,
save the key information.  Read the next record in the view.  Use it to
read the previous record from a view of all records.  This is the last
record in the previous range.  Use it and the saved information to write
your summary record.

A minor variation requiring a little more time on the write would be to
use a flag with three values: FIRST, LAST, NEITHER.  The first record in
each range and the last would be flagged.  Create a view over FIRST and
LAST records.  Read each pair and write the summary data.

Joe

> From: rpg400-l-bounces@xxxxxxxxxxxx
[mailto:rpg400-l-bounces@xxxxxxxxxxxx]
> 
> > I need to summarize a big telephone master file (22M+) into ranges.
> > I'm attempting to use read, reap, setll to avoid the need to read
each
> > phone number record to create this summary file.  However, no luck
so
> > far.
> 
> a) Have a logical file thats keyed by: areacode, prefix, terminal and
> suffix (in that order)
> 
> b) At the start of your program do a "setll *start"
> 
> c) use READ to get the area code, prefix and terminal and lowest
suffix.
> Save them somewhere (maybe in a data structure).  If the READ fails
then
> you're at the end of the file and you're done.
> 
> d) using the area code, prefix and terminal from (C) and setting the
> suffix to *HIVAL, do a SETGT.  Follow that with a READPE (but don't
> specify the suffix) to get the highest suffix.
> 
> e) write the summary record
> 
> f) Go back to step (C), continuing the loop until you've read the
whole
> file.


As an Amazon Associate we earn from qualifying purchases.

This thread ...


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.