TR and X Format Codes

Available Format Codes

The TR and X format codes move the current position in the record to the right.

The syntax is:

TRn 
nX 

where

n

is the number of characters to skip (1 ≤ n). On input, n characters in the current input record will be passed over. On output, the current output position is moved n characters to the right.

The TR or X format codes can be used to leave whitespace in the output or to skip over unwanted data in the input. For example, either

PRINT, FORMAT = '("First", 15X, "Last")' 

or

PRINT, FORMAT = '("First", TR15, "Last")' 

results in the following output:

FirstbbbbbbbbbbbbbbbLast 

where "b" represents a blank space.

These two format codes differ in one way. Using the X format code at the end of an output record will not cause any characters to be written unless it is followed by another format code that causes characters to be output. The TR format code always writes characters in this situation. Thus,

PRINT, FORMAT = '("First", 15X)' 

results in the following output:

First 

whereas

PRINT, FORMAT = '("First", TR15)' 

results in the following output:

Firstbbbbbbbbbbbbbbb 

where "b" represents a blank space. The X code does not cause the blanks to be output unless there is additional output following the blanks.