HP 3000 Manuals

Control Operations [ Accessing Files Programmer's Guide ] MPE/iX 5.0 Documentation


Accessing Files Programmer's Guide

Control Operations 

There may be times when you want to move the record pointer to a
particular place without necessarily transferring any data.  There are
three general categories for this type of record selection:

Spacing:  Move the record pointer backward or forward.

Pointing:  Reset the record pointer.

Rewinding:  Reset the pointer to record 0.

Spacing 

To space forward or backward in your file, use the FSPACE intrinsic.  Its
syntax is

     FSPACE(filenum,displacement);

The displacement parameter gives the number of records to space from the
current record pointer.  Use a positive number for spacing forward in the
file or a negative number for spacing backward.

You can use the FSPACE intrinsic only with files that contain
fixed-length or undefined-length records; variable-length record files
are not allowed.  The FSPACE intrinsic may not be used when you have
opened your file with APPEND access; the file system returns a CCL
condition if you attempt to use it in this case.  Spacing beyond the EOF
results in a CCG condition, and the record pointer is not changed.

Pointing 

To request a specific location for the record pointer to indicate, use
the FPOINT intrinsic.  Its syntax is

     FPOINT(filenum,recnum);

Use the recnum parameter to specify the new location for the record
pointer; recnum is the record number relative to the start of the file
(record 0).

You can use The FPOINT intrinsic only with files that contain
fixed-length or undefined-length records; variable-length record files
are not allowed.  The FPOINT intrinsic may not be used when you have
opened your file with Append access; the file system returns a CCL
condition if you attempt to use it in this case.  Pointing beyond the EOF
results in a CCG condition, and the record pointer is not changed.

Rewinding 

When you "rewind" your file, you set the record pointer to indicate
record 0, the first record in your file.  Use the FCONTROL intrinsic with
a control code of 5 to accomplish this.  FCONTROL's syntax in this case
would be

     FCONTROL(filenum,5,dummyparam);

Issuing this intrinsic call sets the record pointer to record 0.  You can
use FCONTROL with fixed-length, variable-length, or undefined-length
record files; you can use it with any access method.


NOTE FCONTROL's control code 5 has a special meaning when used with Append access. The file system sets the record pointer to record 0, as with other access modes, but at the time of the next write operation to the file, the record pointer is set to the end of the file so that no data is overwritten.
For more information about the FSPACE, FPOINT, and FCONTROL intrinsics, consult the MPE/iX Intrinsics Reference Manual (32650-90028).


MPE/iX 5.0 Documentation