FORTRAN Reference Manual
Statements
FORTRAN Reference Manual—528615-001
7-85
POSITION Statement
•
If you position unit 5 or unit 6 and you have not already established a connection 
for the unit, POSITION implicitly opens the unit using default parameters. If you 
specify ENV COMMON and you position unit 5 or unit 6, your FORTRAN routines 
share access to standard input or standard output, respectively, with routines 
written in other languages only if the access mode for unit 5 is INPUT and for unit 6 
is OUTPUT. However, the default access mode for both units 5 and 6 is I-O. If you 
want to share access to the file connected to the unit, you must set the unit’s 
access mode to INPUT (unit 5) or OUTPUT (unit 6) before you execute the 
POSITION statement. You can set the access mode: 
°
In a FORTRAN OPEN statement, as in
OPEN( 5, MODE = 'INPUT')
OPEN( 6, MODE = 'OUTPUT')
°
In a TACL ASSIGN command, as in
ASSIGN FT005, , INPUT
ASSIGN FT006, , OUTPUT
°
In a UNIT compiler directive, as in
UNIT (5, INPUT)
UNIT (6, OUTPUT)
 For more information about using units 5 and 6 as shared files, see the OPEN 
Statement on page 7-70.
•
If a POSITION statement causes unit 5 or unit 6 to be implicitly opened and your 
program is running as a NonStop process, the FORTRAN run-time library does a 
stack checkpoint to the backup process as a part of the implicit open.
•
Error conditions
If you specify lbl, and an error occurs during the position operation, the 
POSITION statement terminates, the file position becomes indeterminate, and 
FORTRAN transfers control to the statement identified by lbl. If you also specify 
ios, you can determine the error that occurred by analyzing ios.
If you specify ios, but not lbl, and an error occurs during the position operation, 
your program continues executing with the statement that follows the POSITION 
statement. You can analyze ios to determine the error that occurred, if any.
If you do not specify ios or lbl, and an error occurs, FORTRAN terminates your 
program and displays a run-time diagnostic message.










