View previous topic :: View next topic |
Author |
Message |
kingkastle
Joined: 22 May 2008 Posts: 20
|
Posted: Mon Nov 03, 2008 12:08 pm Post subject: Q FOrMAT |
|
|
Hi,
I�m comparing a code writted in 77 FORTRAN Version with the PLato compiler. When I move this code from 77 to PLato, the code is not working.... . I found that my boss (which uses 77) defines Q in the format... I never heard about Q in the format....., maybe the error is here
Do you know what�s this Q? do you know if Plato supports it??
Any comment is really appreciated
Thanks in advance and best regards |
|
Back to top |
|
 |
PaulLaidler Site Admin
Joined: 21 Feb 2005 Posts: 8210 Location: Salford, UK
|
Posted: Mon Nov 03, 2008 2:02 pm Post subject: |
|
|
The standard edit descriptors are listed in the help file under "FORMAT edit descriptors". Extensions are given under "Business Editing".
Q is not mentioned and I have not seen this before. |
|
Back to top |
|
 |
JohnHorspool
Joined: 26 Sep 2005 Posts: 270 Location: Gloucestershire UK
|
Posted: Mon Nov 03, 2008 2:24 pm Post subject: |
|
|
Kingkastle,
Q format descriptor was never part of the Fortran 77 standard. Thus your source is non-standard and the chances are that there may well be more non-standard (compiler specific) extensions to the standard lurking within the code that ftn95 will object to. |
|
Back to top |
|
 |
JohnCampbell
Joined: 16 Feb 2006 Posts: 2615 Location: Sydney
|
Posted: Mon Nov 03, 2008 10:54 pm Post subject: |
|
|
I'm not sure, but I recall that Q format was hex format in Prime or Vax fortran. The clue may be in the rest of format descriptor, say Q10.
The solution is to replace it with a standard format that is consistent with the variable type being used.
If it is used to write to a file, there is little to wory about. If it is being read then it may need more research.
John |
|
Back to top |
|
 |
IanLambley
Joined: 17 Dec 2006 Posts: 506 Location: Sunderland
|
Posted: Thu Nov 06, 2008 1:42 pm Post subject: |
|
|
In Vax fortran77, the Q format allowed you to determine the number of characters on the line, i.e. record length on a formatted file with arbitary lengths for each line.
I used to use it to determine how many trailing spaces were actually on the line. For example if the input contained:
hello there||||||[eol]
where i have used | to represent a space, & [eol] is end of line, then
Code: |
character*100 text
open(unit=10,file='myfile.txt',status='old')
read(10,1000,end=999)ilen,text
1000 format(q,a)
|
would return ilen=17 in the above example.
In FTN95, the equivalent would be:
Code: |
character*100 text
integer*2 attr,handle,error_code
attr=0
call OPENF@('myfile.txt',ATTR,HANDLE,ERROR_CODE)
call READFA@(text, HANDLE, ilen, ERROR_CODE)
if(ilen .eq. -1)goto 999
|
|
|
Back to top |
|
 |
|