 |
forums.silverfrost.com Welcome to the Silverfrost forums
|
View previous topic :: View next topic |
Author |
Message |
jjgermis
Joined: 21 Jun 2006 Posts: 404 Location: N�rnberg, Germany
|
Posted: Thu Jan 14, 2010 1:10 pm Post subject: Compiling old style Fortran |
|
|
I am using FTN95 to compile a relative old style fortran program. A few useful tips on this topic I found at:
1.) http://cs.ubishops.ca/ljensen/fortran/oldfort.htm and
2.) http://userpage.chemie.fu-berlin.de/diverse/doc/f77_info.html
I get several errors to that I am not familair with. Like the & in the parameter list from a subroutine, i.e. Code: | CALL A11ANFA
1 (ASCHUZ,ABAUFO,ATE,ALPHA1,BU,B1S,BS1S,C1,C2,DA2,DI2S,F1,FVFE,
2 FFE,GMINUS,HU,HS4,IPROGR,ITYP,IBL,IWART,IMPR,IHI,IHJ,IHN,IHM,
3 IHR,IHW,KBLANK,KAPPAT,LFR,MART,MBART,N2,NUMMER,N6,NRECHN,
4 PNS,PZ,PN,PI,RV2,UN,UREDS,V20,XV2,DKF,GAMFE,
5 &9999) | I have seen * before. What does the following message mean anf how should I correct it?
error 174 - Unexpected '&' in expression
Another part of the code that I do not understand is: Code: | CHARACTER*1 Z27,ZF9,ZF4
DATA Z27,ZF9,ZF4/Z27,ZF9,ZF4/ | Here I get the following error:
fatal 287 - All items in a DATA statement's value list must be literal constants |
|
Back to top |
|
 |
sparge
Joined: 11 Apr 2005 Posts: 371
|
Posted: Thu Jan 14, 2010 1:43 pm Post subject: |
|
|
Not sure about the first one because I don't understand what the & is doing in the source code myself, so if I weere a compiler I'd probably output much the same error message.
For the second one, I am (intelligently) guessing it implements some compiler-specific way of rendering a constant in hexadecimal notation, and FTN95 is objecting because its own specific syntax is slightly different. I think this will work:
CHARACTER*1 Z27,ZF9,ZF4
DATA Z27,ZF9,ZF4/Z'27',Z'F9',Z'F4'/
Andy |
|
Back to top |
|
 |
PaulLaidler Site Admin
Joined: 21 Feb 2005 Posts: 8210 Location: Salford, UK
|
Posted: Thu Jan 14, 2010 2:01 pm Post subject: |
|
|
&9999 is probably intended to represent a label for an "alternate return".
This is not standard Fortran which uses a * not &. |
|
Back to top |
|
 |
jjgermis
Joined: 21 Jun 2006 Posts: 404 Location: N�rnberg, Germany
|
Posted: Thu Jan 14, 2010 2:29 pm Post subject: |
|
|
I replaced & with * and it seems to solve the problem. Furthermore, I tried
Code: | DATA Z27,ZF9,ZF4/Z'27',Z'F9',Z'F4'/ | and now get the following message.
error 1001 - You cannot use the CHARACTER(LEN=4) constant 39 to initialise the CHARACTER(LEN=1) variable Z27
I have never seen a DATA statement as above and cannot reall tell what is happening before I get the code to compile without any errors - the code appears in the main part. It compiles fine with IVF but I would like to get it working with FTN95 and use ClearWin+.
Quote: | FTN95 permits the use of B, O and Z constants anywhere in a program (the standard specifies these should only appear in DATA statements.) To specify the size of the constant, a kind specifier should appear after the constant, e.g. "Z'7F'_1" is an INTEGER(KIND=1) constant. |
|
|
Back to top |
|
 |
jjgermis
Joined: 21 Jun 2006 Posts: 404 Location: N�rnberg, Germany
|
Posted: Thu Jan 14, 2010 3:11 pm Post subject: |
|
|
If I have some code as given below, what does it mean. Hexadecimal seems to be some hint in the right direction. However, I have no clue what this should do. Code: | program data_test
implicit none
CHARACTER(len=1) Z27,ZF9,ZF4
DATA Z27,ZF9,ZF4/Z'27',Z'F9',Z'F4'/
write(*,'(A)') Z27
end program data_test |
|
|
Back to top |
|
 |
sparge
Joined: 11 Apr 2005 Posts: 371
|
Posted: Thu Jan 14, 2010 5:25 pm Post subject: Re: |
|
|
[quote="jjgermis"]I replaced & with * and it seems to solve the problem. Furthermore, I tried
Code: | DATA Z27,ZF9,ZF4/Z'27',Z'F9',Z'F4'/ | and now get the following message.
error 1001 - You cannot use the CHARACTER(LEN=4) constant 39 to initialise the CHARACTER(LEN=1) variable Z27
Doh! Of course. A hex value is not of type character. Z'27' = 39 != char(39) etc. This compiles:
CHARACTER*1 Z27,ZF9,ZF4
DATA Z27,ZF9,ZF4/char(Z'27'),char(Z'F9'),char(Z'F4')/
Though why you would want to do this (and whether it is what the original code did) is not apparent to me ... |
|
Back to top |
|
 |
jjgermis
Joined: 21 Jun 2006 Posts: 404 Location: N�rnberg, Germany
|
Posted: Fri Jan 15, 2010 7:05 am Post subject: |
|
|
Thanks Andy! It compiles now. The program was developed when memory was a problem and a lot of data exchange is done via files (at least that what I assume). The given variables are only used as (probably) some specific format.
Code: | program data_test
implicit none
CHARACTER(len=1) Z27,ZF9,ZF4
DATA Z27,ZF9,ZF4/char(Z'27'),char(Z'F9'),char(Z'F4')/
write(*,'(A)') Z27//'-'//ZF9//'-'//ZF4
end program data_test |
|
|
Back to top |
|
 |
jjgermis
Joined: 21 Jun 2006 Posts: 404 Location: N�rnberg, Germany
|
Posted: Fri Jan 15, 2010 8:21 am Post subject: |
|
|
Maybe someone has experiecend the same: Three years ago (before my time here) it was recognised to update the compilers. For this several compilers were tested (my first choice would have been FTN95). From the tests FTN95 produced the most warnings and errors and based on this was not used.
I compiled the code from then to see what happens (using FTN95). I now realise that FTN95 discovered some errors which the other compilers allowed. |
|
Back to top |
|
 |
JohnHorspool
Joined: 26 Sep 2005 Posts: 270 Location: Gloucestershire UK
|
Posted: Fri Jan 15, 2010 8:57 am Post subject: |
|
|
Quote: | For this several compilers were tested ..... . From the tests FTN95 produced the most warnings and errors and based on this was not used. |
And I thought that this level of stupidity only occured in the UK.
It just beggars belief, jjgermis I hope that you manage to convince them of the error of their ways, good luck! |
|
Back to top |
|
 |
jjgermis
Joined: 21 Jun 2006 Posts: 404 Location: N�rnberg, Germany
|
Posted: Fri Jan 15, 2010 11:44 am Post subject: |
|
|
With the help from the Silverfrost forum I managed to compile the old style Fortran. In doing so I also discovered some errors in the code (good old FTN95). The first facelift was to change the (punched card style) input file (that has no text and only numbers) with a very simple XML-file. It might sound crazy, but associating software with XML already makes it modern! The next step would be to collect the user data using ClearWin+. I cannot wait to see the expressions of my colleagues when I inform them everything is done using FTN95
The XML-parser link: http://xml-fortran.sourceforge.net |
|
Back to top |
|
 |
jjgermis
Joined: 21 Jun 2006 Posts: 404 Location: N�rnberg, Germany
|
Posted: Sun Jan 17, 2010 5:40 pm Post subject: |
|
|
I must admit that working through old style Fortran is sometimes not that easy. Especially the way do-loops, if-then and goto lables are implemented takes a while to get used to. However, there is also a solution available to this Beside the above mentioned link there is very useful software that I can recommend, i.e. http://www.scitools.com. I personaly like the graphical presentation of the calls from the main program.
It would be interessting to know what other possibilties are available to analyse source code. |
|
Back to top |
|
 |
jjgermis
Joined: 21 Jun 2006 Posts: 404 Location: N�rnberg, Germany
|
Posted: Tue Jan 19, 2010 4:16 pm Post subject: |
|
|
Two useful converters from Fortran 77 to Fortran 90 are:
1.) to_f90.f90 by A. Miller and
2.) convert.f90 by Michael Metcalf
and can be found at http://www.unics.uni-hannover.de/zzzzwg1/frei.html
At the same link there is a reference to Salford/Silverfrost's Personal Edition  |
|
Back to top |
|
 |
PaulLaidler Site Admin
Joined: 21 Feb 2005 Posts: 8210 Location: Salford, UK
|
Posted: Wed Jan 20, 2010 8:53 am Post subject: |
|
|
You could also try using the FTN95 command line option /CONVERT but this is rather limited. |
|
Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|