Using KSAM/XL and KSAM 64 (32650-90886)

146 Chapter9
KSAM Intrinsics
FSPACE
FSPACE
Moves a record pointer forward or backward in a file.
Syntax
I16V I16V
FSPACE(
filenum,displacement
);
Parameters
filenum
16-bit signed integer by value (required)
Passes the file number of the file on which spacing is to be done.
displacement
16-bit signed integer by value (required)
Passes the number of logical records to be spaced over, relative to the
current position of the logical record pointer.
A positive value signifies forward spacing, a negative value signifies
backward spacing. The maximum positive value is 32,767. The maximum
negative value is 32,768.
Operation Notes
The logical record pointer is repositioned in key sequence. The spacing is based on the
primary key unless an alternate key has been specified in a prior call to FFINDN,
FFINDBYKEY, or FREADBYKEY.
This intrinsic reads the advance flag and advances to the next record if the flag is set to
TRUE. It sets the logical record pointer and the physical pointer to the appropriate record.
When its function is completed, it sets the advance flag to FALSE.
Note that because this intrinsic reads the advance flag, spacing might be affected by a
preceding call to an FREAD or FREADC intrinsic. FREAD and FREADC set the advance flag to
TRUE. If the FSPACE intrinsic is then called, it advances one record before moving back or
ahead the specified number of records.
Condition Codes
CCE Request granted.
CCG Request denied. A logical end-of-file indicator was encountered during
spacing. The logical record pointer is at the beginning-of-file if
displacement was negative or at the end-of-file if displacement was
positive.
CCL Request denied. An error occurred.
Refer to this intrinsic in the MPE/iX Intrinsics Reference Manual for other codes
pertaining to KSAM files.