|
|
The sequential WRITE statement transfers data to an external file or an internal file from the items specified by the output list.
The four types of sequential WRITE statements are
Each of these statements is discussed in the following sections.
Execution of a WRITE statement for a file that does not exist creates the file.
Parameter Explanations
Formatted WRITE (Sequential)
WRITE ([UNIT=]unum,f[,IOSTAT=rn][,ERR=s]) [iolist]Method of Operation
A formatted WRITE statement transfers data from internal storage to an external record using sequential-access mode. The WRITE operation translates the data from binary to character format using the f specifier to edit the data.
Unformatted WRITE (Sequential)
WRITE ([UNIT=]unum[,IOSTAT=rn][,ERR=s]) [iolist]Method of Operation
An unformatted WRITE statement performs no translation on read-in data.
The data is read in directly to the items in iolist. The type of each data item in the input record must match that declared for the corresponding item in iolist.
When sequential-formatted WRITE is performed on a direct-access file, the next record in the file is assumed and the record is zero-padded to the end as if it were a direct, unformatted WRITE.
List-Directed WRITE
WRITE ([UNIT=]unum,*[,IOSTAT=rn][,ERR=s]) [iolist]Method of Operation
A list-directed WRITE statement transfers data from internal storage to an external record using sequential-access mode. The WRITE operation translates the data from binary to character format using the data types of the items in iolist to edit the data.
Rules
Table below shows the data types and the defaults of their output format.
Table: Default Formats of List-Directed Output
Namelist-Directed WRITE
Syntax
WRITE([UNIT=]unum,NML=group-name[,IOSTAT=rn][,ERR=s][,END=eof])Method of Operation
A namelist-directed WRITE statement transfers data from internal storage to external records. It translates the data from internal to external format using the data type of the items in the corresponding NAMELIST statement. A namelist-directed READ or ACCEPT statement can read the output of a namelist-directed WRITE statement.
Rules for Use
Namelist items are written in the order that referenced NAMELIST defines them.
Examples for All Forms of Sequential WRITE
The following statement writes the prompt enter a filename to standard output:
The following statement opens the file %%temp and writes the record pair to the file.
open (unit=10, status='unknown',file="%%temp")
|
|
Fortran Related Tutorials |
|
---|---|
Pascal programming Tutorial | Adv Java Tutorial |
Software Engineering Tutorial | MATLAB Tutorial |
Fortran Related Practice Tests |
|
---|---|
Pascal programming Practice Tests | Adv Java Practice Tests |
Software Engineering Practice Tests | MATLAB Practice Tests |
All rights reserved © 2020 Wisdom IT Services India Pvt. Ltd
Wisdomjobs.com is one of the best job search sites in India.