What is meaning of (5,*), (6,*)and (*,*) in Fortran ?

  • Fortran
  • Thread starter masyousaf1
  • Start date
  • Tags
    Fortran
In summary, the characters "(5,*)" and "(6,*)" are used in FORTRAN to indicate input and output files. Originally, filecode 5 was used for card input and filecode 6 for printer output. However, these codes were later repurposed to represent input from and output to the terminal device using the * symbol. The second * indicates a free form format for the data being read or written. The syntax for writing to the default output is "write(*,*)". This information can be found in the first search result for "fortran read statement".
  • #1
masyousaf1
28
0
Dear Members,

Why The characters "(5,*)" should appear after every READ and the characters "(6,*)" after every WRITE ? What is the use of "(*,*)" that can appear with either the READ or WRITE statements.

Best Regards
 
Technology news on Phys.org
  • #2
Filecode 5 was historically the standard card input for fortran and filecode 6 was for output to the printer.

Later 5 became read from the terminal device and 6 to write to the terminal device which then became using * as meaning read from or write to the terminal device. The second * is for a free form format for the day being read or written.
 
  • Like
Likes masyousaf1
  • #3
jedishrfu said:
Filecode 5 was historically the standard card input for fortran and filecode 6 was for output to the printer.

Later 5 became read from the terminal device and 6 to write to the terminal device which then became using * as meaning read from or write to the terminal device. The second * is for a free form format for the day being read or written.

I think you mean 'the data being read or written.'
 
  • #4
Thank you jedishfu for your prompt response. I just found the explanation for (*,*). If one wishes to use the write statement to write a statement to the default output, the syntax is write(*,*). SO the thread is closed now
 
Last edited:
  • #5
Yeah thanks SteamKing I am sometimes a victim of the overzealous spell checker on my iPad and I often forget to check back because I know what I typed.
 
  • #6
A Google search for "fortran read statement" gave me this nice summary as the very first hit:

http://www.oc.nps.edu/~bird/oc3030_online/fortran/io/io.html
 

Related to What is meaning of (5,*), (6,*)and (*,*) in Fortran ?

What is the meaning of (5,*) in Fortran?

The notation (5,*) in Fortran is used to specify the format of a list-directed input/output statement. It indicates that the statement will read or write data starting at column 5 and will continue until the end of the line. This allows for more flexible input/output formatting in Fortran programs.

What is the meaning of (6,*) in Fortran?

Similar to (5,*), the notation (6,*) in Fortran is used to specify the format of a list-directed input/output statement. However, it indicates that the statement will read or write data starting at column 6 and will continue until the end of the line. This slight difference in starting column can be useful for organizing data in a more readable format.

What is the meaning of (*,*) in Fortran?

The notation (*,*) in Fortran is used to indicate that the input/output statement will read or write data starting at the current column and will continue until the end of the line. This allows for even more flexibility in formatting and is commonly used in Fortran programs.

Why is the notation (5,*) often used in Fortran programs?

The notation (5,*) is often used in Fortran programs because it allows for more flexible input/output formatting. By specifying a starting column of 5, the programmer can easily organize data in a readable format without having to manually specify the end column for each piece of data. This can save time and make the code more concise.

Are there any other common uses for the (*,*) notation in Fortran?

Yes, the (*,*) notation is commonly used in Fortran to indicate the format of list-directed input/output statements. It can also be used in other situations, such as specifying the dimensions of an array or indicating a range of indices in a DO loop. However, its most frequent use is in input/output formatting.

Similar threads

  • Programming and Computer Science
Replies
12
Views
2K
  • Programming and Computer Science
Replies
5
Views
1K
  • Programming and Computer Science
Replies
6
Views
1K
  • Programming and Computer Science
Replies
12
Views
1K
  • Programming and Computer Science
Replies
17
Views
4K
  • Programming and Computer Science
Replies
16
Views
2K
  • Programming and Computer Science
Replies
9
Views
3K
  • Engineering and Comp Sci Homework Help
Replies
7
Views
2K
  • Programming and Computer Science
Replies
8
Views
1K
  • Programming and Computer Science
Replies
20
Views
2K
Back
Top