POINT_LUN

The POINT_LUN procedure sets or obtains the current position of the file pointer for the specified file.

Note that POINT_LUN cannot be used with files opened with the NOSTDIO keyword to the OPEN routines. Depending upon the device in question, the IOCTL function might be used instead for files of this type.

Calling Sequence

POINT_LUN, Unit, Position

Arguments

Unit

The file unit for the file in question. If Unit is positive, POINT_LUN sets the file position to the position given by Position . If negative, POINT_LUN gets the current file position and assigns it to the variable given by Position . Note that POINT_LUN cannot be used with the 3 standard file units (0, -1, and -2).

Position

If Unit is positive, Position gives the byte offset into the file at which the file pointer should be set (hence, to rewind the file to the beginning, specify 0). If Unit is negative, Position must be a named variable into which the current file position will be stored.

Under VMS, be careful to move the file pointer only to record boundaries. It is always safe to move to a file position that was previously obtained via POINT_LUN or the FSTAT function. Files with indexed organization can only be positioned to the beginning of the file.

Example

To move the file pointer 2048 bytes into the file associated with file unit number 1, enter:

POINT_LUN, 1, 2048

To find the position of the file pointer in the file associated with file unit 2 and store that position in the variable pos , enter:

POINT_LUN, 2, pos

See Also

GET_LUN , OPEN