To skip the next n positions, use the X edit descriptor. The general form of this descriptor is as follows:
Suppose this input is read by the following READ statement.1 1 2 ....5....0....5....0 123 456 789 012
The first edit descriptor is 2X, meaning that the first two positions (i.e., 1 and 2) should be skipped. Then, I4 is for variable a. The next four positions, which contain 3 and three spaces, are for a, and as a result, a receives 3 if spaces are ignored or 3000 if spaces are treated as zeros. The next edit descriptor is 3X, meaning that the next three positions (i.e., 4, 5 and 6) should be skipped. This is followed by F5.2, which is used to read a REAL number for variable b. Since these five positions contain three spaces, 7 and 8, variable c receives 0.78. The next edit descriptor is 2X, which causes the next two positions (i.e., 9 and space) skipped. Finally, A is used to read a CHARACTER string for variable c. Since c has length 4, this A is equivalent to A4. Therefore, c receives the next four characters " 012".INTEGER :: a REAL :: b CHARACTER(LEN=4) :: c READ(*,"(2X,I4,3X,F5.2,2X,A)") a, b, c
It should generate the following output:CHARACTER(LEN=30) :: FMT = "(1X,I3,3X,I5,2X,F5.2)" INTEGER :: a = 12 INTEGER :: b = 768 REAL :: c = 3.715 READ(*,FMT) a, b, c
1X skips the first position. So, a is printed using I3 in positions 2 to 4. This is followed by 3X, which causes the next three positions skipped. The next edit descriptor is I5 and the value of b is printed. Then, 2X skips the next two positions. Finally, c is printed using F5.2. Note that since the value of c is 3.715 and since F5.2 only prints two digits after the decimal point, the third one is rounded to the second digit. Thus, we have 3.72.