* Re: Internal List Directed I/O
1994-02-23 17:25 Internal List Directed I/O Christopher T. Day
@ 1994-02-23 18:23 ` Steve Lionel
1994-02-23 22:17 ` Bill Leonard
` (2 subsequent siblings)
3 siblings, 0 replies; 5+ messages in thread
From: Steve Lionel @ 1994-02-23 18:23 UTC (permalink / raw)
In article <37472@dog.ee.lbl.gov>, ctday@randolf.lbl.gov (Christopher T. Day)
writes:
|>Can anyone tell me the ANSI standard status of list directed I/O (I in
|>particular)
|>from internal files in FORTRAN 77? Various processors are giving me different
|>interpretations. Microsoft PowerStation flags it as an error at compile
|>time. The
|>OSF/1 AXP system flags it as an error at run time. HP and Sun systems
|>don't have
|>any problem with the idea. I can't find anything in my FORTRAN 77 book
|>forbidding
|>it or allowing non-support as an option; I infer that it should be allowed. My
|>FORTRAN 90 book positively recommends it as an effective programming technique.
|>What's the official word? It's making ports a bit of a pain. (Short term, is
|>there a way to get the AXP system to accept the idea?) Thanks.
List-directed input from an internal file (and output to an internal file)
is an extension to Fortran 77 that is supported by all DEC Fortran
implementations. I tried it on a DEC OSF/1 AXP system and it worked as I
expected. If you're having a problem on that platform, please send me a
copy of the source, the version of DEC Fortran installed (from a listing
header), and a log showing the results.
Here's my test case:
$ cat ldx.f
CHARACTER*10 LINE
LINE = '12345'
READ (LINE,*) L
TYPE *,L
END
$ f77 -o ldx ldx.f
$ ldx
12345
--
Steve Lionel lionel@quark.enet.dec.com or
SDT Languages Group lionel@quark.zko.dec.com
Digital Equipment Corporation
110 Spit Brook Road, ZKO2-3/N30
Nashua, NH 03062-2698 "Free advice is worth every cent"
^ permalink raw reply [flat|nested] 5+ messages in thread* Re: Internal List Directed I/O
1994-02-23 17:25 Internal List Directed I/O Christopher T. Day
1994-02-23 18:23 ` Steve Lionel
@ 1994-02-23 22:17 ` Bill Leonard
1994-02-24 11:34 ` Michael Lemke
1994-02-25 5:23 ` Robin Vowels
3 siblings, 0 replies; 5+ messages in thread
From: Bill Leonard @ 1994-02-23 22:17 UTC (permalink / raw)
In article <37472@dog.ee.lbl.gov>, ctday@randolf.lbl.gov (Christopher T. Day) writes:
> Can anyone tell me the ANSI standard status of list directed I/O (I in
> particular)
> from internal files in FORTRAN 77?
> I can't find anything in my FORTRAN 77 book forbidding it or allowing
> non-support as an option; I infer that it should be allowed. My FORTRAN
> 90 book positively recommends it as an effective programming technique.
> What's the official word? It's making ports a bit of a pain. (Short term,
> is there a way to get the AXP system to accept the idea?) Thanks.
List-directed formatting to/from an internal file is not standard Fortran
77, but it is standard Fortran 90. Some Fortran 77 compilers allow it as
an extension.
I wouldn't infer that something is allowed just because a text doesn't
mention it. My assumption is always "if it doesn't say you can, assume you
can't."
--
Bill Leonard
Harris Computer Systems Division
2101 W. Cypress Creek Road
Fort Lauderdale, FL 33309
bill@ssd.csd.harris.com
These opinions and statements are my own and do not necessarily reflect the
opinions or positions of Harris Corporation.
------------------------------------------------------------------------------
"I can do trivial things pretty trivially."
Tom Horsley
------------------------------------------------------------------------------
^ permalink raw reply [flat|nested] 5+ messages in thread* Re: Internal List Directed I/O
1994-02-23 17:25 Internal List Directed I/O Christopher T. Day
1994-02-23 18:23 ` Steve Lionel
1994-02-23 22:17 ` Bill Leonard
@ 1994-02-24 11:34 ` Michael Lemke
1994-02-25 5:23 ` Robin Vowels
3 siblings, 0 replies; 5+ messages in thread
From: Michael Lemke @ 1994-02-24 11:34 UTC (permalink / raw)
In article <37472@dog.ee.lbl.gov>,
Christopher T. Day <ctday@randolf.lbl.gov> wrote:
>Can anyone tell me the ANSI standard status of list directed I/O (I in
>particular)
>from internal files in FORTRAN 77? Various processors are giving me different
>interpretations. Microsoft PowerStation flags it as an error at compile
>time. The
>OSF/1 AXP system flags it as an error at run time. HP and Sun systems
>don't have
>any problem with the idea. I can't find anything in my FORTRAN 77 book
>forbidding
>it or allowing non-support as an option; I infer that it should be allowed.
Your inference is wrong. I don't have the exact wording handy but list
directed I/O is not allowed from internal files in Fortran 77.
If you run across a machine that doesn't have it as an extension there
are only two methods I know of. The first gives you true list directed
I/O as implemented on your particular machine but is probably very slow:
character*77 c
open(1, status = 'scratch' )
write( 1, '(a)' ) c
rewind 1
read( 1, * ) a, b, d, ...
You get the idea.
The other option is to decode the numbers yourself from the string.
Fairly tedious and you don't get necessarily identical behavior to the
machine's implementation. But possible to do and if you need it a lot
you might get a faster program. Sorry, no example I could post.
>My
>FORTRAN 90 book positively recommends it as an effective programming technique.
>What's the official word? It's making ports a bit of a pain. (Short term, is
>there a way to get the AXP system to accept the idea?) Thanks.
>
Don't know what to do on the AXP but running VMS and DEC Fortran will
certainly do it. Fortran90 allows list directed I/O from internal files
as far as I've read on this board.
Michael
--
Michael Lemke
Institute of Astronomy, Cambridge UK
(michael@io.as.utexas.edu or UTSPAN::UTADNX::IO::MICHAEL [SPAN])
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Internal List Directed I/O
1994-02-23 17:25 Internal List Directed I/O Christopher T. Day
` (2 preceding siblings ...)
1994-02-24 11:34 ` Michael Lemke
@ 1994-02-25 5:23 ` Robin Vowels
3 siblings, 0 replies; 5+ messages in thread
From: Robin Vowels @ 1994-02-25 5:23 UTC (permalink / raw)
ctday@randolf.lbl.gov (Christopher T. Day) writes:
Can anyone tell me the ANSI standard status of list directed I/O (I in particular)
from internal files in FORTRAN 77? Various processors are giving me different
interpretations. Microsoft PowerStation flags it as an error at compile time. The
OSF/1 AXP system flags it as an error at run time. HP and Sun systems don't have
any problem with the idea. I can't find anything in my FORTRAN 77 book forbidding
it or allowing non-support as an option; I infer that it should be allowed. My
FORTRAN 90 book positively recommends it as an effective programming technique.
What's the official word? It's making ports a bit of a pain. (Short term, is
there a way to get the AXP system to accept the idea?) Thanks.
---According to my FORTRAN 77 book, it says: "You can use only formatted input/output;
unformatted, list directed, namelist, mass storage, and buffer input/output are
not valid for internal files."
^ permalink raw reply [flat|nested] 5+ messages in thread