I have a Fortran program in which I use a format staement for writing like
WRITE (12,'(A72,1X,A,1X,I6.6)') ALINE,SFFIX(1:NUM),LINENO
which works fine. However when I write a character string `fmtt' like
WRITE (fmtt,'(a)') trim(adjustl(sttr(2)))
where string 'sttr (2)is '(A72,1X,A,1X,I6.6) ' ` , which I confirm by printing fmtt like
WRITE(*,'(a)')fmtt
When I use string fmtt as format in a write statement like
WRITE (12, fmtt) ALINE,SFFIX(1:NUM),LINENO
I get error message
forrtl : info(58) format syntax error at or near '(A72,1X,A,1X,I6.6) '
Though I am not an expert I expected it to work as format is supposed to be a character string. Where am I wrong? I wanted to do this to make format dependent on user input. Thanking you.