02.07.2013 Views

Type III C lass A Program

Type III C lass A Program

Type III C lass A Program

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

DIRECT ACCESS I/O<br />

All direct-access files used or created by FORTRAN programs<br />

have file identi'fiers in the following format:<br />

I Filename I Filetype ,<br />

1------------1------------1<br />

I FILE 1 DAxx ,<br />

I I I<br />

xx is the data set reference number, from 01 through 08,.<br />

If the file is being created by a<br />

filemode is Pl. For input to a<br />

filemode of P is acceptable.<br />

FORTRAN program,<br />

FORTRAN program"<br />

the<br />

any<br />

Direct access refers only to those files which are used with<br />

the FORTRAN lanq,uaq.e DEFINE FILE statement. (Note the<br />

distinction between the CMS library DEFINE subroutine in<br />

SYSLIB. TXTLIB wllich is referenced by a CALL DEFINE<br />

statement, and the FORTRAN language statement DEFINE FILE.)<br />

Files used sequentially are not considered direct-access<br />

files,. even though they reside on disk.<br />

Unlike the sequential data set reference numbers, the<br />

direct-access number does not imply any record length. This<br />

information is supplied by the DEFINE FILE s·tatement within<br />

the FORTRAN program. All files are on the permanent disk.<br />

The same data set reference number may not be used for both<br />

a sequential and a direct-access file in the same program,<br />

nor may a single file be referenced by both methods in the<br />

same program. Different access methods may be used for the<br />

same file by different programs, provided the file<br />

identifiers are changed.<br />

The number of records specified in the DEFINE FILE statement<br />

should be realistic. If a new file is being created, the<br />

specified number of records are blanked out on the permanent<br />

disk before the first record is written.. Specifying an<br />

unnecessarily larqe number of records wastes disk space,.<br />

Although the FIND statement is supported, there is no need<br />

to use it in a time-sharing environment,. I/O overlap is<br />

achieved through sharing of CPU time among the virtual<br />

machines. Use of the FIND statement actually slows down<br />

execution of the FORTRAN program slightly. since two<br />

operations must be carried out instead of one.<br />

An example of direct-access I/O is shown in Figure 35.<br />

FORTRAN <strong>Program</strong>ming 333

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!