Xref: utzoo comp.lang.fortran:3475 comp.unix.questions:24154 comp.sys.sequent:677 Path: utzoo!attcan!utgpu!news-server.csri.toronto.edu!mailrus!tut.cis.ohio-state.edu!cs.utexas.edu!uwm.edu!bionet!agate!violet.berkeley.edu!jerry From: jerry@violet.berkeley.edu (Jerry Berkman) Newsgroups: comp.lang.fortran,comp.unix.questions,comp.sys.sequent Subject: Re: Unformatted(binary) Fortran standard output Message-ID: <1990Jul29.165900.6161@agate.berkeley.edu> Date: 29 Jul 90 16:59:00 GMT References: <3051@syma.sussex.ac.uk> Sender: usenet@agate.berkeley.edu (USENET Administrator;;;;ZU44) Reply-To: jerry@violet.berkeley.edu (Jerry Berkman) Organization: University of California, Berkeley Lines: 63 In article <3051@syma.sussex.ac.uk> andy@syma.sussex.ac.uk (Andy Clews) writes: >Someone I know (no, it isn't me) wants to run a Fortran program that >produces very large amounts of unformatted/binary output. Rather than send >the output to a file on the host machine, she would like to pipe it >(or redirect it) so as 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). > >Machine B has more computing power but not enough disk space to hold the >output. > >The problem is that Fortran does not seem to allow unformatted i/o on >the standard channel, stdout. The compiler in use is ATS Fortran on a >Sequent Symmetry S81, running DYNIX 3.0.17. The statements that are >giving the problem are of the form > > write(*) list > >We've tried using write(6) but no joy. > >Can anyone advise? > >-- >Andy Clews, Computing Service, Univ. of Sussex, Brighton BN1 9QN, England >JANET: andy@syma.sussex.ac.uk BITNET: andy%syma.sussex.ac.uk@uk.ac First try "open(6,form='unformatted')". If that doesn't work, you could try using formatted I/O with "a" format terms. This has a few problems. First, you get an unwanted trailing line feed. Try using "$" at the end of the format, but then you may overflow your buffers. Second, I seem to recall a bug in old versions of the f77 libraries in which nulls are accidentally filtered out during "a" format output. Another option is to have the program write small temp. files, "cat" each one to standard output, e.g.: call doit call doit end subroutine doit dimension x (5) open(20,form='unformatted') do 10 i=1,5 x(i) = i 10 continue write(20) x close(20) call system( 'cat fort.20; rm fort.20') end This works on our system (VAX 8650, 4.3 BSD f77). It might also work with just a close & rewind. I would also put know identifiers before and after the data I wanted to make sure nothing funny is happening, e.g.: write(20) 2*31-1, x, 2*30-1 - Jerry Berkman, U.C. Berkeley jerry@violet.berkeley.edu (415)642-4804 Disclaimer: Views are my own not UCB, ...