From: glen herrmannsfeldt on
onateag <gaetano.esposito(a)gmail.com> wrote:

> Here is the first 20 lines of od -x for both working and not working
> linking files:

(snip of working version)

> $ od -x tplink | head -20
> 0000000 0024 0000 2e31 2039 2020 2020 2020 2020
> 0000020 2020 2020 4f44 4255 454c 2020 2020 2020
> 0000040 2020 2020 0000 0000 0024 0000

Three CHARACTER*12 items.

> 0014 0000
> 0000060 01be 0000 a1a0 0003 0004 0000 006f 0000
> 0000100 0002 0000 0014 0000

Five INTEGERS

> 0014 0000 0000 0000
> 0000120 ec04 412e 0000 2000 f958 4043 0000 0000
> 0000140 1000 4061 70a4 0a3d a3d7 400a 0000 0000
> 0000160 0000 0000 0000 0000 0000 0000 0000 0000
> 0000200 0000 0000 0000 0000 0000 2000 036e 403c

The next record length indicator says 20 bytes,
but there is no trailing X'00000014' in the
appropriate place. The file is wrong.

(Do any systems verify that the trailing length
indicator matches the leading length indicator?)

If you can consistently recreate a file like
this, then I believe that there is a problem
in the system I/O library creating it.

If you can't recreate it, throw the file away
and hope it never happens again.

As I said previously, I have seen strange results,
especially on unix systems, when more than one
program writes to a file. Windows seems to lock
against multiple writes (and, too often, won't even
let me read a file when I should), but unix doesn't.

I don't see any problem with the reading code, other
than that it is hard to read and possibly has array
bounds problems.

One of my old favorite tricks with unformatted read was
to put the length into the same record:

WRITE(1) N,(X(I),I=1,N)

Legal, but doesn't give you the chance to check N before
using it in:

READ(1) N,(X(I),I=1,N)

Well, it didn't in Fortran 66. Now you could probably do:

READ(1) N,(X(I),I=1,MIN(N,10000))

some Fortran 66 era compilers might have accepted:

READ(1) N,(X(MIN0(I,10000)),I=1,N)

-- glen
From: Steve Lionel on
On 3/4/2010 6:09 PM, onateag wrote:
> I am going to report how I open the files in WRITE and READ mode:
>
> write:
> OPEN (LINKTP, FORM='UNFORMATTED', FILE='tplink')
>
> read:
> OPEN (LINKMC,STATUS='OLD',FORM='UNFORMATTED',FILE='tplink')

Ok. Then please give the other information asked for. If you'd like to
continue this on our user forum, that might work better.
http://software.intel.com/en-us/forums/intel-fortran-compiler-for-linux-and-mac-os-x/

I encourage you to provide the variable declarations and the od hex dump
in 32-bit units of the first 20 lines, at least.

--
Steve Lionel
Developer Products Division
Intel Corporation
Nashua, NH

For email address, replace "invalid" with "com"

User communities for Intel Software Development Products
http://software.intel.com/en-us/forums/
Intel Software Development Products Support
http://software.intel.com/sites/support/
My Fortran blog
http://www.intel.com/software/drfortran
From: Steve Lionel on
On 3/4/2010 6:09 PM, onateag wrote:

> yes, I am using the Intel compiler.
>

Ah, I see you provided the information in another post.

Which version of Intel Fortran are you using? Show the output of an
"ifort -V" command.

--
Steve Lionel
Developer Products Division
Intel Corporation
Nashua, NH

For email address, replace "invalid" with "com"

User communities for Intel Software Development Products
http://software.intel.com/en-us/forums/
Intel Software Development Products Support
http://software.intel.com/sites/support/
My Fortran blog
http://www.intel.com/software/drfortran
From: glen herrmannsfeldt on
Steve Lionel <steve.lionel(a)intel.invalid> wrote:
(snip)

> I encourage you to provide the variable declarations and the od hex dump
> in 32-bit units of the first 20 lines, at least.

Another reason I like big-endian machines better.

-- glen
From: Richard Maine on
glen herrmannsfeldt <gah(a)ugcs.caltech.edu> wrote:

> Steve Lionel <steve.lionel(a)intel.invalid> wrote:
> (snip)
>
> > I encourage you to provide the variable declarations and the od hex dump
> > in 32-bit units of the first 20 lines, at least.
>
> Another reason I like big-endian machines better.

Yeah. I have to stand on my head and look at it crosseyed in a mirror
(or something like that) to make sense of things like hex dumps like
this. Gives me a headache. :-)

Or my real secret is that instead of trying to figure it out logically,
I find it quicker and easier to "cheat". A 3-line test program (2 of
them being the program and end statements) suffices to make a file that
I can do a hex dump on and verify that, " yep, that's the order things
come out in".

--
Richard Maine | Good judgment comes from experience;
email: last name at domain . net | experience comes from bad judgment.
domain: summertriangle | -- Mark Twain