Syntax for moving fields in a segment
The FIELDS keyword supports moving fields in a segment. The syntax for doing so is FIELDS(destinationOffset:sourceOffset,length), using 1-based offsets.
Example | Description | Notes |
|---|---|---|
FIELDS(1:2,3) | Moves to offset 1 in the output segment, from offset 2 in the source segment, for a length of 3 | None |
FIELDS(1:2,3,4:5,6) | Does the same as the example above, and moves from offset 5 to offset 4, for a length of 6 | You can repeat destinationOffset:sourceOffset,length triplets as much as desired. Or, you can use multiple FIELDS statements. |
FIELDS(:9,3,:50,6) | Moves to offset 1 for a length of 3, then from offset 4 for a length of 6. Each move picks up where the last left off. | destinationOffset is optional. The default is to build the output segment incrementally. |
FIELDS(1:2,3, 4:5,6,7:8,9, 10:11,12) | A FIELDS statement can span lines as long as the lines break between triplets. |
Related topic