Position to first record

WTSupported in traditional Synergy on Windows
WNSupported in Synergy .NET on Windows
USupported on UNIX
VSupported on OpenVMS
xcall BEGFL(channel)



An expression that evaluates to a channel number as specified in a previous OPEN statement. (n)


The BEGFL subroutine positions the file pointer at the first record in the file. BEGFL is used with sequential, relative, stream, and indexed files.

After a BEGFL call, a READS returns the first record of the file to the DIBOL program. A WRITES writes the designated record as the first record of the sequential or relative file. Any records that are locked due to a previous operation are unlocked.

On Windows and UNIX, the BEGFL subroutine resets the key of reference for an ISAM file to zero. If system option #35 is set, the current key of reference is retained for subsequent sequential I/O. On OpenVMS, however, the key of reference is never cleared, regardless of whether or not system option #35 is set. To work around this discrepancy, you can call the SETKRF routine after the BEGFL call. (See DBL$SETKRF for more information about SETKRF.)


On Windows and UNIX, if you want to retain the key of reference and don’t want to set system option #35 (which may change the behavior of other things), use GETFA(CH, “KRF”, krf) followed by FIND(CH, REC, KEYNUM:krf, POSITION:Q_BOF).

An “Invalid operation for file type” error ($ERR_FILOPT) is generated if channel is not associated with a file.

See also