# Tabbing: Tc, TLc and TRc

Edit descriptors Tc, TLc and TRc provide a way of moving to a specific positions on the current input or output line. More importantly, they can move backward and forward. However, nX can only move forward. The general forms are

Tc,   TLc    and   TRc

• Tc moves to position c, TLc move backward c positions, and TRc moves forward c positions.
• Edit descriptors T, TL and TR cannot be used with repetition indicator directly.
• The T, TL and TR edit descriptors are only for tabbing and do not read and write any values.

### Examples

• Suppose we have the following WRITE statement.
```INTEGER          :: a = 123, b = 456

WRITE(*,"(T6,I4,T2,I4)")  a, b
```
T6 moves to position 6. In the following, we shall use a blue blinking vertical bar to indicate the next position to be used.
```              1    1    2
....5....0....5....0
T6        |
```
Then, I4 is used to print the value of a. Since this value is 123, the printed result occupies positions 6, 7, 8 and 9, and the next position to be used is 10.
```              1    1    2
....5....0....5....0
T6
I4         123|
```
Now, T2 moves to position 2:
```              1    1    2
....5....0....5....0
T6
I4         123
T2    |    123
```
I4 is used to print the value of b, which is 456. Thus, positions 2, 3, 4 and 5 will contain a space, 4, 5 and 6. The next available position is 6:
```              1    1    2
....5....0....5....0
T6
I4         123
T2         123
I4     456|123
```
Now all variables have been printed and the result is
```         1    1    2
....5....0....5....0
456 123
```
• Suppose we have the following WRITE statement.
```INTEGER          :: a = 123, b = 456, c = 789

WRITE(*,"(T10,I3,TL9,I3,TR5,I3)")  a, b, c
```
T10 moves to position 10:
```              1    1    2
....5....0....5....0
T10           |
```
Then, I3 is used to print the value of a, which is 123. Thus, the output occupies positions 10 to 12 and the next position is 13:
```              1    1    2
....5....0....5....0
T10
I3            123|
```
TL9 moves backward 9 positions. Since the next position is 13, moving backward 9 positions is position 13-9=4:
```              1    1    2
....5....0....5....0
T10
I3            123
TL9     |     123
```
Then, I3 is used to print the value of b, which is 456. They occupy positions 4 to 6 and the next position becomes 7:
```              1    1    2
....5....0....5....0
T10
I3            123
TL9           123
I3      456|  123
```
TR5 moves forward five positions. Since the next position is 7, moving forward 5 positions is position 7+5=12:
```              1    1    2
....5....0....5....0
T10
I3            123
TL9           123
I3      456   123
```
Since position 12 already holds 3, we use a blue blinking 3 to remind you this fact. Then, I3 is used to print the value of c, which is 789. Thus, positions 12 to 14 will hold 7, 8 and 9 and the original value in position 12 (i.e., 3) is overwritten:
```              1    1    2
....5....0....5....0
T10
I3            123
TL9           123
I3      456   12789|
```
Now all variables are printed and the actual output is
```         1    1    2
....5....0....5....0
456   12789
```
• Let us consider the following READ statement:
```INTEGER :: a, b, c

```
Suppose we have the following input line:
```         1    1    2
....5....0....5....0
1234567890
```
What are the values for a, b and c? In what follows, we shall use a blinking character to indicate the next position to be read.

The first edit descriptor is T1, which moves to position 1:

```              1    1    2
....5....0....5....0
1234567890
T1   1234567890
```
The next edit descriptor is I5, which is used to read the next five positions for a. Therefore, a receives 12345 and the next position is 6:
```              1    1    2
....5....0....5....0
1234567890
T1   1234567890
I5   1234567890
```
Then, T3 moves back to position 3:
```              1    1    2
....5....0....5....0
1234567890
T1   1234567890
I5   1234567890
T3   1234567890
```
The edit descriptor I5 reads the value in the next five positions to variable b. Therefore, b receives 34567 and the next position becomes 8:
```              1    1    2
....5....0....5....0
1234567890
T1   1234567890
I5   1234567890
T3   1234567890
I5   1234567890
```
Then, T2 brings the position back to position 2:
```              1    1    2
....5....0....5....0
1234567890
T1   1234567890
I5   1234567890
T3   1234567890
I5   1234567890
T2   1234567890
```
Finally, I5 takes the content in positions 2 to 6 for c. Thus, c receives 23456 and the next position is 7:
```              1    1    2
....5....0....5....0
1234567890
T1   1234567890
I5   1234567890
T3   1234567890
I5   1234567890
T2   1234567890
I5   1234567890
```
Since all variables have received values, the activity of this READ terminates.
• Let us consider the following READ:
```INTEGER :: a, b, c, d

```
Suppose we have the following input line:
```         1    1    2
....5....0....5....0
12345678901234567890
```
We shall determine the values in the variables.

First, 2X skips the first two positions and the next available position is 3:

```              1    1    2
....5....0....5....0
12345678901234567890
2X   12345678901234567890
```
Then, I3 reads 345 into variable a and the next position is 6:
```              1    1    2
....5....0....5....0
12345678901234567890
2X   12345678901234567890
I3   12345678901234567890
```
TR7 moves the next position to 6+7=13:
```              1    1    2
....5....0....5....0
12345678901234567890
2X   12345678901234567890
I3   12345678901234567890
TR7  12345678901234567890
```
Then, I4 reads 3456 into b and the next position is 17:
```              1    1    2
....5....0....5....0
12345678901234567890
2X   12345678901234567890
I3   12345678901234567890
TR7  12345678901234567890
I4   12345678901234567890
```
TL5 moves backward 5 positions. Thus, the next position is 17-5=12:
```              1    1    2
....5....0....5....0
12345678901234567890
2X   12345678901234567890
I3   12345678901234567890
TR7  12345678901234567890
I4   12345678901234567890
TL5  12345678901234567890
```
I1 reads 2 into c and moves the next position to 13:
```              1    1    2
....5....0....5....0
12345678901234567890
2X   12345678901234567890
I3   12345678901234567890
TR7  12345678901234567890
I4   12345678901234567890
TL5  12345678901234567890
I1   12345678901234567890
```
T18 moves to position 18:
```              1    1    2
....5....0....5....0
12345678901234567890
2X   12345678901234567890
I3   12345678901234567890
TR7  12345678901234567890
I4   12345678901234567890
TL5  12345678901234567890
I1   12345678901234567890
T18  12345678901234567890
```
I2 reads 89 into d and moves the next position to 20:
```              1    1    2
....5....0....5....0
12345678901234567890
2X   12345678901234567890
I3   12345678901234567890
TR7  12345678901234567890
I4   12345678901234567890
TL5  12345678901234567890
I1   12345678901234567890
T18  12345678901234567890
I2   12345678901234567890
```