Relate can read delimited input files. The field delimiter, field separator and record separator are defined with the
-dd
,
-df
and
-dr
switches respectively. They may specify a printable character or an escape sequence such as
\n
or
\x0a
. The default values are:
Field delimiter
-dd"
Field separator
-df,
Record Separator
-dr\n
When using a UNIX based operating system, it is best to use hexadecimal values to define the delimiters, as certain ASCII characters have a reserved meaning and must be "escaped" by preceding them with a backslash (\) character.
The delimited data must be transformed into a format that matches the input view used by relate (specified with the
-i
switch). If no input view is used, the delimited data must be transformed into IDT layout. Having determined the input view that will be used, the
-dl
switch is used to describe how to transform the delimited data into that format. It specifies a comma-separated list of triplets:
-dl<triplet>,...
where each
<triplet>
consists of
Field length (in printable decimal digits),
R/L justification (optional, if omitted L is the default),
Filler character preceded by a dash (optional, if omitted the default is a blank). It may be specified using an escape sequence.
The following example defines three fields. The first is 30 bytes long and uses the default justification and filler. The second field is 10 bytes, right justified and filled with 0. The third field is 50 bytes in length, left justified and filled with ’!’ (ASCII 0x21).
-dl30,10R-0,50L-\x21
The triplets are used by the transformation engine to convert the delimited data. The field lengths must match the length and order of fields in the input view. If a delimited field is longer than the field length, it will be truncated. If it is shorter than the field length, it will be either left or right justified and padded with the filler character up to the specified field length.