GFORTRANdealing without CONOUT$

  • Fortran
  • Thread starter jelanier
  • Start date
In summary, G77 and G95 have been good to me. GFORTRAN does not support CONOUT$. This is the biggest issue.
  • #1
jelanier
67
1
I have been re-writing several old FORTRAN programs to compile with G77 G95 and GFORTRAN.

G77 and G95 have been good to me. I can't say the same for GFORTRAN. The fact that it does not support CONOUT$ is the biggest issue. Some of these old programs liberally use unit 6 and unit 5. When CONOUT$ is available, you can simply open unit 6 with file=CONOUT$ to write to the con again.

While it is possible to write to the con by using write(6,xx) a,b , it does not work if unit 6 has already been used. Even if you close(6), you can not write to the con again. the print *,a,b will not work either.

Play with his test code by commenting out lines and you will see what I mean. Is there a solution?

Thanks,

Jim

program test_con
character(10) a,b,c

a="hello"
b="goodbye"

open (6,file="conout.txt")
write (6,10) a,b
C close(6)

C open (6,file="conout$")
print *,"hello"
write (*,10) a,b


10 format(a10,a10)

end program test_con
 
Technology news on Phys.org
  • #2
I am not sure I fully understand the problem.

First, I read that you re-writing this old programs...why won't you clean them up as you go so they actually work?

I have never tried to open unit 6 and I have never used it for myself...as far as I knew, it was reserved for standard out, just like units 5 and 0 are...

So, if you are having problems with unit 6 just stay away from it, simple.
 
  • #3
gsal said:
I am not sure I fully understand the problem.

First, I read that you re-writing this old programs...why won't you clean them up as you go so they actually work?

I have never tried to open unit 6 and I have never used it for myself...as far as I knew, it was reserved for standard out, just like units 5 and 0 are...

So, if you are having problems with unit 6 just stay away from it, simple.


So in other words...you don't know the answer.
You said :"clean them up as you go so they actually work?" They do work. I don't know what you are talking about with that comment. It just takes more effort with GFORTRAN. Every time you execute a program from the aforementioned compilers, unit 6 is opened. The question is how to initialize unit 6 to con after it has been re-directed to a file. G77 and G95 provide that feature.
 
  • #4
Well, I may not be a computer expert, but I have been programming happily for a couple of decades and helping other people, too, and I am yet to find a problem I cannot programmed...that is not to say that I have solved all the problems that I have found, but there is more than one way to skin a cat...so...

...while you may not like the answer or advice I have given to you, it would allow you to stop wasting time on that issue and move on...

good luck
 
  • #5
gsal said:
Well, I may not be a computer expert, but I have been programming happily for a couple of decades and helping other people, too, and I am yet to find a problem I cannot programmed...that is not to say that I have solved all the problems that I have found, but there is more than one way to skin a cat...so...

...while you may not like the answer or advice I have given to you, it would allow you to stop wasting time on that issue and move on...

good luck

My point is, if you don't know the answer don't reply. Especially if you are going to be a smart-***. I am a design engineer and have been programming in various languages for 39 years. I don't waste time..I learn and find new ways to resolve issues. Smart-*** replies have no place in technical forums.
 
  • #6
jelanier said:
So in other words...you don't know the answer.
You said :"clean them up as you go so they actually work?" They do work. I don't know what you are talking about with that comment. It just takes more effort with GFORTRAN. Every time you execute a program from the aforementioned compilers, unit 6 is opened. The question is how to initialize unit 6 to con after it has been re-directed to a file. G77 and G95 provide that feature.

What version of gfortran are you using? It says here (http://gcc.gnu.org/wiki/GFortran) that conout$ is supported in gfortran v4.5.
 
  • #7
Mark44 said:
What version of gfortran are you using? It says here (http://gcc.gnu.org/wiki/GFortran) that conout$ is supported in gfortran v4.5.

Thanks for the reply Mark44. I read that as well while I was searching for a solution. I am running version 4.7.0 on this machine and 4.7 on my Linux Box. I can't remember which version I have on my work computer. One of the versions I had supported CONIN$ but not CONOUT$. Surely that was a bug. GFORTRAN has loads of bugs (too numerous to mention here). My favorite bug is when it flags syntax errors in comment lines :)

Thanks again,,

Jim
 

Related to GFORTRANdealing without CONOUT$

1. What is GFORTRAN and how is it used?

GFORTRAN is a programming language specifically designed for scientific computing and numerical analysis. It is used to write and execute programs that involve complex mathematical calculations and simulations.

2. What does "dealing without CONOUT$" mean in GFORTRAN?

In GFORTRAN, CONOUT$ refers to the standard output device, typically the computer screen. "Dealing without CONOUT$" means that the program does not require or use any output to be displayed on the screen, making it more suitable for batch processing or running on a remote server.

3. How does GFORTRAN handle input and output operations?

GFORTRAN has built-in functions and statements for input and output operations. The READ statement is used for input, which allows the program to read data from a specified source, such as a file or the keyboard. The WRITE statement is used for output, which allows the program to display results or data on the screen or write them to a file.

4. Can GFORTRAN handle parallel programming?

Yes, GFORTRAN has features and libraries that support parallel programming, such as OpenMP and MPI. These allow for the distribution of computational tasks among multiple processors, making it possible to perform calculations faster and more efficiently.

5. Is GFORTRAN still widely used in scientific computing?

Yes, GFORTRAN is still a popular choice for scientific computing, especially for applications that involve heavy numerical computations. It is highly efficient and allows for easy integration with other languages, making it a valuable tool for scientists and researchers.

Similar threads

  • Programming and Computer Science
Replies
5
Views
4K
  • Programming and Computer Science
Replies
12
Views
1K
  • Programming and Computer Science
Replies
12
Views
2K
  • Programming and Computer Science
Replies
4
Views
1K
  • Programming and Computer Science
Replies
8
Views
1K
  • Engineering and Comp Sci Homework Help
Replies
7
Views
2K
  • Programming and Computer Science
Replies
22
Views
4K
  • Programming and Computer Science
Replies
8
Views
1K
  • Programming and Computer Science
Replies
2
Views
7K
  • Programming and Computer Science
Replies
19
Views
6K
Back
Top