Hi there, I am trying to make a Fortran90 program that open files with this pattern: 1a041.dat wp2d2.dat qad33.dat mntf4.dat erh55.dat ...etc. so the first four digits I want to consider them as a variable character, then it comes an integer value that increases by one for every file. The last part is the ".dat" I don't know how to tell my program to read this character for every file and then to open it. I think I have managed to sort out the integer part by converting the integer value into a string value by using write(numchr,*) j. This is an extract of the program: PROGRAM database character(40) :: numchr ! this is to turn integer into string character(10) :: prot ! this is to read the first 4 digits integer :: j,n,i,k n = 10 DO j = 1,n write(numchr,*) j open (j, file = prot // trim(adjustl(numchr)) // ".dat",status='old') etc.... close(j) ENDDO Many thanks!