BEGFL

Position to first record

WSupported on Windows
USupported on Unix
VSupported on OpenVMS
NSupported in Synergy .NET
xcall BEGFL(channel)

Arguments

channel

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

Discussion

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.)

Tip

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