Converting data using a variable

The variable functionality enables you to store a value of the input record in a variable. Because the value stored in a variable is retained by DataMagic (command for executing data processing), you can use variables to control the data processing. For example, you can store values of multiple input records in variables for numeric operations, or you can use the value in the variable for comparison or judgment of a value.

The figure below describes how the variable functionality works.

Figure 3.17 Conversion that uses a variable

The following subsections explain examples of data processing made possible with the variable functionality.

Aggregate function processing

See Example of storing values of the input records to variables and applying numeric operations to those values.

Manipulation based on multiple records

See Example to output the record to a file according to the comparison result.

Separating erroneous records from correct records

See Example of dividing the output files.