BSCAN

Top  Previous  Next

 

The BSCAN statement provides a method to scan an alternate key index. It is provided for compatibility with another multivalue product and is best replaced by use of SETLEFT, SETRIGHT, SELECTLEFT and SELECTRIGHT.

 

 

Format

 

BSCAN indexed.value {, ids} FROM fvar {, value} USING index {RESET} {BY seq}

{THEN statement(s)}

{ELSE statement(s)}

 

where

indexed.valueis the variable to receive the indexed value of the index entry found.
idsis the variable to receive the list of ids for the index entry.
fvaris the file variable for the data file.
valueis the indexed value to be located. If omitted, the BSCAN statement moves to the next indexed value in the direction specified in the BY clause.
indexis the name of the index to be scanned.
RESETcauses BSCAN to position at the extreme left or right of the index depending on the BY clause.
seqis "A" (ascending) to scan left to right or "D" (descending) to scan right to left. If omitted, ascending is used by default.

 

At least one of the THEN and ELSE clauses must be present. The THEN clause will be executed if the action is successful. The ELSE clause will be executed at an error and the value of the STATUS() function will provide further information regarding the cause of the failure.

0The scan has reached the end of the index. indexed.value and ids are returned as null strings.
1An index entry was found. The indexed value will be in indexed.value and ids will be a list of data file record ids for that indexed value.
2No index entry with the given value was found.
3Inappropriate file type.
4Index does not exist.
5seq is not A or D.
10Some other unspecified error has occurred.

 

If value is specified, the BSCAN operation positions at that value in the index or, if there is no index entry for the value, at the position where it would have been. The nearest index entry in the scan order is returned.