COLLECT.IXVALS
Published By | Date | Version | Knowledge Level | Keywords |
---|---|---|---|---|
Revelation Technologies | 14 NOV 1989 | 2.X | EXPERT | COLLECT.IXVALS |
COLLECT.IXVALS
COLLECT.IXVALS is a subroutine used to return a list of all the data values in a particular Btree index.
COLLECT.IXVALS(file_name, index_name)
Using COLLECT.IXVALS
In returning all data values, COLLECT.IXVALS is different from BTREE.EXTRACT, which returns a list of primary keys associated with one or more specific data values. COLLECT.IXVALS is the basis for the CATALYST "V" call. Because a Btree index is always maintained in sorted order, COLLECT.IXVALS will return a sorted list of data values. This list can in turn be displayed in a popup, used in a report, etc.
file_name
Use file_name to pass the name of the data file for which the index lookup is being done.
index_name
Use index_name to pass the name of the index (field) for which data values are to be returned.
Values returned
Data values found by COLLECT.IXVALS are returned in @PSEUDO using @FM as a delimiter. The list of return values is limited to 64K; lists longer than this will be truncated.
Correct Use of COLLECT.IXVALS
DECLARE SUBROUTINE MSG, INPUT.CHAR, FSMSG, COLLECT.IXVALS /* program to call COLLECT.IXVALS any hits found by COLLECT.IXVALS are returned via @PSEUDO using @FM as the delimiter */ OPEN "FILES" TO files.file ELSE FSMSG(); STOP * prompt for file name LOOP error = 0 file_name = "" MSG("Enter file name to fetch index for", "RC", file_name, "") IF file_name THEN READ file.info FROM files.file, file_name ELSE MSG(file_name:" not a valid file!","","","") error = 1 END END WHILE error REPEAT * prompt for an index name OPEN "DICT.":file_name TO file.dict ELSE MSG("Can't open DICT of ":FILE_NAME:"!","","","") STOP END LOOP error = 0 INDEX_NAME = "" MSG("Enter name of index to display", "R", index_name,"") IF index_name THEN * confirm that this is a valid field READ confirm FROM file.dict, index_name THEN * confirm that this is an indexed field confirm = XLATE("!":file_name, "*INDEXES", 1, "X") LOCATE index_name IN confirm SETTING POS ELSE error = 1 MSG(INDEX_NAME:" not an index!","","","") END ; * LOCATE END ELSE MSG(index_name:" is an invalid field!","","","") error = 1 END ; * READ confirm END WHILE error REPEAT @@PSEUDO = "" COLLECT.IXVALS( file_name, index_name ) IF @PSEUDO THEN CONVERT @FM TO @VM IN @PSEUDO MSG("COLLECT.IXVALS returned|":@PSEUDO, "", "", "") END ELSE MSG("No values returned for COLLECT.IXVALS", "", "", "") END STOP