This field refers to the subscript of the referenced row in a table. COUNT must be specified for FC, DC, RC, IC, GN, and GP commands. It is recommended that this value be set to zero when searching for the first occurrence of a partial key with the FG command. Thereafter, the FG command uses the count to position itself to the next row.
Valid values for COUNT:
- Generally, for all tables other than Hash tables, the COUNT is set to a value greater than zero and less than or equal to the actual number of rows in the table. There are exceptions: when an insert is performed the COUNT may exceed the actual number of rows by one; for the first FG and GN commands in a loop the COUNT may be zero; for the first GP command the COUNT may exceed the number of rows by one.
- For Hash tables, COUNT is set to a value greater than zero and less than or equal to the MAXIMUM table size. For DC and RC commands, COUNT may not point to an empty row.
If COUNT is outside of the permitted range:
- For an FC command the FOUND code will be set to N.
- For DC, RC, and IC commands an ERROR code will be returned.
COUNT is set by commands SK, FK, FG, GF, GN, GP, GL, DK, IK, and RK. If the row is found, COUNT will be set to the subscript of the row in the table. If the row is not found, COUNT will be set to the location for a potential insert operation.
COUNT is reset to zero by an explicit Table Open; it is reset to zero by an implicit open except for commands FC, IC, DC, RC, and DU.