View previous topic :: View next topic |
Author |
Message |
jkyun
Joined: 23 Jul 2008 Posts: 10
|
Posted: Thu Jul 24, 2008 2:58 pm Post subject: Could you give me some examples of compiling under \FTN95 ? |
|
|
I used to use FORTRAN 77 under VAX and IBM. Several years ago I used COMPAQ made FORTRAN Compiler. I used to use the command as follows:
FORT Filename.for
LINK Filename
RUN Filename
But I have faced continuous error messages - in other words, I cannot even compile my source code file.
Could anyone help me by sending few examples for me to go along step by step? |
|
Back to top |
|
 |
Wilfried Linder
Joined: 14 Nov 2007 Posts: 314 Location: D�sseldorf, Germany
|
Posted: Thu Jul 24, 2008 3:18 pm Post subject: |
|
|
Hi,
I guess that you prefer to work from the command line? Usually you should use SIDE or PLATO, but for the first steps you may go on like this:
(a) compile all your files with
c:\...\salford\ftn95\ftn95 /silent /fixed_format *.for
(b) create a file modules.txt containing
lo c:\<source code directory>\*.obj
file c:\<...>\name_of_programme.exe
(c) link using
c:\...\salford\ftn95\slink modules.txt
Regards,
Wilfried |
|
Back to top |
|
 |
jkyun
Joined: 23 Jul 2008 Posts: 10
|
Posted: Thu Jul 24, 2008 9:48 pm Post subject: I still get a error message |
|
|
While I am doing the step (a), I am getting the error message as follows:
*** Source file 'readcusip.for' cannot be opened
'readcusip.for' is written in ASCII (notepad). Does this cause problem? |
|
Back to top |
|
 |
JohnHorspool
Joined: 26 Sep 2005 Posts: 270 Location: Gloucestershire UK
|
Posted: Thu Jul 24, 2008 10:07 pm Post subject: |
|
|
Are you working from a DOS window in the directory containing your source code file?
Yes, it should be an ascii text file (as produced by notepad), but that's not your problem, either you are trying to compile in the wrong directory or you don't have permission to read the file or write into that directory. |
|
Back to top |
|
 |
jkyun
Joined: 23 Jul 2008 Posts: 10
|
Posted: Thu Jul 24, 2008 10:26 pm Post subject: The source code file is in the same directory |
|
|
If:
(1) the source code file 'readcusip.for' is in the same directory
(2) the source code file 'readcusip.for' is written in ASCII text using notepad
then what would be the possible cause of error message? |
|
Back to top |
|
 |
LitusSaxonicum
Joined: 23 Aug 2005 Posts: 2403 Location: Yateley, Hants, UK
|
Posted: Thu Jul 24, 2008 10:32 pm Post subject: |
|
|
Look at the subdirectory listing and check that your file hasn't been named (by Notepad) something daft like 'readcusip.for.txt' !
Eddie |
|
Back to top |
|
 |
jkyun
Joined: 23 Jul 2008 Posts: 10
|
Posted: Thu Jul 24, 2008 11:33 pm Post subject: Now I have found why I could not compile the source file |
|
|
Yet I am used to FORTRAN 77 language and all my source files are written in FORTRAN 77 acceptable language. Could you let me know where I need to look up tp learn the changes between FORTRAN 77 to FORTRAN 95 (or conversion of F77 to F95)?
As you see below, I receive the error messages:
Setting Environment for FTN95 Win32
C:\Program Files\Silverfrost\FTN95>ftn95 /silent/fixed_format *.for
[FTN95/Win32 Ver. 5.21.0 Copyright (c) Silverfrost Ltd 1993-2008]
*** *.for does not match any source files
1 ERROR [] - Compilation failed.
C:\Program Files\Silverfrost\FTN95>dir *.for
Volume in drive C has no label.
Volume Serial Number is 6497-C3F6
Directory of C:\Program Files\Silverfrost\FTN95
File Not Found
C:\Program Files\Silverfrost\FTN95>ftn95 /silent/fixed_format readcusip.for
[FTN95/Win32 Ver. 5.21.0 Copyright (c) Silverfrost Ltd 1993-2008]
*** Source file 'C:\Program Files\Silverfrost\FTN95\readcusip.for' cannot be
opened
C:\Program Files\Silverfrost\FTN95>dir *.txt
Volume in drive C has no label.
Volume Serial Number is 6497-C3F6
Directory of C:\Program Files\Silverfrost\FTN95
07/17/2008 05:01 PM 886 READCUSIP.FOR.txt
02/18/2008 12:32 AM 9,491 readme.txt
2 File(s) 10,377 bytes
0 Dir(s) 24,511,225,856 bytes free
C:\Program Files\Silverfrost\FTN95>ftn95 /silent/fixed_format readcusip.for.txt
[FTN95/Win32 Ver. 5.21.0 Copyright (c) Silverfrost Ltd 1993-2008]
0017) OPEN(UNIT=10,NAME='COMPSTATCIKCUSIP.DAT',
0018) * TYPE='OLD', READONLY)
*** Keyword NAME is not allowed with OPEN
*** This expression cannot receive a value, from the I/O keyword NAME
*** TYPE is not a recognised keyword in OPEN
*** Non-keyword specifiers must appear before keyword specifiers
0020) OPEN(UNIT=12,NAME='COMPCIKCUSIP9.DAT',
0021) * TYPE='NEW',RECORDTYPE=
0022) * 'VARIABLE',RECORDSIZE=500,CARRIAGECONTROL='LIST')
*** Keyword NAME is not allowed with OPEN
*** This expression cannot receive a value, from the I/O keyword NAME
*** TYPE is not a recognised keyword in OPEN
*** RECORDTYPE is not a recognised keyword in OPEN
*** RECORDSIZE is not a recognised keyword in OPEN
*** CARRIAGECONTROL is not a recognised keyword in OPEN
10 ERRORS [<main program> FTN95/Win32 v5.21.0]
*** Compilation failed |
|
Back to top |
|
 |
JohnCampbell
Joined: 16 Feb 2006 Posts: 2615 Location: Sydney
|
Posted: Fri Jul 25, 2008 1:54 am Post subject: |
|
|
In a "dos box" (cmd.exe) try the following
ren readcusip.for.txt readcusip.for
ftn95 readcusip
slink
lo readcusip
map
file
readcusip
or even try
ftn95 readcusip /lgo
ftn95 /help will get help
the commands :
lo readcusip
map
file
could be placed in a text file, such as load.txt and then use the command
slink load.txt. Then all commands could be placed in a batch file.
You should change "NAME=" to "FILE=",
although I did not see the file 'COMPCIKCUSIP9.DAT' listed in your directory.
FTN95 help file can provide more information on fortran 95 standard use of OPEN. It is much better than the old FTN or FTN77 days.
the file name as .for implies that the file is fixed format fortran.
I use a .f95 extension and free format.
John |
|
Back to top |
|
 |
LitusSaxonicum
Joined: 23 Aug 2005 Posts: 2403 Location: Yateley, Hants, UK
|
Posted: Fri Jul 25, 2008 9:15 am Post subject: |
|
|
Aha! I was right about the horrid .txt on the end.
After renaming, it is even easier than you thought: try
ftn95 -lgo readcusip.for
As for fortran 90 or 95, try:
http://www.nsc.liu.se/~boein/f77to90/f77to90.html
or
http://www.star.le.ac.uk/~cgp/f90course/f90.html#tth_sEc1.1
Beware. These web references tell you that Fortran 90 is "better" than Fortran 77. It may or may not be. It is often very different. Many of the features are simply a different - and incompatible - way of doing the same job. The number of additional features is very small - probably zero.
You can use FTN95 as if it was FTN77 - I do. Fortran 95 is basically Fortran 90 with a few refinements.
Eddie |
|
Back to top |
|
 |
jkyun
Joined: 23 Jul 2008 Posts: 10
|
Posted: Wed Jul 30, 2008 5:26 am Post subject: I am still getting an error message as follows: |
|
|
C:\Program Files\Silverfrost\FTN95>ftn95 /silent/fixed_format readcusip.for.txt
[FTN95/Win32 Ver. 5.21.0 Copyright (c) Silverfrost Ltd 1993-2008]
0017) OPEN(UNIT=10,FILE='COMPSTATCIKCUSIP.DAT',ACCESS='DIRECT',RECL=200,
0018) * FORM='FORMATTED',ACTION='READ',STATUS='OLD',ERR=100,REC=22633)
*** Variable FORM follows another operand (possible unexpected space?)
1 ERROR [<main program> FTN95/Win32 v5.21.0]
*** Compilation failed
======================
Actually, I have edited my source program using the reference of FTN95 User's Guide. I have realized some difference. I have tried to follow the Guide as much as I can. Yet I still get the error message about the FORM='FORMATTED'. I do not understand the error message. Did I miss some syntax? Could anyone help me? |
|
Back to top |
|
 |
PaulLaidler Site Admin
Joined: 21 Feb 2005 Posts: 8217 Location: Salford, UK
|
Posted: Wed Jul 30, 2008 7:38 am Post subject: |
|
|
The asterisk symbol (*) is probably in the wrong column.
It should be in column 6. The compiler sets a tab to 8 spaces.
Avoid tabs. |
|
Back to top |
|
 |
JohnCampbell
Joined: 16 Feb 2006 Posts: 2615 Location: Sydney
|
Posted: Wed Jul 30, 2008 10:50 am Post subject: |
|
|
You may know what you are doing, but in my experience :-
1) combining FORM='FORMATTED' with ACCESS='DIRECT' can be difficult to achieve. Do you only need direct access, to achieve backspace ? An alternative could be to use a simple formatted text file and read each line into a character buffer then read the buffer. eg
Character buffer*200
Read (unit=10, fmt='(a)') buffer
Read (buffer,fmt=...) i/o list
You could even have buffer as an array, if you need to go back more than 1 line.
2) ACTION='READ' implies the file already exists, in the correct fixed length format. How did you create the file ?
3) REC=22633; I'm not sure of this in standard fortran either. I would have some file reading approach to determine the number of records.
A few areas where I see possible problems.
John
Code: |
0017) OPEN(UNIT=10,FILE='COMPSTATCIKCUSIP.DAT',ACCESS='DIRECT',RECL=200,
0018) * FORM='FORMATTED',ACTION='READ',STATUS='OLD',ERR=100,REC=22633)
|
|
|
Back to top |
|
 |
JohnHorspool
Joined: 26 Sep 2005 Posts: 270 Location: Gloucestershire UK
|
Posted: Wed Jul 30, 2008 12:15 pm Post subject: |
|
|
Isn't "REC=" only valid with a READ statement? Or is it meant to be a maximum record number, I remember ICL and VAX having something like "MXREC=", but either way I don't believe the standard allows for this anyway. |
|
Back to top |
|
 |
LitusSaxonicum
Joined: 23 Aug 2005 Posts: 2403 Location: Yateley, Hants, UK
|
Posted: Wed Jul 30, 2008 3:00 pm Post subject: |
|
|
From FTN95.chm:
RECL=<value>
<value> is an integer expression, which gives record length in bytes. For direct access files, this specifier is obligatory.
As an extension to the standard, RECL may also be specified for a file opened for sequential access. This causes fixed length records to be read from or written to file and allows a BACKSPACE to be followed by a WRITE. (.... without truncating the file immediately after what was written, it just overwrites one or more records - E.).
Eddie |
|
Back to top |
|
 |
JohnHorspool
Joined: 26 Sep 2005 Posts: 270 Location: Gloucestershire UK
|
Posted: Wed Jul 30, 2008 3:13 pm Post subject: |
|
|
Eddie,
If you inspect the OPEN statement above you will see RECL=200 and REC=22633 as arguments. There is nothing wrong with "RECL=" , but "REC=" does not make sense to me in this context, unless it was some form of setting maximum record length, which is not as far as I know part of the fortran standard.
Cheers,
John |
|
Back to top |
|
 |
|