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



Oops. I failed to clarify that the selection could be in the VIEW *or* the OPNQRYF, but in the quoted sample [code] I showed the selection in both. Thus either the WHERE clause in the CREATE VIEW or the QRYSLT in the OPNQRYF would be omitted, so as not to be redundant; albeit functional even if redundant. I suppose also I should note that the query runs CQE due to OPNQRYF, so where the selection is placed does not matter too much; but if not on the WHERE clause, then probably just use the INDEX on the QRYFILE() of the OPNQRYF and FILE() of OVRDBF since both, that specification is allowed in a CQE query and there would be one fewer object to maintain & thus no need to effect matching format level identifiers.

Regards, Chuck

CRPence wrote:
Create the index as currently noted [although without the ignored
clause, for number of distinct values], then create a VIEW with
the necessary selection. Compile the program using that INDEX. At
run-time, effect an override from that INDEX to the VIEW,
requesting to share the ODP from an OPNQRYF request as in the
following:

<code>
<definition-time setup>
CREATE INDEX V40NISCOF/NSCHGRQFL1
ON V40NISCOF/NSCHGRQF (NCNPROD)
CREATE VIEW V40NISCOF/NSCHGRQFVW AS
(SELECT * FROM V40NISCOF/NSCHGRQF
WHERE NCSTAT = 'D') /* same fmt as PF & LF + select */
RCDFMT NSCHGRQF /* or whatever, to effect same FmtLvlId */
</definition-time setup>
<run-time>
OVRDBF NSCHGRQFL1 NSCHGRQFVW SHARE(*YES) OVRSCOPE(*CALLLVL)
OPNQRYF QRYFILE(V40NISCOF/NSCHGRQFL1) KEYFLD(*FILE)
QRYSLT('NCSTAT *EQ "D"') OPNID(NCSTATeqD)
CALL ThePgm /* access VIEW as runtime ODP like keyed LF */
CLOF NCSTATeqD
DLTOVR NSCHGRQFL1 LVL(*)
</run-time>
</code>

daparnin@xxxxxxxxxxxxxx wrote:
<<SNIP>> between an index and a view. The end result that
I want is a keyed, sorted logical file that does
record selection. <<SNIP>>

daparnin@xxxxxxxxxxxxxx wrote:

I've got a file and index defined in DDL that I would like
to only select records with a certain status.

In DDS I would do something like:

A S NCSTAT CMP(EQ 'D')


How would I do this in DDL? My index is:

CREATE INDEX V40NISCOF/NSCHGRQFL1
ON V40NISCOF/NSCHGRQF (NCNPROD)
WITH 1 DISTINCT VALUES;

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.