Silverfrost Forums

Welcome to our forums

ERROR 94 plz help me...very urgent

3 Feb 2012 4:57 #9577

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

   ** [color=red:5de370c95e]write(wunit,104) 'R','run.number'[/color:5de370c95e]**

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]
3 Feb 2012 4:58 #9578

the above is the SHORT CODING lines of the program, the RED line indicate the ERROR in the program.....

3 Feb 2012 8:49 #9579

The problem in the code example you have provided is that the program is using fortran unit 1 to open a file, eg

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

4 Feb 2012 4:53 #9583

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.....

5 Feb 2012 10:55 #9584

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

6 Feb 2012 6:08 #9585

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...

6 Feb 2012 12:48 #9586

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:

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.

10 Feb 2012 7:18 #9591

wat i have to do..???

10 Feb 2012 2:59 #9592

Quoted from mmaharish 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 [u:9b950c4550]you[/u:9b950c4550] are responsible for.

10 Feb 2012 3:49 #9594

What you have to do is locate all occurances of the open and close statements and determine what each is being used for. Then if they are file usage, and they are a unit less than say 10, change them to a higher number. It is best to allocate an integaer variable and transfer it via subroutine call statements or common blocks for example. All read and write statements between these open and close statements should also be made to match the appropriate unit number. Note, read(,) and write(,) & Print * are probably intended to refer to keyboard and screen respectively.

Basically you need to determine the structure of your program's input/output and adjust the unit numbers.

Note on some very old computers, the unit numbers are assigned to the files and other devices using operating system commands rather than Fortran open and close statements. and example could be:

program io_example

!include these two lines in all subroutines/functions where reads and writes occur
!also in main program or an initialisation routine to set their values
integer*4 keyboard_unit, Screen_unit, input_file_unit,output_file_unit
common/io_units/ keyboard_unit, Screen_unit,input_file_unit,output_file_unit

!allocate units
keyboard_unit = 5
Screen_unit     = 6
input_file_unit = 10
output_file_unit = 11
.
.
.
call input_routine
call output routine
.
.
end

subroutine input_routine
integer*4 keyboard_unit, Screen_unit, input_file_unit,output_file_unit
common/io_units/ keyboard_unit, Screen_unit,input_file_unit,output_file_unit
common/data/a,b,c
character*256 input,output
!prompt or input file name
write(screen_unit,*)'Input file'
read(keyboard_unit,'(a)')input
!if not blank, then open file
if(input .ne. ' ')then
  open(unit=input_file_unit,file=input,status='unknown')
!read some input data
  read(input_file_unit,*)a,b,c
  close(unit=input_file_unit)
!prompt for output file name
  write(screen_unit,*)'Output file'
  read(keyboard_unit,'(a)')output
!open the file
  open(unit=output_file_unit,file=output,status='unknown')
else
  stop
endif
end



subroutine output_routine
integer*4 keyboard_unit, Screen_unit, input_file_unit,output_file_unit
common/io_units/ keyboard_unit,Screen_unit,input_file_unit,output_file_unit
common/data/a,b,c
write(output_file_unit,*)'Input data'
write(output_file_unit,*)a,b,c
write(output_file_unit,*)'Output data'
write(output_file_unit,*)a+b*c
close(unit=output_file_unit)
end
Please login to reply.