<ADVANCE= Example Program>
Program advance_specifier_example
Character ch
Character(80) :: name(10) = ''
Integer pos
Print *,'Please enter a list of names separated by commas.'
Do i=1,10
pos = 1
Do
Read (*,'(a)',Advance='No',Eor=10) ch
If (ch==',') Exit
name(i)(pos:pos) = ch
pos = pos + 1
End do
End do
Print *,'Only the first 10 names are accepted'
i = 10
10 Continue
Print 20,i
20 Format(/,1X,'You have entered ',I0,' names.')
Do j=1,i
Print 30,j,Trim(name(j))
30 Format(1X,I0,1X,A)
End do
End program
<Example Input>
Fred Nurke,X the Unknown,Penelope Pettigrew
■ Execution Results
You have entered 3 names.
1 Fred Nurke
2 X the Unknown
3 Penelope Pettigrew