OPEN DATASET - position

Syntax

... AT POSITION pos ... .

Effect:

This addition sets the file pointer at the position specified in pos. A numerical data object is expected for pos. As of release 6.10, digits with a value greater than the value range of the data type i can also be entered.

The position is defined in bytes, and the start of the file is equal to position 0. If pos contains the value -1, as of release 6.10 the file pointer is positioned at the end of the file. For all other negative values and prior to Release 6.10, the behavior is undefined.

Please note the following special cases:

  1. 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. If the position is not changed, no data can be read. In a non- Unicode program, if a file is opened for reading and is then written to, the file is filled with hexadecimal 0 from the end of the file to the specified position, and the new content is written after that.

  2. 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.

  3. If the file is opened for appending, the position specification is ignored and the file pointer remains positioned at the end of the file.

  4. 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: