A slash is not a separator, it ends input without an error, so you can enter partial input records. A [return] acts just like a space, so if you had the following program and only wanted to change the value of “i”, you could enter
100 /
and without getting an I/O error, “j” would remain unchanged and I would be entered.
Otherwise, it is going to keep reading till you enter values for “i” and “j”. It also allows for null values, and the form r*c where “r” is a repeater, so if you had ten values you wanted to set to zero you could enter “10*0”; for example. These used to be features more commonly used, but I find a lot of people are unaware of them anymore.
program testit
implicit none ,j,ios
i=1111
j=2222
do
print *, "Enter two integers "
read(*,*,iostat=ios) i,j
if(ios.ne.0)then
print *,"os=" ,ios
else
print *,"i=" ,i, "j=",j
endif
if(ios/=0) stop "i was not an integer"
end do
end program testit
You can try a few input lines like:
,4444
66666/
1*,8888
2*9999
If you know what those are going to do you are well on your way to knowing about list-directed input. Other unexpected things (other than null values, repeaters, and terminators for partial reads …) is that strings do not need quoted if just alphanumeric strings. Some people put comments after the input terminator ("/"). I do not remember any more, but “/” was probably chosen because it cannot appear in a numeric value and is unusual in strings; but most importantly it was on all keyboards (hard to believe, but a lot of characters were not standardized and EBCDIC was very common, so you did not want to depend on characters like @, #, ~, |, … as they were often not available, although things like 1/2 often were.
I rarely see these things mentioned, like to read only the 11th value in an input list you can enter “10*,7777 /”; but they are described in the Fortran Standard. I still run across some old program input files that I have to “interpret” for people; but I rarely see these features used anymore; partly probably because they are rarely documented.
Note even in your simple program that only reads one value “/” can be useful. You can basically get a prompt to read “i” and decide you do not want to change the value and just enter “/”.