 |
forums.silverfrost.com Welcome to the Silverfrost forums
|
View previous topic :: View next topic |
Author |
Message |
mmaharish
Joined: 31 Jan 2012 Posts: 29 Location: Chennai,India
|
Posted: Thu Feb 02, 2012 5:53 am Post subject: |
|
|
Im having many fortran files, i have to run the project. i dont know which is the first file i have to run. please help me to run. |
|
Back to top |
|
 |
mmaharish
Joined: 31 Jan 2012 Posts: 29 Location: Chennai,India
|
Posted: Thu Feb 02, 2012 12:42 pm Post subject: |
|
|
anyone there??????????? |
|
Back to top |
|
 |
mecej4
Joined: 31 Oct 2006 Posts: 1899
|
Posted: Thu Feb 02, 2012 1:22 pm Post subject: Re: |
|
|
mmaharish wrote: | anyone there??????????? |
Yes, I am here, as are others.
However, we cannot help when you ask questions without providing context. Nor is this the place to come before reaching a minimal level of competence in Fortran program development.
The error message is clear enough. Your program is attempting to read or write from a file which has not been opened. You have not shown any OPEN statements in the code fragments that you showed.
Reading the Salford compiler documentation would have informed you of this fact. |
|
Back to top |
|
 |
mmaharish
Joined: 31 Jan 2012 Posts: 29 Location: Chennai,India
|
Posted: Thu Feb 02, 2012 2:54 pm Post subject: |
|
|
Im new to fortran so i don't know anything, but im having codings. My boss asked me to run the project. it consists of many fortran files, so i need help. i run one program that too is showing error. What i have to do now.?? |
|
Back to top |
|
 |
brucebowler Guest
|
Posted: Thu Feb 02, 2012 4:02 pm Post subject: Re: |
|
|
mmaharish wrote: | What i have to do now.?? |
Show us a *complete*, *short* program that demonstrates the problem. In this context, short means 25 lines of code or less. |
|
Back to top |
|
 |
davidb
Joined: 17 Jul 2009 Posts: 560 Location: UK
|
Posted: Thu Feb 02, 2012 9:27 pm Post subject: Re: |
|
|
mmaharish wrote: | What i have to do now.?? |
Well you could ask your boss how to run the program!
As there don't seem to be any open statements in your program, perhaps it relies on the user re-directing "standard input" to read from your input file.
Assuming your program is called PROGRAM and your input file is called FILE try typing the following from a command window.
PROGRAM < FILE _________________ Programmer in: Fortran 77/95/2003/2008, C, C++ (& OpenMP), java, Python, Perl |
|
Back to top |
|
 |
mmaharish
Joined: 31 Jan 2012 Posts: 29 Location: Chennai,India
|
Posted: Fri Feb 03, 2012 5:57 am Post subject: |
|
|
Increment the run counter
c
include "mc.inc"
integer jj,startgene,tnumzf
startgene=0
open(unit=1,file='run.number',status='old',err=121)
read(1,103) thisfn(1),thisfn(2),thisfn(3),thisfn(4),
1 runnum,startgene,tnumzf,jj
close(unit=1)
runnum=runnum+1
if(jj .eq. 9) then
c Macintosh
runit=9
wunit=9
barrier=':'
fchar='c'
else
c SGI
wunit=2
runit=5
barrier='/'
fchar='/'
endif
write(wunit,104) 'R','run.number'
104 format(a1,'-',a10)
open(unit=1,file='run.number',status='old')
rewind(unit=1)
write(1,103) thisfn(1),thisfn(2),thisfn(3),thisfn(4),
1 runnum,startgene,numzf,jj
103 format(4a1,5i5)
write(wunit,102) runnum
102 format('Run=',i9,' ')
close(unit=1)
goto 122
121 continue
write(wunit,123)
123 format('RUN.NUMBER file missing')
stopprog=.true.
122 continue
end
block data
c-----------------------------------------------------------------------
c
c Initialize the data statements
c
include "mc.inc"
data chonear /'0','1','2','3','4','5','6','7','8','9',
1 ' ','-',' ','*','o','|',
1 'f','g','h','i','j',
1 'k','l','m','n','o',
1 'p','q','r','s','t',
1 'u','v','w','x','y',
1 'z','A','B','C','D',
1 'E','F','G','H','I',
1 'J','K','L','M','N',
1 'O','P','Q','R','S'/
data schrlimit /10,10,10,10,10,
1 10,10,10,10,10,
1 10,10,10,10,10,
1 10,10,10,10,10,
1 10,10/
end
[/b] |
|
Back to top |
|
 |
mmaharish
Joined: 31 Jan 2012 Posts: 29 Location: Chennai,India
|
Posted: Fri Feb 03, 2012 5:58 am Post subject: |
|
|
the above is the SHORT CODING lines of the program, the RED line indicate the ERROR in the program..... |
|
Back to top |
|
 |
JohnCampbell
Joined: 16 Feb 2006 Posts: 2615 Location: Sydney
|
Posted: Fri Feb 03, 2012 9:49 am Post subject: |
|
|
The problem in the code example you have provided is that the program is using fortran unit 1 to open a file, eg
Quote: | open(unit=1,file='run.number',status='old')
|
Historically, different fortran compilers reserved different file unit numbers for different usage, such as
5 for default reading, 6 for writing or 7 for errors (Lahey), or
1 (or *) for default reading and writing (Salford)
To correct the problem, you need to change all usage of 1 to another number, such as 11. I always start from 11 when using file unit numbers to open files.
I note that there is code to select unit numbers for SGI or Macintosh.
You need to check this usage and determine if "runit" and "wunit" refer to the default user interface or to files. If they are the "default user interface", then they should both be set to 1, which is for Salford.
You need to check all usage of read, write, open, close, rewind.
You can use the DOS command FIND to do this.
John |
|
Back to top |
|
 |
mmaharish
Joined: 31 Jan 2012 Posts: 29 Location: Chennai,India
|
Posted: Sat Feb 04, 2012 5:53 am Post subject: |
|
|
I don't know FORTRAN plz tell me how to run in the command prompt... but my boss told these programs are already executed...now you have to run....my boss friend gave all programs and went..my boss too don't know how to run....plz tell step by step..my kind request to u friendzzz..... |
|
Back to top |
|
 |
JohnCampbell
Joined: 16 Feb 2006 Posts: 2615 Location: Sydney
|
Posted: Sun Feb 05, 2012 11:55 pm Post subject: |
|
|
I am reluctant to help, as this looks like a project destined for disaster.
You need someone who has some knowledge of both running fortran and also what the program is doing. The best source may be to contact "my boss friend", although given the amount of input he appears to have provided, he may not know much of what is required.
What you need to do is:
1) Understand how to get a program runing with FTN95, presumably the free compiler you found.
2) As this is old style code (fixed format), it is probably pre Fortran 90, hence the use of unit 1 for file access. There will probably be other non-standard usage which needs to be verified. (The code sample implies it supports Mac and SGI which are more recent, so there may be minimal change required? Neither are Win/Intel)
3) Learn how to compile (with FTN95) then link (with SLINK) to produce a .exe "run" file.
4) Once you have the program running, you need to confirm that the existing data sets can reproduce past run results.
5) Then you can propose new data sets and see how confident you are in using these results.
Start reading the documentation !
John |
|
Back to top |
|
 |
mmaharish
Joined: 31 Jan 2012 Posts: 29 Location: Chennai,India
|
Posted: Mon Feb 06, 2012 7:08 am Post subject: |
|
|
1.I'm using PLATO IDE, so i run the program using that
2. How to use the unit 1 for file access.?
3. Whilr im running the program the .exe file is created in my local machine, but it says UNIT is NEITHER been opened nor PRECONNECTED
4. your 4th point i cant able 2 understand.
5. also 5th... |
|
Back to top |
|
 |
IanLambley
Joined: 17 Dec 2006 Posts: 506 Location: Sunderland
|
Posted: Mon Feb 06, 2012 1:48 pm Post subject: |
|
|
Item 2 - Don't use unit=1 for file access. It can be done, but if you specifically open a file on that unit number and then close it, it will be totally disconnected. Prior to opening it, unit=1 can be by default (preconnected) allow input from the keyboard. Any subsequent attempts to read from the keyboard will then fail. Some compilers use defaults of 5 for keyboard input and 6 for screen output. Others use 1 & 2. It is best therefore to use higher numbers for input and output to files and steer well clear of the preconnected units in the range 1 to 6. Therefore start at 10 for files.
Commands like read(*,*)a read from either unit=1 or unit=6 depending on the compiler, so if you do the following:
Code: |
read(*,*)akeyboard_value
open(unit=1,file=myfile.txt',status='unknown')
read(1,*)avalue
close(unit=1)
read(*,*)another_keyboard_value |
then you will have lost connection to the keyboard and the latter read(*,*)another_keyboard_value will fail.
Item 4 & 5 - You need to find a copy of any original input data and its corresponding output and check that the newly compiled version produces the same result. That result may be correct for only the test data and you should try variations on that data to cover your range of application and try several test cases by appraising or handchecking the output for the resonableness of the result. Then you can use the program with confidence. |
|
Back to top |
|
 |
mmaharish
Joined: 31 Jan 2012 Posts: 29 Location: Chennai,India
|
Posted: Fri Feb 10, 2012 8:18 am Post subject: |
|
|
wat i have to do..??? |
|
Back to top |
|
 |
mecej4
Joined: 31 Oct 2006 Posts: 1899
|
Posted: Fri Feb 10, 2012 3:59 pm Post subject: Re: |
|
|
mmaharish wrote: | wat i have to do..??? |
That has been answered by a number of people in this thread.
Educate yourself so that you can do what needs to be done, and do so in a way that is mindful of what you are responsible for. |
|
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
|