Get Position (22)
The Get Position operation (B_GET_POSITION) returns the physical 4-byte position of the current record. Get Position fails if there is no established physical currency when you issue the operation. Once you determine a record’s position (address), you can use the Get Direct/Record operation (23) to retrieve that record directly by its physical location in the file. The transactional interface does not perform any disk I/O to process a Get Position request.
Parameter
Op Code
Pos Block
Data Buf
Data Buf Len
Key Buffer
Key Number
Sent
Returned
Prerequisites
•
The file must be open.
•
Your application must have established physical currency.
Procedure
1
Set the Operation Code to 22.
2
Pass the Position Block for the file.
3
Set the Data Buffer Length to at least 4 bytes.
4
Set the Key Number to 0.
Result
If the Get Position operation is successful, the transactional interface returns the position of the record in the Data Buffer. The position is a 4-byte binary value (most significant word first) that indicates the record’s offset (in bytes) into the file. The transactional interface also sets the Data Buffer Length to 4 bytes.
If the Get Position operation is unsuccessful, the transactional interface returns one of the following status codes:
3
The file is not open.
8
The current positioning is invalid.
Positioning
The Get Position operation has no effect on positioning.