<IOSTAT= Example Program>
Program iostat_example
Character c
Integer ios, nchars, nlines, nvowels
nchars = 0
nlines = 0
nvowels = 0
Do
Read (*,'(A)',Advance='No',Iostat=ios) c
If () Exit
If (ios==0) Then
nchars = nchars + 1
If (Verify(c,'aeiouAEIOU')>0) nvowels = nvowels + 1
Else If ( Then
nlines = nlines + 1
Else
Print *, 'Unexpected i/o error',
Stop
End If
End Do
Print *, 'The input contained', nchars, 'characters in', nlines, 'lines.'
Print *, nvowels, 'of the characters were vowels.'
End Program
■ Execution Results
When run with the input:
Now is the time∞ for all good men∞ to come to the aid∞ of the party.∞where ∞ indicates the end of each record, the output is
The input contained 62 characters in 4 lines. 42 of the characters were vowels.