HPlogo Using KSAM XL and KSAM 64 > Chapter 9 KSAM Intrinsics

FFINDN

MPE documents

Complete PDF
Table of Contents
Index

E0300 Edition 4 ♥
E0394 Edition 3

Syntax Parameters Operation Notes Condition Codes

Positions the logical record pointer to the relative record number according to the key sequence in a KSAM file.

Syntax



          I16V     DV      I16V
  FFINDN (filenum, number, location);

Parameters


filenum

16-bit signed integer (required)

Passes the file number of the file to be positioned.

number

double by value (required)

Specifies a record number relative to the first logical record in the file. Record numbers start with zero or one depending on the record numbering scheme specified at file creation. The lowest numbered record applies to the record with the lowest value in the specified key field. A negative record number positions the file pointer to the record with the smallest key value.

location

16-bit signed integer by value (required)

Passes the relative byte location in the record of the key to be used. The first byte of the record is considered 1. If location=0, the primary key is used.

Operation Notes


Split stack calls are permitted.

This intrinsic does not read the advance flag. It sets both the logical record pointer and the physical pointer to the appropriate record. When its function is complete, it sets the advance flag to FALSE.

When the relative record number is specified, be sure not to confuse this number with the physical record number (the number of the record as it is stored in the file). The relative record number is based on the value of a specified key, not its location in a file.

If FFINDN is used to position the pointer before calling another procedure that reads or updates the file in a shared environment, FLOCK must be called before calling FFINDN. After performing the read or update operation, unlock the file. If the file is locked after calling FFINDN, another user can change the pointer position without your program being aware of it.

Condition Codes


CCE

Request granted.

CCG

Request denied. The requested position was beyond the logical end-of-file.

CCL

Request denied. An error occurred.

Refer to this intrinsic in the MPE/iX Intrinsics Reference Manual for other codes pertaining to KSAM files.




FFINDBYKEY


FGETINFO