POINT_LUN

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

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

Use Of POINT_LUN On Compressed Files

In general, it is not possible to arbitrarily move the file pointer within a compressed file (files opened with the COMPRESS keyword to OPEN) because the file compression code needs to maintain a compression state for the file that includes all the data that has already been passed in the stream. This limitation results in the following constraints on the use of POINT_LUN with compressed files:

For these reasons, use of POINT_LUN on compressed files, although possible under some circumstances, is best avoided.

Examples

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

POINT_LUN, 1, 2048

To return the file pointer for file unit number 2, enter:

POINT_LUN, -2, pos

Syntax

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. For example, 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. The returned type will be a longword signed integer if the position is small enough to fit, and a 64-bit longword integer otherwise.

Keywords

None.

Version History

Original

Introduced

See Also

GET_LUN, OPENR/OPENU/OPENW, TRUNCATE_LUN