Unformatted(binary) Fortran standard output

John Whitmore whit at milton.u.washington.edu
Thu Jul 19 14:21:37 AEST 1990


In article <3051 at syma.sussex.ac.uk> andy at syma.sussex.ac.uk (Andy Clews) writes:
>Someone I know ...[wants to] send the output through the LAN to her
>own machine, on which she is running the program via rsh(1).
>
>That is, she is logged into host A; the executable is on host B; she
>wants to run it on B and send the output over the LAN to host B, by
>doing    rsh B "foo" > foo.output    (foo.output thus appearing on host A).
>
>The problem is that Fortran does not seem to allow unformatted i/o on
>the standard channel, stdout.  The statements that are
>giving the problem are of the form
>
>	write(*) list
>
>We've tried using  write(6)  but no joy.
>
	Using the always-open I/O unit means... you haven't
formally OPEN'ed it.  Thus, you are at the mercy of some 
implementation mechanic who decided what the OPEN should be...
and he obviously decided it would be FORM='FORMATTED'.
	Use instead an explicitly opened unit; on VMS systems
(which is all I'm familiar with), this would be done as

	OPEN(unit=36, file='SYS$OUTPUT:',form='UNFORMATTED')

after which a 'write(36) list' should give the unformatted output
to the standard output channel.  Because of file access control
for a file opened more than once, you might have to specify
a lot of other things in the OPEN statement... because the
standard output may be written to in the FORMATTED way by other
code (error handlers, for instance, in most large programs).
In particular, 'WRITEONLY' might be a useful addition.


I am known for my brilliance,            John Whitmore
 by those who do not know me well.



More information about the Comp.unix.questions mailing list