Ok, I had that backwards, you're using an index, not a view. And it's
totally unusable by sql, RUNQRY QRYFILE(...), etc.
CREATE INDEX ROB/AAAKEYL1
ON ROB/AAAKEY
(CONAME AS BIGLONGNAME FOR SHORTNAME)
WHERE LOC='A'
RCDFMT AAAKEY1R
ADD SYSTEM, DBLIB
Name of LF is AAAKEYL1
Based on PF AAAKEY
Key field is CONAME renamed to BIGLONGNAME and a new short name of
SHORTNAME.
Where clause available now on index
Have to have that record format name in RPGLE file operations.
Add additional columns from table that you want to appear in index. Too
bad you can't rename those here also.
select * from rob/aaakeyl1
AAAKEYL1 in ROB not table, view, or physical file.
DSPFFD ROB/AAAKEYL1
Field Level Information
Data Field Buffer Buffer Field Column
Field Type Length Length Position Usage Heading
SHORTNAME CHAR 40 40 1 Both COMPANY
NAME
Field text . . . . . . . . . . . . . . . : COMPANY NAME
Alternative name . . . . . . . . . . . . :
BIGLONGNAME
Renamed field . . . . . . . . . . . . . . : CONAME
SYSTEM CHAR 8 8 41 Both AS/400
Field text . . . . . . . . . . . . . . . : NAME OF AS/400
DBLIB CHAR 10 10 49 Both DBLIB
Field text . . . . . . . . . . . . . . . : NAME OF LIBRARY
*************** Beginning of data
FAAAKEYL1 IF E K DISK
/free
*inlr=*on;
read aaakey1r;
dsply shortname; // will find nothing because of WHERE clause
/end-free
****************** End of data ***
Compile listing:
IAAAKEY1R
*------------------------------------------------------
* RPG record format . . . . : AAAKEY1R
* External format . . . . . : AAAKEY1R : ROB/AAAKEYL1
* Format text . . . . . . . : FORMAT0001
*------------------------------------------------------
I A 1 40 SHORTNAME
I A 41 48 SYSTEM
I A 49 58 DBLIB
Rob Berendt
As an Amazon Associate we earn from qualifying purchases.