Print

Print


Richard Maine wrote:

> Van Snyder writes:
>  >   print "('DIR hex = ', z8,', DIR decimal =', f9.6)", dir, dir
>  ...
>  > *** FORTRAN I/O ERROR 957: FORMAT DESCRIPTOR INCOMPATIBLE WITH NUMERIC ITEM IN I/O LIST
>  > 
>  > This sounds like a bug in my compiler/run-time, but I might have spelled
>  > something wrong.  The F90 standard says the input shall consist of hex
>  > digits, ...
> 
> I suspect you are looking at the wrong line in your program.  Look at
> the print statements instead of the READ statements.  Note also that
> an I/O "list item" is one of the things in the i/o statement in the
> source code - it isn't the data in the file.  So compare the list
> items to the format descriptors instead of comparing the file contents
> to the data descriptors.
> 
> In particular, the Z edit descriptor is for integers and you are
> trying to print a real (dir) with it.  I suspect that therein lies your
> problem.

Richard is right.  If I
  print "('DIR hex = ', z8,', DIR decimal =', f9.6)", idir, idir
then it works.  I got the hex value I was trying to print by using
  print "('DIR hex = ', z8,', DIR decimal =', f9.6)", dir, dir
in a different program, compiled with the same compiler, which is why
I expected to be able to write a REAL using Z8 format.  (I should have
been suspicious when reading a REAL didn't work.)  It makes one wonder
why it worked in one place and not the other.

Best regards,
Van




%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%