SEEK function
Returns the offset of the file pointer in a text file as an INT64 value. You define a procedure variable to hold the offset value and later position the file to that offset.
Syntax
INPUTOUTPUTname
STREAM-HANDLEhandle
ExampleThis procedure shows how you can use the SEEK function to access data in an text file. Using SEEK this way allows you to index into a non-indexed file.
In the example, you are prompted to select an Item number to position the output file. When a record is found with that Item number, the SEEK function returns the offset into the variable
m-pos
. The value form-pos
is the current value of the file pointer. The SEEK statement uses the value inm-pos
to position the file pointer in the unnamed input stream.Notes
- The first byte in a file is byte 0.
- You cannot use the SEEK function with the INPUT THROUGH statement, the INPUT-OUTPUT THROUGH statement, or the OUTPUT THROUGH statement. When used with one of these statements, the SEEK function returns the Unknown value (
?
).- After you assign the value of the SEEK function to a procedure variable, you can use that value to reposition the file in the event of an error.
- For more information on streams, see the chapter on alternate I/O sources in OpenEdge Development: Programming Interfaces.
See alsoDEFINE STREAM statement, INPUT FROM statement, OUTPUT TO statement, SEEK statement, Stream object handle
OpenEdge Release 10.2B
|