Syntax | Optional off_t lseek (int fildes, off_t offset, int whence);
| |||||||||||||||||||||||||||||||||||||||||||||||||||
Description | If POSIX files are executed, the behavior of this function conforms to the XPG standard as described below:
If whence is If whence is If whence is The symbolic constants The
There is no difference in functionality between BS2000 The following must be noted when executing BS2000 files:
Text files (SAM, ISAM) can be positioned absolutely to the beginning or end of the file as well as to any position previously marked with Binary files (PAM, INCORE) can be positioned absolutely (see above) or relatively, i.e. relative to beginning of file, end of file, or current position (by a desired number of bytes). SAM are always processed as text files with elementary functions. The significance, combination options, and effects of the offset and whence parameters differ for text and binary files and are therefore discussed individually below. Text files (SAM, ISAM)Possible values:
Meaningful combinations and their effects:
Binary files (PAM, INCORE)Possible values:
Meaningful combinations and their effects:
(End) | |||||||||||||||||||||||||||||||||||||||||||||||||||
Return val. | New value of the file position indicator, measured in bytes from the beginning of the file, | |||||||||||||||||||||||||||||||||||||||||||||||||||
if successful. | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| (off_t) -1 | if an error occurs; | ||||||||||||||||||||||||||||||||||||||||||||||||||
| BS2000 | |||||||||||||||||||||||||||||||||||||||||||||||||||
if successful. | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| Absolute position in text files, | |||||||||||||||||||||||||||||||||||||||||||||||||||
if successful. (End) | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| -1 | if an error occurs. | ||||||||||||||||||||||||||||||||||||||||||||||||||
Errors |
| |||||||||||||||||||||||||||||||||||||||||||||||||||
|
| fildes is not an open file descriptor. | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
| whence is not a proper value, or the resulting file offset would be invalid. | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
| fildes is associated with a pipe or FIFO. | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
| The resulting file offset cannot be represented correctly in the structure pointed to by | ||||||||||||||||||||||||||||||||||||||||||||||||||
Notes | The program environment determines whether a BS2000 or POSIX file is created. BS2000 The calls If new records are written to a text file (opened for creation or in append mode) and an Exception for ANSI functionality: If a binary file is positioned past the end of file, a gap appears between the last physically stored data and the newly written data. Reading from this gap returns binary zeros. It is not possible to position to system files (SYSDTA, SYSLST, SYSOUT). Since information on the file position is stored in a field that is 4 bytes long, the following restrictions apply to the size of SAM and ISAM files when processing them with SAM file
ISAM file
(End) | |||||||||||||||||||||||||||||||||||||||||||||||||||
See also |
|