list-directed read statement works in different way on different platforms 
Author Message
 list-directed read statement works in different way on different platforms

Hi,

I have the following problem:

the list-directed read statement works in different way on different
platforms.
Therefore I have difficulties to port it.

A line of my input data file looks as follows:

A part of the fortran-77 code, which reads this line is:
........
      character*1  proof
      character*78 fname
........
........
........
      open (unit=5,file='motif.27.in')
      read(unit=5,fmt=*,end=1) proof,n1,fname
      close (unit=5)
........
The program compiled under Linux (with f2c+gcc), or on IBM Risc System
workstation  (with f77) reads the input data file without problems.
However, on other
platforms, like Silicon Graphics, HP, SUN, or Digital it does not work,
it breaks down with the message (Silicon Graphics):
***
     list input: incomprehensible list input
     apparent state: unit 5 named motif.27.in
     last format: list io
     Unit 5 is a sequential formatted external file
***  Execution Terminated (112) ***

As I have understood the problem is in the following. The program
compiled under

input.


character.  It
sees there a SPECIAL character and therefore blames for
'incomprehensible list

But
for me it is not a  perfect solution.


character.
Should one compile the code with some special option?

Thank you in advance,
Yuri Shvyd'ko

  ========================================
    Dr. Yuri Shvyd'ko
  ........................................
    II. Institut fuer Experimentalphysik
    Universitaet Hamburg
    Luruper Chaussee 149
    D-22761 Hamburg
    fax:   ++49+40 89982212
    voice: ++49+40 89982200

  ========================================



Wed, 18 Jun 1902 08:00:00 GMT  
 list-directed read statement works in different way on different platforms
Your program works on the PC  (as per Fortran 90 Standard) with:
 DVF 6.0-667a, Salford Ftn95 1.32, and  Lahey  Ftn95  5.00d

DATA characters should not be limited to the Fortran character set,
but rather to the platform's character set  (code page).



-|Hi,
-|
-|I have the following problem:
-|
-|the list-directed read statement works in different way on different
-|platforms.
-|Therefore I have difficulties to port it.
-|
-|
-|A line of my input data file looks as follows:
-|

-|
-|
-|A part of the Fortran-77 code, which reads this line is:
-|........
-|      character*1  proof
-|      character*78 fname
-|........
-|........
-|........
-|      open (unit=5,file='motif.27.in')
-|      read(unit=5,fmt=*,end=1) proof,n1,fname
-|      close (unit=5)
-|........
-|The program compiled under Linux (with f2c+gcc), or on IBM Risc System
-|workstation  (with f77) reads the input data file without problems.
-|However, on other
-|platforms, like Silicon Graphics, HP, SUN, or Digital it does not work,
-|it breaks down with the message (Silicon Graphics):
-|***
-|     list input: incomprehensible list input
-|     apparent state: unit 5 named motif.27.in
-|     last format: list io
-|     Unit 5 is a sequential formatted external file
-|***  Execution Terminated (112) ***
-|
-|As I have understood the problem is in the following. The program
-|compiled under

-|input.
-|

-|character.  It
-|sees there a SPECIAL character and therefore blames for
-|'incomprehensible list

-|But
-|for me it is not a  perfect solution.
-|

-|character.
-|Should one compile the code with some special option?
-|
-|
-|Thank you in advance,
-|Yuri Shvyd'ko
-|
-|  ========================================
-|    Dr. Yuri Shvyd'ko
-|  ........................................
-|    II. Institut fuer Experimentalphysik
-|    Universitaet Hamburg
-|    Luruper Chaussee 149
-|    D-22761 Hamburg
-|    fax:   ++49+40 89982212
-|    voice: ++49+40 89982200

-|  ========================================
-|



Wed, 18 Jun 1902 08:00:00 GMT  
 list-directed read statement works in different way on different platforms

Quote:
>I have the following problem:

>the list-directed read statement works in different way on different
>platforms.

The problem is that in Fortran 77, list-directed input of CHARACTER items
required that the input data be delimited in quotes.  Fortran 90 lifts that
restriction somewhat, as long as the string doesn't contain delimiters
(whitespace, commas, etc.)  I suspect the compilers you tried it with were
F77 compilers that did not support the new Fortran 90 semantics.  Our
Fortran 90 compilers don't have a problem with this.



DIGITAL Fortran Development     http://www.digital.com/info/slionel.html
Compaq Computer Corporation
110 Spit Brook Road, ZKO2-3/N30
Nashua, NH 03062-2698           "Free advice is worth every cent"

DIGITAL Fortran web site: http://www.digital.com/fortran



Wed, 18 Jun 1902 08:00:00 GMT  
 list-directed read statement works in different way on different platforms

Quote:

>  Hi,

> I have the following problem:

> the list-directed read statement works in different way on different
> platforms.

I think this is because you are trying to read character variableswhich
are not contained in  ''.  Tr y using an A format.




Wed, 18 Jun 1902 08:00:00 GMT  
 list-directed read statement works in different way on different platforms


Wed, 18 Jun 1902 08:00:00 GMT  
 list-directed read statement works in different way on different platforms

Quote:

>--------------FAAEB76E140CD6893ADE91A8
>Content-Type: text/plain; charset=us-ascii
>Content-Transfer-Encoding: 7bit

>Hi,

>I have the following problem:

>the list-directed read statement works in different way on different
>platforms.
>Therefore I have difficulties to port it.

>A line of my input data file looks as follows:



   One way is to use formatted i/p (if your i/p file is aligned in
 columns) -- e.g. read( iunit,'(a1,7x,a10...)')proof, ...
 A trickier way is to read a line as one long string and sort it into
substrings by looking for spaces. Not too difficult -- if it's
 important.
 chris


Wed, 18 Jun 1902 08:00:00 GMT  
 list-directed read statement works in different way on different platforms


Wed, 18 Jun 1902 08:00:00 GMT  
 list-directed read statement works in different way on different platforms

Quote:

> the list-directed read statement works in different way on different
> platforms.

Yes, that happens when you don 't stick to the standard.

Quote:
> A line of my input data file looks as follows:


> A part of the Fortran-77 code, which reads this line is:

In Fortran 77, list-directed character data must be quote-delimitted.
Some compilers may let you get by without the quotes, but that is
non-standard and, as you have noticed, non-portable.

F90 allows the quotes to be omited in some cases.  Thus, if you
restrict yourself to f90 compilers, you should be able to read

embedded blanks are one of the things that don't work without
quotes, so if you want the comment part to be handled, you will
need to parse it yourself.

If you need to work with f77 compilers or if you need to
handle the comment field, you will need to do your own parsing
of the line.  Not particularly hard, but I can't give an example
over this rather slow connection from my hotel room.  Perhaps
others will.

--
Richard Maine



Wed, 18 Jun 1902 08:00:00 GMT  
 
 [ 8 post ] 

 Relevant Pages 

1. EAI works (or doesn't work) differently under different platforms

2. Different screen resolutions on different platforms

3. NEWBIE TIP: Reading a file two different ways...from ENGSOL

4. Different ways to read in a file

5. list directed reads - problems in cross platform portability

6. List directed input/Formatted READ statement

7. One object that needs to look different to different senders

8. Call different files in different folder

9. Different window sizes in different sceen resolutions

10. Different printouts on different printers ?

11. To assign different colors to different values of a set parameter

12. Vis that reside in different location but have a same name und different funktion

 

 
Powered by phpBB® Forum Software