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



Bryce,

I once did something similar, and found a solution that surprised me.
It actually uses a dynamically built and prepared statement, but as long
as you have good access paths to the data, the results returned
sub-second in all cases....

The SQL is built dynamically and is structured as a series of CTEs
(returns PRIMARY KEY or compound key data), one for each search field in
scope (up to seven in your example), with a main SELECT of all CTEs
inner joined.

<example - generated as a CHAR field, then prepared>
With
T1 (myPriKey) as
( select dbKey from SEARCHFILE
Where locate('Search Value 1', dbField1) <> 0),
T2 (myPriKey) as
( select dbKey from SEARCHFILE
Where locate('Search Value 2', dbField2) <> 0),
T3 (myPriKey) as
( select dbKey from SEARCHFILE
Where locate('Search Value 3', dbField3) <> 0)
-- Primary Select
Select T1.myPriKey
From T1 inner join
T2 on (t1.myPriKey=t2.myPriKey) inner join
T3 on (t1.myPriKey=t3.myPriKey)
<>

This sample would search three fields, and return a list of record keys
where all terms were found. From there, you can use regular I/O opcodes
to process the list.

Just something to consider...
-Eric DeLong


-----Original Message-----
From: rpg400-l-bounces@xxxxxxxxxxxx
[mailto:rpg400-l-bounces@xxxxxxxxxxxx] On Behalf Of Bryce Martin
Sent: Tuesday, October 05, 2010 12:44 PM
To: RPG programming on the IBM i / System i
Subject: I think I need multi-threading but I'm only on V5R4M5

Well I have come upon a project where I think I need multi-threading in
RPGLE but I am only on V5R4M5.

Here is the scenario...
We have a file that we need to search. There are 7 fields in each
record
that can be searched. As few as 1 or as many as all 7 can be specified.

What I've done is broken out these fields into Key,Value pairs for
faster
searching. By keeping each searchable field as a seperate table ask the

Key and having the key field from the main file as the Value. I will
then
return all matching values to the main search program.

My basic structure would be something like....

if parm1 <> '';
searchfield1()
endif;

if parm2 <> '';
searchfield2();
endif;

....

if parm7 <> '';
searchfield7();
endif;


Since each of these searches are on different files I want to be able to

do them in parallel to speed it up. Is there a way to do this without
doing a sbmjob. I can't do the sbmjob since I need to gather the
results
of each searchfield procedure and then compile a master list.

Any idea will be appreciated.


Thanks
Bryce Martin
Programmer/Analyst I
570-546-4777
--- This message (including any attachments) is intended only for the
use of the individual or entity to which it is addressed and may contain
information that is non-public, proprietary, privileged, confidential,
and exempt from disclosure under applicable law. If you are not the
intended recipient, you are hereby notified that any use, dissemination,
distribution, or copying of this communication is strictly prohibited.
If you have received this communication in error, please notify us and
destroy this message immediately. ---

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.