Hello! I am having some trouble with some code and needed help. Below is a sample program that hopefully shows what I would like to know. I want to write a program that will specify a FORMAT statement, that will tell the format statement how many times to repeat the format statement. To do this, I will be reading in "cols" from a file that will be different each time, so I need to be able to somehow tell the format statement how many times to repeat. I would think that I could do this by concatenating, but this dosnt work with ifort or gfortran. Ok, so hopefully this is clear, thanks for any help in advance!
PROGRAM test
Implicit none
INTEGER :: rows,cols
REAL, DIMENSIONS(2),ALLOCATABLE :: VAR
CHARACTER (len=100), DIMENSIONS(1) :: FMT,colsSTR
cols=12345
rows=12345
ALLOCATE(VAR(rows,cols))
WRITE(colsSTR,'(I20)') cols
FMT = "'("//colsSTR//"F10.2"//")'"
100 FORMAT(FMT)
! 100 FORMAT( '(12345F10.2)' ) !FORMAT STATEMENT THAT I WANT TO GET TO
WRITE(*,100) VAR(1,:)
END PROGRAM test