How do i skip the lines(consists of asterisks,spaces,character) in FORTRAN program?

Hi,

Input file test.doc consists of Astersk*,space,character and integer values in it.
I'm using fortran program to read only integer values from it.
Here i need to skip all the lines where Astersk*,space,character are used.In turn,i need to read only integer values and put it in command prompt.
Please can anyone provides coding for doing this

Input file:
==========
****INPUT FILE STARTS HERE*************
*****DATE                                    122132
*****ENGPS                      002659
*****DTGHK                                    353465
****INPUT FILE ENDS HERE**************


Thanks in advance.

Regards
Prabhu
prabaharanbAsked:
Who is Participating?
 
Dr. KlahnPrincipal Software EngineerCommented:
The following presumes that there is only one data value per line, and that the FORTRAN compiler has a function IVAL which returns the decimal value-equivalent of a single numeric character.  The program processes the input file, parsing each line as characters.

PROGRAM TEST
CHARACTER INLINE
INTEGER INDEX, IVALUE
DIMENSION INLINE (80)
100 FORMAT (80A1)
101 FORMAT (1X, I8)
OPEN (UNIT=1, NAME="INPUT.FIL", ACCESS="READONLY")
DO WHILE (.NOT. (EOF(1))
  READ (1, 100) INLINE
  IVALUE = 0
  DO 1000 INDEX = 1, 80, 1
    IF ((INLINE(INDEX) .GE. "0") .AND. (INLINE(INDEX) .LE. "9")) THEN
      IVALUE = (IVALUE * 10) + IVAL(INLINE(INDEX))
    END IF
  1000 CONTINUE
  WRITE (5, 101) IVALUE
END DO
CLOSE (UNIT=1)
CALL EXIT
END

0
 
prabaharanbAuthor Commented:
Thanks for answer
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.