×
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.
David
I don't think it is "bad" as such. But it might be slower. With F-specs
you are using record-level access - you go directly to the records, it
is very efficient. With SQL, the system has to figure out just HOW to
get the data - with F-specs, YOU decide already. See, with this
statement, you have dynamic SQL. Although it is embedded in an RPG
program, it is not static. IBM have made dynamic SQL better and faster,
but no guarantees.
You would have to run some tests to see what the difference is in timing.
It also might not matter which you use, especially if this is an
interactive program and the statement is not executed very often. If it
is in a batch process over thousands and millions of records, it might
matter which one you use.
Now just so you know - MYTABLE1 and MYTABLE2 should be physical files,
not logical files. When you specify logical files (indexes in other SQL
products), the optimizer has to take the time to figure out which
physical file the LF is based on, then continue to work out the best LF
to use, if any. It is not just going to use what you thought you told it
to use, unlike record-level access - there's that expression again!!
HTH
Vern
David FOXWELL wrote:
Hi,
If I understood correctly from a previous thread, the use of SQL in the example below taken from something I already wrote is not a good idea as I am doing a single row search.
EXEC SQL
SET : MyField = (
SELECT MYFIELD FROM MYTABLE1 JOIN MYTABLE2 ON ID1 =ID2
WHERE MYOTHERFIELD= : MYSEARCHDATA );
If I were not to use SQL I'd have to code the 2 files in the F specs, and do 2 CHAINs. I've noticed a lot of people are doing similar quick fixes.
Sorry to keep asking the same question, but is this example really that bad?
As an Amazon Associate we earn from qualifying purchases.
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.