Ansicht
Dokumentation
ABAPOPEN_DATASET_POSITION - OPEN DATASET POSITION
rdisp/max_wprun_time - Maximum work process run time Fill RESBD Structure from EBP Component StructureThis documentation is copyright by SAP AG.
OPEN DATASET, position
... AT POSITION pos ...
Effect
This addition sets the file pointer at the position specified in pos. pos expects a numeric data object. Numbers with a value greater than the value range of the data type i can also be entered.
The position is specified in bytes, where the start of the file corresponds to position 0. If pos contains the value -1, the position is at the end of the file. For all other negative values, the behavior is undefined.
The following cases must be distinguished:
- If the file is opened for reading and the value of pos is greater than the length of the file, the file pointer is positioned outside the file. Unless the position is changed, no data can be read.
- If the file is opened for writing, the next time writing takes place, the file is filled with hexadecimal 0 from the start of the file to the specified position, and the new content is written after that.
- If the file is opened for appending, the specified position is ignored, and the file pointer remains positioned at the end of the file.
- If the file is opened for changing, and the value of pos is greater than the length of the file, the next time the file is written in, it is filled with hexadecimal 0 from the end of the file to the specified position, and the new content is written after that.
The addition POSITION cannot be specified if one of the additions FILTER
or BYTE-ORDER MARK is specified at the same time.
Notes
- For file sizes greater than 2 GB, a position pos of the data type i is not sufficient for positioning in the entire file, and p or decfloat must be used instead.
- The positioning can be overwritten by the statement SET DATASET. Especially for positioning the file pointer at the end of the file, SET DATASET should be used instead of entering the value -1 in pos.
- Free specified positions are more suitable for binary files than for text files. In the case of text files, positions depend on the character format, end-of-line marker, and a possible byte order mark (BOM) in UTF-8 files.
Example
A file test.dat is created as a text file, then filled with data, changed, and read. Since each TRANSFER statement appends an
end-of-line marker to the written
content, the content of the file is double-lined after the change. The first line contains
"12ABCD". The second line contains "890". The character "7" is overwritten by the end-of-line selection of the first line.
CL_GUI_FRONTEND_SERVICES - Frontend Services RFUMSV00 - Advance Return for Tax on Sales/Purchases
This documentation is copyright by SAP AG.
Length: 3637 Date: 20240418 Time: 151517 sap01-206 ( 64 ms )