COUNTKEYS
9.4
The COUNTKEYS instruction counts the keys in an ISAM file from a starting value to an ending value. The instruction uses the following formats:
|
|
|
|
|
Where:
label
Optional. A Program Execution Label.
ifile
Required. A previously defined and opened IFILE variable.
sep1
Required. A comma or one of the following prepositions: BY, TO, OF, FROM, USING, WITH, IN, or INTO.
startkey
Required. A previously defined Character String Variable that contains the key to start counting from inclusively.
sep2
Required. A comma or one of the following prepositions: BY, TO, OF, FROM, USING, WITH, IN, INTO or GIVING.
endkey
Required. A previously defined Character String Variable that contains the key to stop counting from inclusively.
keycount
Required. A previously defined Numeric Variable where the number of counted keys is stored.
Flags Affected: OVER, ZERO
Note the following:
If the {keycount} is equal to zero, the ZERO Condition Flag is set.
If {keycount} is too small to contain the count, the OVER Condition Flag is set.
The {startkey} and {endkey} should contain the 'key data' that would be expected when performing a normal IFILE READ operation.
The COUNTKEYS instruction applies normal file locking techniques the same as in a normal IFILE READ. This insures the integrity of the file while ISAM keys are being counted.
See Also: Example Code, Disk I/O Instructions
![]() |