You are on page 1of 4

REFORMAT

Purpose
Reformat changes the record format of data records by dropping fields, or by using DML
expressions to add fields, combine fields, or transform the data in the records.
Parameter
Count (integer, required)
Sets the number of:
out ports
reject ports
error ports
transform parameters
Default is 1.
transformn(filename or string, optional)
Either the name of the file, or a transform string, containing a transform function
corresponding to an out port; n represents the number of an out port. Transform functions
for Reformat should have one input and one output.
Select (expression, optional)
Filter for data records before reformatting.
reject-threshold (choice, required)
The component's tolerance for reject events. See AGGREGATE components.
output-index (filename or string, optional)
Either the name of a file containing a transform function, or a transform string. The
Reformat component calls the specified transform function for each input record. The
transform function uses the value of the input record to direct that input record to a
particular output port. The expected output of the transform function is the index of an
output port (zero-based). The Reformat component directs the input record to the
identified output port and executes the transform function, if any, associated with that
port.
When you specify a value for output-index, each input record goes to exactly one
transform/output port pair. For example, suppose there are 100 input records and two
output ports. Each output port receives between 0 and 100 records. According to the
transform function you specify for output-index, the split can be 50/50, 60/40, 0/100,
99/1, or any other combination that adds up to 100.
If you do not specify a value for output-index, Reformat sends every input record to
every transform/output port pair. For example, if Reformat has two output ports and there
are no rejects, 100 input records results in 100 output records on each port for a total of
200 output records.

Logging (boolean, optional)


Specifies whether or not you want certain component events logged. See
AGGREGATE components.
Runtime Behavior of Reformat
The n in outn gives each out port a unique number. Each outn port has a corresponding
rejectn and errorn port.
The Reformat component:
Reads records from the in port.
If you supply an expression for the select parameter, the expression filters the
records on the in port:
o If the expression evaluates to 0 for a particular record, Reformat does not
process the record, which means that the record does not appear on any
output port.
o If the expression produces NULL for any record, Reformat writes a
descriptive error message and stops execution of the graph.
o If the expression evaluates to anything other than 0 or NULL for a
particular record, Reformat processes the record.
If you do not supply an expression for the select parameter, Reformat processes all
the records on the in port.
Passes the records to the transform functions, calling the transform function on
each port, in order, for each record, beginning with out port 0 and progressing
through out port count - 1.
Writes the results to the out ports.
If you do not specify a transform function for a particular out port, Reformat uses
default record assignment. You can use default record assignment to eliminate fields
from a record format.
The evaluation of the transform functions takes place within each partition of a Reformat
running in parallel, which means that evaluations of later transform functions can depend
on the results of the evaluations of earlier transform functions, such as modification of
global variables or use of functions such as next_in_sequence.
If a transform function returns NULL, Reformat writes:
The current input record to the corresponding reject port.
An error message to the corresponding error port.
If you do not connect flows to the reject or error ports, Reformat discards the
information.

MULTI REFORMAT
Multi Reformat changes the record format of data records flowing between from one to
20 pairs of in and out ports by dropping fields, or by using DML expressions to add
fields, combine fields, or transform the data in the records. A typical use for Multi
Reformat is to put it immediately before a custom component that takes multiple inputs.
It is recommended to keep Automatic Flow Buffering, the default, turned on for MULTI
REFORMat. This component reads input from its flows in a specific order. Thus, turning
off Automatic Flow Buffering could cause deadlock...
Parameter
Count (integer, required)
An integer from 1 to 20 (default is 1) that sets the number of each of the following:
in ports
out ports
reject ports
error ports
transform parameters
transformn (filename or string, optional)
Either the name of the file or a transform string, containing a transform function
corresponding to an input/output port pairing; n represents the index on the input/output
pairing. Transform functions for Multi Reformat have one input and one output.
reject-threshold (choice, required)
The component's tolerance for reject events. See AGGREGATE component.
Logging (boolean, optional)
Specifies whether or not you want certain component events logged. See
AGGREGATE component.
Runtime behavior of MULTI REFORMAT
The Multi Reformat component behaves as if it were n Reformat components, each with
no select clause.
The component operates separately on the data flowing between each pair of its inn-outn
ports. The count parameter specifies the total number of port pairs. Each inn-outn port
pair has its own associated transformn to reformat the data flowing between those ports.
Separate errorn and rejectn ports are also associated with each pair of inn-outn ports.
The ramp and limit parameters do not affect the overall ramp and limit for all ports, but
rather are applied to each in/out port pairing.
Multi Reformat also performs automatic flow buffering. It reads from and writes to ports
as they become available.

Using MULTI REFORMAT to avoid deadlock


Deadlock can occur in a graph where flows diverge and converge in the same phase. If
flows converge at a custom component that reads its input flows in a particular order, this
component has the potential for deadlock. Using a Multi Reformat component to process
input into such a deadlock-prone custom component initiates automatic flow buffering
and is a convenient scheme for avoiding deadlock.
In order for this scheme to work properly, downstream component(s) connected to the
Multi Reformat must initialize all their input ports. Custom components using named
pipes for flows must open all of their pipes at startup. Once initialized (opened), each
pipe (port) can be read in any order and with any frequency. Components upstream of
Multi Reformat do not need to initialize all ports, although this procedure is generally
recommended for custom components.

You might also like