Intel fortran-80 manual File Existence, File Name, File Position, External And Internal Files

Models: fortran-80

1 130
Download 130 pages 742 b
Page 62
Image 62
6.1.2.1 File Existence

Input/Output

FORTRAN-SO

6.1.2.1 File Existence

At the time an executable program is running, a certain set of files is available. These files are said to exist, and the particular files that exist are determined by the operating system or environment in which the program is running.

A file may exist without containing any data; an example would be a newly-created file having only a name.

All FORTRAN I/O statements can refer to existing files. Some statements (OPEN, CLOSE, WRITE, PRINT, and ENDFILE) can also refer to files that do not yet ex- ist and are in the process of being created.

6.1.2.2 File Name

FORTRAN has no standard file-naming convention. Such conventions are system dependent. For example, in the ISIS-II environment all of the following are valid file names:

MYFILE

1-6 character file name

MYFILE.SRC

file name plus 1-3 character extension

:LP:

device name, in this case line printer

:F1:PROG.OBJ

device name plus file name plus extension

6.1.2.3 File Position

Once a file has been connected to a unit, it has a position. The 'initial point' of a file is the position preceding the first record. Its 'terminal point' is the position just after the last record. If the file is positioned within a record, that record is the 'current record.'

Executing certain I/O statements affects the position of the file. Some circumstances can cause the file position to become indeterminate.

6.1.2.4 External And Internal Files

An external file is a file that can be connected to an external unit. An internal file is a character variable, character array, or character array element. Internal files allow you to transfer data within processor memory.

An internal file cannot be specified by one of the file-handling statements (OPEN, CLOSE, BACKSPACE, REWIND, ENDFILE). It can only be read or written by sequential- access, formatted I/O statements that do not specify 'list-directed for- matting.'

An internal file has the following properties:

Each record is a character array element.

The length of the file depends on its kind. If the file is a character variable or array element, it is a single record whose length is the length of the variable or array element. If the file is a character array, every record has the same length as an array element in the array and the file has as many records as array elements.

A record may be read only if it has been defined. A variable or array element record is defined by writing the record (or by making it the target in an assign- ment statement). If the number of characters written is less than the length of the record, the characters are left-adjusted in the record and the remainder of the record is filled with blanks.

An internal file is always positioned at its initial point before a data transfer.

6-2

Page 62
Image 62
Intel fortran-80 manual File Existence, File Name, File Position, External And Internal Files