Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Trouble reading user input

Status
Not open for further replies.

Sylvialn

IS-IT--Management
Dec 28, 2000
101
US
I am currently working on an IBM PowerPC64 Blade, using a RHELinux3.0AS operating system, with Absoft 95 as the fortran compiler. I have a mixture of Fortran 77 & 90 code.

I am trying to insert a couple lines of code into either the 77 or 90 code, that will: pause and prompt the user for some number, print out that number, then continue on it’s way.

I understand it is fairly easy to do this and have seen this done in various ways:

write(*,*) ‘Enter number ‘
read(*,*) numb
write(*,*) ‘Number was ‘, numb

or

write(*,’(I,$)’) ‘Enter number ‘
read(*,’(I)’) numb
write(*,*) ‘Number was ‘, numb

or

write(6,*) ‘Enter number ‘
read(5,*) numb
write(*,*) ‘Number was ‘, numb

or

write(6, ‘(I,$)’) ‘Enter number ‘
read(5,’(I)’) numb
write(*,*) ‘Number was ‘, numb

or

using FORMAT statements like

write(*, 2)
2 FORMAT (‘Enter number: ‘, $)

etc.

I have tried all these ideas and nothing seems to stop the program in order to get the value. What happens is the program simply continues on and the output looks like this:

1130271200 Number entered was= 0

I assume the numbers in front are my first write & read statements. Does anyone have an idea of what is going on? Why it is not stopping for input? Any help or guidance would be much appreciated. Thank you,
Sylvia

"Try everything at least once."
 
Try...

integer number
print*,'Enter number'
read*,number
print*,'Number was',number
end
 
Thank you. I did try that (finally, after our server was restored). However, it still does not work. I get the following output:

Enter number please
? FORTRAN Runtime Error:
? Attempt to read past end of file
? READ(UNIT=*,...


It seems it just is not pausing to wait for user input. Any other suggestions?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top