RECNO( ) function

Returns the current record number.

Syntax

RECNO( )

Parameters

This function does not have any parameters.

Output

Numeric.

Examples

Basic examples

The following example extracts records numbered 10 through 20 to a new Analytics table:

EXTRACT RECORD IF BETWEEN(RECNO( ),10,20) TO "Subset.fil"

Remarks

You can use the RECNO( ) function to output record numbers to a table, or to determine the relative location of a particular record within a table.

Indexed tables vs Non-indexed tables

This function returns the current logical record number:

  • If the table is not indexed, RECNO( ) starts with a value of 1 and increases by one for each record in the table. The logical and physical record numbers are identical.
  • If the table is indexed, RECNO( ) behaves similarly, but counts the records using the logical, not physical order.

Using the SEEK or FIND command

If the SEEK or FIND commands are used, the record number is reset to 1 after you execute these commands.

Reordering records

When you reorder the records in a table, the record numbers generated by RECNO( ) are not reordered. To keep the record numbers with the records that they were originally associated with, extract the data to a new table using the Fields option before you reorder the records.