Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

a simple question ! in command write(7,1) what is 7? 1

Status
Not open for further replies.

baharengineer

Programmer
Jul 9, 2010
42
IR
hi
i view that for write always i have write(6,a) that a is a format label number. and 6 is the output number that is plot or printer
now in command write (7,a) what means 7?
 
7 is the channel number. That can be associated with a printer, the console or a file (has to be preceded by an open)
 
Few additional precisions:
- 7 is a UNIT number in FORTRAN terminology but CHANNEL is probably more understandable
- do not use file units between 1 and 7 : they are often used for special devices (6 was associated to the printer which is replaced today by the console). 7 was reserved to card punch (the old days of computer science). 1 is often the standard output unit (<=> 6), 2 is often the error unit, 5 is the input unit.

In the past, the maximum unit index was 99. This is not true anymore but I continue to apply that limit.

It is better to use * instead of 5 (in READ statement) and 6 (in WRITE statements) because neither 5 and 6 are defined by the FORTRAN norm (but 5 and 6 are accepted by all the FORTRAN compilers).

If you do not open a unit explicitely, then the compiler may (or not) open a file with a predefined name. For instance, as the punch card device does not exist anymore, the compiler may create a file with the name fort007.dat (for instance)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top