The following code snipet was designed to convert an integer to a character string and then append the character string to an existing file name. The code compiles and executes ok with Absoft and g95. It compiles ok with gfortran but I get a run time error (Fortran runtime error: End of record). Can someone explain why it works with some compilers but not others? I found a discussion of this topic at http://objectmix.com/fortran/122203-read-write-how-convert-integer-string.html but unfortunately I was more confused after reading the discussion. What is the way to do the conversion such that all compilers will be happy? Thanks in advance.
INTEGER :: J, N_Q
CHARACTER(LEN=10) :: Q_NUM
CHARACTER(LEN=40) :: INP_FILE_P_NQ
DO J=1,N_Q ! loop on number of q-components
WRITE(Q_NUM,*) J ! convert integer to character
Q_NUM = ADJUSTL(Q_NUM) ! remove leading blanks
INP_FILE_P_NQ = TRIM(INP_FILE_P) // "." // TRIM(Q_NUM)
CALL OPEN_INPUT_FILE(KINP_P(J),INP_FILE_P_NQ,"OLD",IERROR) ! file T(q_j+Dq_j)
END DO
Ben Blackwell
Blackwell Consulting
PO Box 2879
Corrales, NM 87048
505-897-5090
fax 505-890-4992