%RECNUM

Return the number of the last record processed

WTSupported in traditional Synergy on Windows
WNSupported in Synergy .NET on Windows
USupported on UNIX
VSupported on OpenVMS
last = %RECNUM(channel)

Return value

last

The number of the last record processed on channel. If no operation has occurred on the file, %RECNUM returns a value of zero. (i)

Arguments

channel

The channel to check for the last record processed. (n)

Discussion

%RECNUM is valid for any non‑ISAM file, but it is only updated on a successful I/O operation.

Encountering end‑of‑file does not change the value of %RECNUM. When you encounter end‑of‑file, you can use %RECNUM to get back to the last record that was processed.

Note

%RECNUM is not updated on a FIND because FIND does not transfer data.

Examples

The following function returns the number of records in a file.

function numrecs 
   a_data       ,a 
   a_chn        ,d 
proc 
   read(a_chn, a_data, ^last) 
   freturn %recnum(a_chn) 
endfunction