For Programmers: Free Programming Magazines  


Home > Archive > Fortran > September 2006 > unformatted reading









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author unformatted reading
Mike

2006-09-14, 10:00 pm

Hi

I use CVF6.6c. When I run the following program, the computer is
down. Stucked.
Then I have to reboot it. OS is Windows XP.

program main

a=99.
open(11,file='z. dat',status='unknown',form='unformatted'
)
write(11)a
close(11)
a=1.
open(11,file='z.dat',status='old',form='unformatted')
read(11)a
print *,a

stop
END

After I choosed setting the I/O format in compaibility of Powerstation
4.0 (Project->Settings->Fortran->Compatibility->Powerstation 4.0
Compatibility->i/o format), the result is right.
Why? Any suggestion is appreciated.

Mike

dpb

2006-09-14, 10:00 pm


Mike wrote:
> Hi
>
> I use CVF6.6c. When I run the following program, the computer is
> down. Stucked.
> Then I have to reboot it. OS is Windows XP.
>
> program main
>
> a=99.
> open(11,file='z. dat',status='unknown',form='unformatted'
)
> write(11)a
> close(11)
> a=1.
> open(11,file='z.dat',status='old',form='unformatted')
> read(11)a
> print *,a
>
> stop
> END
>
> After I choosed setting the I/O format in compaibility of Powerstation
> 4.0 (Project->Settings->Fortran->Compatibility->Powerstation 4.0
> Compatibility->i/o format), the result is right.
> Why? Any suggestion is appreciated.


No idea. Works here w/ CVF 6.6c under XP Home as written.

Sounds like one of those wonderful system-dependent interaction
thingies, maybe. I don't suppose you could easily do a re-install of
CVF w/ the updates although that seems a radical first step, granted.
Quite a few CVF users here so I suspect several others will also try, I
also suspect with similar results as I had.

Given the symptom it probably won't help, but you might try
read(11,err=99,end=99) a
99 stop

and see if by any chance the error will be caught. If the system is
hanging, I suspect it won't make any difference. As noted, I'm
suspecting something has munged up some i/o routine in system dlls to
an incompatibility either from an incomplete/botched install or some
other software package installed afterwards.

Terence

2006-09-14, 10:00 pm

I also use the CVF6.6c compiler and this code works.
I prefer you use STATUS='NEW' or 'REPLACE' on the first open of a
sequential file you are going to write to.

I also, like the previous note suggests, would ALWAYS use err= and end=
on a READ statement. Then you can check the status if that route is
taken.

One guess is that Powerstation writes only 4-byte multiples in records
(I don't know -just guessing it is an I/O problem). Odd-byte record
lengths gave problems in some some early compilers so I learned to make
all record lengths even, even today. F90 now assumes direct access
records use multiples of 4-byte words unless told to treat RECL as a
byte count...

Terence

2006-09-14, 10:00 pm

I also use the CVF6.6c compiler and this code works.
I prefer you use STATUS='NEW' or 'REPLACE' on the first open of a
sequential file you are going to write to.

I also, like the previous note suggests, would ALWAYS use err= and end=
on a READ statement. Then you can check the status if that route is
taken.

One guess is that Powerstation writes only 4-byte multiples in records
(I don't know -just guessing it is an I/O problem). Odd-byte record
lengths gave problems in some some early compilers so I learned to make
all record lengths even, even today. F90 now assumes direct access
records use multiples of 4-byte words unless told to treat RECL as a
byte count...

Mike

2006-09-14, 10:00 pm


Terence wrote:
> I also use the CVF6.6c compiler and this code works.
> I prefer you use STATUS='NEW' or 'REPLACE' on the first open of a
> sequential file you are going to write to.
>
> I also, like the previous note suggests, would ALWAYS use err= and end=
> on a READ statement. Then you can check the status if that route is
> taken.
>
> One guess is that Powerstation writes only 4-byte multiples in records
> (I don't know -just guessing it is an I/O problem). Odd-byte record
> lengths gave problems in some some early compilers so I learned to make
> all record lengths even, even today. F90 now assumes direct access
> records use multiples of 4-byte words unless told to treat RECL as a
> byte count...


Yes. It works if I put "read(11,end=1,err=1)a".
I don't know these kind of stuff about how Powerstation write x bytes.
I remember these errors happen all the time when I do unformatted
reading, including unformatted sequential or direct access.
Then after a few hours or days, I'll remember it. It really makes me
troublesome all the time, near ten years.
I know CVF is not updated, right?
HOw do you feel about it?
Do you plan to move into another compiler?
After struggling with "check of Powerstation 4.0 compatibility" for
nearly ten years,
I really think about changing compiler now.

Mike

Steve Lionel

2006-09-15, 8:01 am

Mike wrote:

> I don't know these kind of stuff about how Powerstation write x bytes.


This is explained in the CVF Programmer's Guide. The option you
selected causes the file to be written and read in the format
PowerStation used, which entails a leading flag byte of value 75, a
trailing flag byte of value 130, and records of length 130 bytes or
less each with a length byte before and after the data. I can't
imagine what might cause your PC to lock up when writing or reading
these files.

> I know CVF is not updated, right?


Correct - it has not been updated for nearly three years. The CVF
development team moved to Intel and offers Intel Visual Fortran as the
migration path for CVF users. For more information, please visit
http://www.intel.com/cd/software/pr.../eng/compilers/

Steve Lionel
Developer Products Division
Intel Corporation
Nashua, NH

dpb

2006-09-15, 8:01 am


Mike wrote:
....
> Yes. It works if I put "read(11,end=1,err=1)a".


With or without Powerstation compatibility or both?

> I don't know these kind of stuff about how Powerstation write x bytes.
> I remember these errors happen all the time when I do unformatted
> reading, including unformatted sequential or direct access.
> Then after a few hours or days, I'll remember it. It really makes me
> troublesome all the time, near ten years.


I've had DVF/CVF installed since V5.Iforget and upgraded to 6.6c and
have never had such a problem on any machine or OS (from W95 to NT to
XP). I'm convinced there's something wrong either in your install or
some other software installed on the machine is/has caused this
problem. I don't believe this is a bug or feature in CVF. Have you
changed the VisualStudio environment or anything else? I think my
initial recommendation still stands--I'd probably do a re-install of
all CVF and see if it cleans it up.

> I know CVF is not updated, right?
> HOw do you feel about it?
> Do you plan to move into another compiler?


Personally, I feel somewhat abandoned, but that's simply
disappointment, not reality...not the first nor will it be the last
software product that has ceased to be supported. Was disappointing to
see the demise but inevitable after the collapse of DEC. I also have
not yet switched and given my age and current state as mostly-retired,
probably won't unless some large project comes back to life and needs a
currently-supported compiler. Of course, as new features are
incorporated into compilers, I'm being left further behind, but I'm
writing so little new code at the present it really doesn't matter.
The few codes I still have some maintainence on are so stable and
unlikely to have further major updates there is no real reason to
change. Your situation is obviously different so you'll have to judge
on its own merits.

> After struggling with "check of Powerstation 4.0 compatibility" for
> nearly ten years,
> I really think about changing compiler now.


I also don't know why you would ever use the PowerStation compatibility
option unless you are still having to read old files written with that
(known buggy unsupported for far longer since CVF has been) compiler.
I wonder if you have it still there's the other piece that is somehow
intermingled inappropriately w/ the CVF install???

Gary Scott

2006-09-16, 3:59 am

Mike wrote:
> Terence wrote:
>
>
>
> Yes. It works if I put "read(11,end=1,err=1)a".
> I don't know these kind of stuff about how Powerstation write x bytes.
> I remember these errors happen all the time when I do unformatted
> reading, including unformatted sequential or direct access.
> Then after a few hours or days, I'll remember it. It really makes me
> troublesome all the time, near ten years.
> I know CVF is not updated, right?
> HOw do you feel about it?
> Do you plan to move into another compiler?
> After struggling with "check of Powerstation 4.0 compatibility" for
> nearly ten years,
> I really think about changing compiler now.
>
> Mike
>

I highly recommend upgrading. Unfortunately, there isn't anything
currently as good of an overall product as DVF/CVF was, but since it is
no longer updated, I recommend going to Intel, especially if your code
requires any FPS extensions.

--

Gary Scott
mailto:garylscott@sbcglobal dot net

Fortran Library: http://www.fortranlib.com

Support the Original G95 Project: http://www.g95.org
-OR-
Support the GNU GFortran Project: http://gcc.gnu.org/fortran/index.html

Why are there two? God only knows.


If you want to do the impossible, don't hire an expert because he knows
it can't be done.

-- Henry Ford
Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com