Enscribe Programmer's Guide
Figure 6 Key Fields and Key Specifiers
Alternate-Key Fields
Primary-Key
Field
System-Defined
Key Specifier
Application-Defined Key Specifiers
NVOLHO 0
LOCATION VENDORPART NO. ON-HANDDESCRIPTION PRICE
Current Key Value and Current Position
The current key value defines a file's current position. You can set the current key value explicitly
by calling the FILE_SETKEY_, FILE_SETPOSITION_,POSITION or KEYPOSITION procedure.
FILE_SETKEY_ and KEYPOSITION set a position by primary key for key-sequenced and queue files
and by alternate key for key-sequenced, entry-sequenced, and relative files. FILE_SETPOSITION_
and POSITION set a position by primary key for entry-sequenced and relative files. After a call to
FILE_READ64_/READ, the current key value is implicitly set to the key value of the current access
path in the record just read. Figure 7 (page 29) demonstrates the use of KEYPOSITION in a
key-sequenced file.
The current position determines the record to be locked (by a call to FILE_LOCKREC64_/LOCKREC)
or accessed (by a call to FILE_READ[LOCK]64_, READ[LOCK], FILE_READUPDATE[LOCK]64_,
READUPDATE[LOCK], FILE_WRITEUPDATE[UNLOCK]64_, or WRITEUPDATE[UNLOCK]). A record
need not exist at the current position. When a file is opened, the current position is that of the first
record in the file as defined by the file's primary key.
Figure 7 Current Position
Primary Key
Record
Current Position after
KEYPOSITION and
READ #1
Current Position after
READ #2
Current Position after
READ #3
CALL KEYPOSITION (fnum, key) ;
CALL READ (fnum, ... ) ;
CALL READ (fnum, ... ) ;
CALL READ (fnum, ... ) ;
#1
#2
#3
key : = "FISH" ;
FISH
JACKSON
KING
MASTERS
OBRIEN
RYAN
ADAMS
BROWN
COLLINS
Positioning Mode and Comparison Length
A subset of records in a designated access path can be described by a positioning mode and a
key value. The positioning modes are approximate, generic, and exact. Approximate mode selects
all records whose access path key values are equal to or greater than the supplied key value.
Generic mode selects all records whose access path key value matches a supplied partial value.
Access Paths 29