The INREC
, OUTREC
, and REFORMAT
control statements perform very similar operations on the data. In Connect ETL, a reformat can
perform almost all of the operations that these three statements perform on the
mainframe.
The reformat in Connect ETL provides a mechanism for determining what the output record will look like. A reformat defines which fields will appear in the output, where they will appear, and how they will be formatted. Fields in a reformat can be input fields, constants, or new values created by applying functions to input fields and/or constants.
If a sort step has only INREC
, only OUTREC
, or only
REFORMAT
, the reformat in Connect ETL should match the output record
definition provided by INREC
, OUTREC
, or
REFORMAT
. If more that one of these is present, you must work backwards
from the last one that is applied to determine which fields in the source data are being
referenced.
Consider the following sort control statements and their effects on a hypothetical input record containing a first name (10 bytes) a middle name (10 bytes), a last name(10 bytes), and other personal information (remainder of record):
INREC FIELDS=(1:31,10,11:1,10,31:21,10)
SORT FIELDS=(1,10,CH,A,11,10,CH,A,21,10,CH,A)
OUTREC FIELDS=(1:11,10,11:21,1,12:1,10)
To build a task in Connect ETL that would perform this same operation, you need to account
for the effect of the INREC
when defining your record layout and reformat.
Your record layout should look similar to this one:
Note the composite field, MiddleName, that contains two sub-fields. The purpose of defining MiddleName this way is to allow us to reference the entire field as a sort key and reference only the first byte in the reformat.
Although the sort keys appear to be in order, the INREC
statement has
changed the order of the fields to put last name first. Since the Connect ETL record layout
refers to fields in the source record, you must take the INREC
into account
when specifying the order of the sort keys:
The same is true for the reformat. Although the OUTREC
puts the second field
first and the first field third, it is processing the record that has already been changed by
the INREC
statement. Therefore, to create the correct reformat in Connect
ETL, you must look to see what the second field is in the record that has been changed by the
INREC
and then determine which field this is in the input record. Note that
these adjustments account for the actions of the INREC
statement. You do not
need to reformat the data twice or create multiple steps.