Hello, I need to make a program that reads from an input file that has lines of text written in specific formats and process the read information in order to create an output file with some data of interest. I know all the formats used to write the input file (they are described in a format file), but the data itself is written by another program, in a "random" way. Some lines are easy to identify (headers and end-of-table markings, etc.) others do not. It would be much easier if FORTRAN was somehow able to identify the format in which each line read from the input file was written (for example: '(1X, I5,3F8.1,2 (5A, 1X))) . So I could just compare the format of the line with one of the formats of the list I own and extract almost directly the necessary data, for example knowing that the format of the line read and stored in the LINE variable is described in the variable FORMAT, could do something of type:
IF (FORMATO='(1X,I5,3F8.1,2(5A,1X))') THEN
READ(LINHA,'(6X,F8.1)') minha_variavel
END IF
Because there may be another read line format such as:
'(6A, 2F8.1, F8.6,2 (6A))'
If I use the same READ command above, I will have an F8.1 variable written in "my_variable", but this will not be the value I wanted.
Does anyone know if FORTRAN has a function that does something similar (get the format in which a line of text file was written)? If yes, what is the function?