0% found this document useful (0 votes)
12 views3 pages

Reformat

The Reformat component modifies record formats by dropping fields or using DML expressions to transform data. It includes parameters like count, transform, select, output-index, and output-indexes to control how records are processed and directed to output ports. The document also addresses runtime behavior, error handling, and provides examples of using output-index and output-indexes for directing records based on specified conditions.

Uploaded by

aanand7singh
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
12 views3 pages

Reformat

The Reformat component modifies record formats by dropping fields or using DML expressions to transform data. It includes parameters like count, transform, select, output-index, and output-indexes to control how records are processed and directed to output ports. The document also addresses runtime behavior, error handling, and provides examples of using output-index and output-indexes for directing records based on specified conditions.

Uploaded by

aanand7singh
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 3

Reformat:

Reformat changes the format of records by dropping fields, or by using DML


expressions to add fields, combine fields, or transform the data in the records.

Parameters:

count
Sets the number of:

out ports
reject ports
error ports
transform parameters

Default is 1.

transform
Specifies 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 at least one input and one output.

select
Filter the records before reformatting.

output-index
Specifies either the name of a file containing a transform function, or a transform
string. The 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 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. the split can be 50/50, 60/40, 0/100, 99/1, or any other
combination that adds up to 100. If an index is out of range (less than zero or
greater
than the highest-numbered port), the componentignores that index.

output-indexes
Specifies either the name of a file containing a transform function, or a transform
string. The component calls the specified transform function for each input
record. The transform function usesthe value of the input record to direct that
input record to a particular transform-output port.

The expected output of the transform function is a vector of numeric values. The
component considers each element of this vector as an index into the output
transforms and ports. The component directs the input record to the identified
output port and executes the transform function, if any, associated with that port.

If an index is out of range (less than zero or greater than the highest-numbered
port), the component ignores that index. The component also ignores duplicate in
port numbers. If a port appears multiple times in the vector, the componentuses the
corresponding transform-port only once.
NOTE: If you specify a value for the output-index parameter, you cannot also
specify the output_indexes parameter.

If you do not specify a value for either output-index or output-indexes, the


component ends every input record to every transform-output port pair. For example,

the component 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.

As an example of how the component uses the transform function specified in the
output-indexes parameter, consider the following:

Example of output_index:
out :: output_index(in) =
begin
out :1: if (in.kind == "a") '0';
out :2: if (in.kind == "b") '1';
out : : '2';
end;

Here the records which has kind as 'a' will go to 0th port. Kind of 'b' will go to
1st port. All rest of the records will move to 2nd port.

Example of output_indexes:
out :: output_indexes(in) =
begin
out :1: if (in.kind == "a") [vector 0, 1, 2];
out :2: if (in.kind == "b") [vector 2, 3, 4];
out : : [vector 5];
end;

When you specify this transform function for the output-indexes parameter, it
directs the input record to the transform functions for:
Ports 0, 1, and 2 if the field in.kind is "a"
Ports 2, 3, and 4 if the field in.kind is "b"
Port 5 if otherwise

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.

Reformat does the following:

Reads records from the in port.

If you specify an expression for the select parameter, the expression filters the
records on the in port:
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.
If the expression produces NULL for any record, Reformat writes a descriptive error
message and stops execution of the graph.
If the expression evaluates to anything other than 0 or NULL for a particular
record, Reformat processes the record.
If you do not specify an expression for the select parameter, Reformat processes
all the records on the in port.
If you specify a value for either output_index or output_indexes, Reformatpasses
the records to the transform functions, calling the transform function on each
port in order, depending on the value of output_index or output_indexes, for each
record, beginning with out port 0 and progressing through out portcount - 1.

If a transform function returns NULL, Reformat writes:


An error message to the corresponding error port
The current input record to the corresponding reject port
If you do not connect flows to the reject or error ports, Reformat discards the
information.
Writes the valid records to the out ports.

Q. We r getting 1000 records as input if any 100 records does not satisfy given
condition then the graph must abort for that what we have to do? We need to collect
those 100 records into a file and need to email those records to specific users.
Q. Display the names of employees whose name starts with alaphabet S.
Q. Display the Employee names for employees whose name ends with alaphabet S.
Q. Display the names of employees whose names have second alphabet A in their
names.
Q. select the names of the employee whose names is exactly five characters in
length.
Q. Display the names of the employees in lowercase.
Q. select name of the employee concatenate with employee number.
Q. Display the date three months Before the hiredtae of each employee.
Q. What is priority? How do you insert priorities in transformations?
Q. If i am using the select in reformat where will be the discarded records?
Q. What is the default size & the maximum size for count parameter in reformat?
Q. What is the difference between output_index and output_indexes?Shall I use both
at the same time?
Q. we have a input file and we want to split the file into 3 flows based on the
rec_type present in the dml and thereafter we want to aggregate the data based on
the some key field for each of the three flows and then we want to load that to
a multifile.How we will do that?
Q. Can we use lookup expression in the select parameter of reformat?
Q. For which component connecting the ports is not mandatory

You might also like