Fortran 90 Program for Processing Output Files | Looping Through File Names

  • Context: Fortran 
  • Thread starter Thread starter jd1828
  • Start date Start date
  • Tags Tags
    Fortran
Click For Summary
SUMMARY

The discussion focuses on creating a Fortran 90 program to process output files named in a sequential format (file.datA, file.datB, etc.). The user aims to implement a loop that modifies the filename by appending letters A-Z to a base string "file.dat". A suggested solution involves defining a new character variable that concatenates the base filename with the appropriate suffix using the TRIM function to manage spaces effectively.

PREREQUISITES
  • Understanding of Fortran 90 syntax and programming concepts
  • Familiarity with character variable manipulation in Fortran
  • Knowledge of loops and control structures in Fortran 90
  • Experience with string functions, specifically TRIM in Fortran
NEXT STEPS
  • Explore Fortran 90 string manipulation techniques, focusing on TRIM and concatenation
  • Learn about loop structures in Fortran 90, particularly DO loops
  • Investigate file I/O operations in Fortran 90 for reading and processing files
  • Review examples of character array handling in Fortran 90
USEFUL FOR

Fortran developers, computational scientists, and anyone involved in processing output files in scientific computing environments.

jd1828
Messages
43
Reaction score
0
Im trying to write a program in fortran 90 to process some output files that i have. Here is the problem I am having. All of the output files are named file.datA, file.datB,...ect. I set the variable "file" to equal file.dat. I want the program to run through a loop and each time change the name of "file". Basically I need to add A-Z on the end each time it reads the file.
 
Technology news on Phys.org
jd1828 said:
Im trying to write a program in fortran 90 to process some output files that i have. Here is the problem I am having. All of the output files are named file.datA, file.datB,...ect. I set the variable "file" to equal file.dat. I want the program to run through a loop and each time change the name of "file". Basically I need to add A-Z on the end each time it reads the file.

... wonder if you could do it simply by defining a new character variable by trimming (using TRIM and some "editing suffix" in between, like // to ditch spaces etc.) 2 other chars together, and using the new one in the loop as the filename.
 

Similar threads

  • · Replies 6 ·
Replies
6
Views
3K
  • · Replies 8 ·
Replies
8
Views
2K
  • · Replies 8 ·
Replies
8
Views
4K
  • · Replies 2 ·
Replies
2
Views
2K
  • · Replies 3 ·
Replies
3
Views
3K
  • · Replies 16 ·
Replies
16
Views
4K
  • · Replies 6 ·
Replies
6
Views
3K
  • · Replies 3 ·
Replies
3
Views
6K
  • · Replies 2 ·
Replies
2
Views
2K
  • · Replies 6 ·
Replies
6
Views
2K