Complete Output File Syntax
Normally, ADB will compare the input file(s)' fieldsets to the
output file fieldset.
If a field name is in the output file fieldset and in exactly one
of the input
file(s)' fieldsets, ADB will automatically do the
"obvious" (i.e. recognize that the field name in the output file
fieldset corresponds to the field name in the input file fieldset).
What if you're matching a master and a trans record, and both
contain a field that you wish to place in the output file?
Obviously, ADB has to have some way of knowing whether this field
is to be taken from the master or the trans input.
Similarly, if you want to put a constant value in the output record
or create an output record with empty fields in it, then you need
to tell ADB what to put in those fields.
So there's an expanded syntax for output files:
M&T fieldset { sort_fieldset {NODUPS} }
{AWK} {CQ}
OutField ( {M.|T.}InField | "value"
) {"padding char"}
. . .
. . .
. . .
END
The second line above is the fifth (and last) type of ADB statment
that can appear in your definitions file.
"OutField" is the output file field name. "InField" is the input
file file name. The "M." or "T." prefix on the input file field
name is used to tell ADB whether the source field is drawn from
the master or trans input.
Obviously you don't need the "M." or "T." prefix
for "M-T" or "T-M"
outputs (unmatched masters, or unmatched trans, respec.).
In fact, there's really no reason to ever specify a source field
name for these two types of outputs, since by definition, all
"source" fields (other than constants) come from the sole
eligible input file.
However, for an "M&T" output, you have to have one of these lines
for every field name that appears in all three files (i.e. the
output as well as both inputs). There's no "default" input
source file for the output field, so you must preceed the input
file field name with either a "M." or a "T.". No space occurs
after the period.
You may also specify a constant value. This value will be truncated
if it's too long for the output field.
WARNING:
ADB doesn't perform type checking on these values. If you
specify a non-integer value for an integer field (the field name ends
a single underscore), then ADB will go merrily on its way.
So, to review, any of the following formats is valid:
OutField_Name M.InField_Name
OutField_Name M.InField_Name "Padding_Character"
OutField_Name T.InField_Name
OutField_Name T.InField_Name "Padding_Character"
OutField_Name "constant"
OutField_Name "constant" "Padding_Character"
OutField_Name InField_Name
OutField_Name InField_Name "Padding_Character"
You may specify as many different lines as you need to cover all
of the output fields.
If the output field name is in only one of the input files,
and the output field value is idential to the input file's field
value, then you need not list it.
Output fields can be specified in any order, however, they must
immediately follow the output file (M&T, M-T, or
T-M) line, and must preceed any END.
You may put END on a line by itself after all output fields
have been defined, or you can put it on the end of the last
line that defines an output field.
What if the output field is shorter than the input field?
For right-justified fields (those with names ending in exactly
one or two underscores), ADB will truncate ("shorten") these
fields on the left. Other fields get truncated on the right.
ADB will also issue a warning message when scanning your
definitions (i.e. before any records have been read). Note that
warning messages result in a return code of 1.
Finally, you may specify a padding character. It has to be
enclosed in double quotes, and not "escape" sequences for
unprintable values is currently supported (but if you can enter
them in your line editor, and the character isn't a CR, LF, or
control-Z, then it will probably work).
Note that all spaces are stripped from the right and left of all
input file fields prior to moving them into the output file, even
if you haven't requested any form of input file preprocessing.
Unless you specify a padding character, the default of a space is
always used. Field whose names end in exactly one or two
underscores will be right-justified, all others will be
left-justified.
The "END" can go either on the last of your output field
specification lines, or on a separate line by itself.
However, it must appear because this is ADB's only way of knowing
that you've completed your field specifications). Although I
could've elimiminated this requirement and assumed that they end
as soon as a reserved word is read as the first token of the next
definitions line, I've opted for an approach that's more likely
to detect unexpected definitions file truncation or other coding
errors.
Return
to local table of contents
Return
to global table of contents
Frames mode, or
No frames