U_POS - position a UFAS file.

Usage:

#include <ufas.h>
stat = u_pos( fp, U_BEGIN );
stat = u_pos( fp, U_FORW, nrec );
stat = u_pos( fp, U_BACK, nrec );
stat = u_pos( fp, U_ABS, relkey );
stat = u_pos( fp, U_ABS, keynum, keyptr );

Where:

U_FILE fp;
is the file to be positioned.
U_BEGIN
indicates that the file is to be rewound to the beginning.
U_FORW
 
U_BACK
indicates that the file is to be spaced forward or backwards according to the given record count.
U_ABS
indicates that the file is to be positioned to a record which matches the given key.
int nrec;
is the number of records to skip.
unsigned relkey;
is the key to search for in a UFF Relative file.
char *keyptr;
is the pointer to a key to search for in a UFF Indexed or ISP file.
int keynum;
is the key number to which "keyptr" refers in a UFF Indexed file.
int stat;
is zero on success, and EOF if an error occurs.

Description:

"u_pos" positions a file. When searching for a key, the option U_EQ is equivalent to U_ABS. The options U_GT or U_GE may be used instead of U_ABS to search for records having a key greater than, or greater than or equal to, the given key.

Since the UFAS return value is interpreted in different ways depending on the type of positioning, this value is not returned by "u_pos". Instead, the function "u_stat" should be used to query the result.

Notes:

The call

u_pos( fp, U_ABS );

is equivalent to the call

u_pos( fp, U_BEGIN );

UFAS restricts the positioning calls on various file types; the UFAS Manual should be consulted to determine which positioning options are valid.

Copyright © 1996, Thinkage Ltd.