create index mylib.myindex
on mylib.mytable (field4)
where field3='X'
rcdfmt MYTABLERCD add all columns

INSERT INTO ROB.MYTABLE VALUES('A', 'B', 'X', 1)
INSERT INTO ROB.MYTABLE VALUES('C', 'D', 'X', 2)
INSERT INTO ROB.MYTABLE VALUES('E', 'F', 'A', 3)

CPYF FROMFILE(ROB/MYINDEX) TOFILE(*PRINT)

RCDNBR *...+... 1 ...+... 2 ...+... 3
1 A B X 1
2 C D X 2

Here's some RPG:
FMYINDEX IF E DISK
/free
dou %eof(myindex);
read myindex;
if not %eof(myindex);
dsply field4;
endif;
enddo;
*inlr=*on;
return;
/end-free

When you execute it you will see:
DSPLY 1
DSPLY 2

This is a good thing. This should pass all RPG tests. At least those
that use RLA or traditional Record Level Access methods by RPG.

Now, I AM having one sizeable problem. When I use RUNQRY
FILE(MYLIB/MYINDEX) against that file I am getting:
QRY1045 - File MYINDEX in ROB cannot be queried.
CPD4360 - Queried file MYINDEX in ROB not data base file or is an SQL
derived key index.

And STRSQL, select * from rob.myindex is generating
SQL7011 - MYINDEX in ROB not table, view, or physical file.

WRKQRY is generating
QRY1089 - Error CPD4360-00 in query definition.

I don't recall running into all these limitations before.

Rob Berendt

As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:
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.