-qposition

Category

Language element control

Purpose

Positions the file pointer at the end of the file when data is written after an OPEN statement with no POSITION= specifier and the corresponding STATUS= value (OLD or UNKNOWN) is specified.

The position becomes APPEND when the first I/O operation moves the file pointer if that I/O operation is a WRITE or PRINT statement. If it is a BACKSPACE, ENDFILE, READ, or REWIND statement instead, the position is REWIND.

Syntax

Read syntax diagramSkip visual syntax diagram
>>- -q--position--=--+-appendold-----+-------------------------><
                     '-appendunknown-'   

@PROCESS:

@PROCESS POSITION({APPENDOLD | APPENDUNKNOWN} …)

Defaults

The default setting depends on the I/O specifiers in the OPEN statement and on the compiler invocation command:
  • -qposition=appendold for the xlf and xlf_r commands when they are used to compile the .f, .F, .f77, or .F77 files
  • -qposition=appendold for the f77 and fort77 commands
  • The defined Fortran 90, Fortran 95, Fortran 2003, and Fortran 2008 behaviors for the xlf90, f90, xlf90_r, xlf95, f95, xlf95_r, xlf2003, f2003, xlf2003_r, xlf2008, f2008, and xlf2008_r commands

Examples

In the following example, OPEN statements that do not specify a POSITION= specifier, but specify STATUS='old' will open the file as if POSITION='append' was specified.

xlf95 -qposition=appendold opens_old_files.f
In the following example, OPEN statements that do not specify a POSITION= specifier, but specify STATUS='unknown' will open the file as if POSITION='append' was specified.
xlf95 -qposition=appendunknown opens_unknown_files.f
In the following example, OPEN statements that do not specify a POSITION= specifier, but specify either STATUS='old' or STATUS='unknown' will open the file as if POSITION='append' was specified.
xlf95 -qposition=appendold:appendunknown opens_many_files.f

Related information