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>

Regards, Chuck

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.