Table of Contents

Search

  1. Preface
  2. Introduction
  3. Installation
  4. Design
  5. Operation

Transformations

Transformations

Fields within a View Definition may specify an optional transformation. Only Transformations that manipulate the source data are supported in output.
A transformation definition follows the field’s length attribute and has the following format:
Xform(transform [, parameter-list])
where
transform
is one of the following:
APPEND
Appends the current field with the target field by removing trailing spaces from the target field and adding the current field. (input only)
APPEND-STRING
Appends a character string by removing all trailing space and adding the string. The
parameter-list
contains the character string. (input only)
CONCATENATE
Concatenate the current field with the target field by removing trailing spaces from the target field, adding a space, and adding the current field. (input only)
FILL
Fills the target field with a given pattern. The parameter-list contains the character string pattern.
INSERT-CONSTANT
Inserts a character string into a field. The parameter-list contains the character string.
INSERT-FIELD
Inserts the current field to the target field at a specified fixed offset. (input only)
LOWERCASE
Convert a character field to lower case.
UPPERCASE
Convert a character field to upper case.
USER-EXIT
Calls a user-specified routine to perform the transformation. Refer to the Transformation User-Exit section for more details.
Transformation can be applied to both input and output processes.
Multiple transformations can be defined on a single field. They are processed in the order of specification (ie left to right).
A source field can populate multiple target fields by using the following syntax:
FIELD=name,format,length,Xform(transform[,parameter-list]), Xform(transform[,parameter-list])
Example:
FIELD=Lname, C, 15, Xform(INSERT-FIELD, "target LNAME1"), Xform(INSERT-FIELD, "target LNAME2")
The contents of field
Lname
will be copied to fields
LNAME1
and
LNAME2
in the Clustering IDT.

Append Syntax

The Append transform has the following syntax:
Xform (APPEND, "target field-name, order")
field-name
specifies the field to which the current field will be appended.
order
specifies the order in which to append multiple fields to
field-name
. Specify a number, starting from 1.
Example:
FIELD=Name1, C, 45, Xform(APPEND, "target NAME,1") FIELD=Name2, C, 45, Xform(APPEND, "target NAME,2")
All trailing blanks from field
Name1
will be removed and
Name2
will be appended to it and the result inserted into the field
NAME
.

Append-String Syntax

The Append transform has the following syntax:
Xform (APPEND-STRING, "string")
string
will be appended to the source field string and copied to the target field.
Example:
FIELD=Surname, C, 15, Xform(APPEND-STRING, ":")
The character ":" will be appended to the
Surname
field.

Concatenate Syntax

The Concatenate transform has the following syntax:
Xform (CONCATENATE, "target field-name, order") or Xform (CONCAT, "target field-name, order")
The
field-name
specifies the field to which the current field will be concatenated.
order
specifies the order in which to concatenate multiple fields to
field-name
. Specify a number, starting from 1.
Example:
FIELD=Name1, C, 45, Xform(CONCATENATE, "target NAME,1") FIELD=Name2, C, 45, Xform(CONCATENATE, "target NAME,2")
Name2
will be concatenated to
Name1
and the result inserted into
NAME
.

Fill Syntax

The Fill transform has the following syntax:
Xform (FILL, "string")
The target field will be populated with the pattern defined in parameter
string
.
Example:
FIELD=Filler, C, 45, Xform(FILL, "+-+")
The field
Filler
will be filled with the string
"+-+"
repeatedly until the whole 45 characters are used.
A special expression "
Numeric(NUM)
" can be used instead of a literal string. This means that the target field will be filled with the character value of the decimal number
NUM
using the computer’s native character set. For example,
FIELD=Tabs, C, 2, Xform(FILL, Numeric(9))
causes the field
Tabs
to be filled with the tab character (0x09) on computers using the ASCII character set.

Insert-Constant Syntax

The Insert-Constant transform has the following syntax:
Xform (INSERT-CONSTANT, "string")
The
string
will be inserted in the target field.
Example:
FIELD=Title, C, 10, Xform(INSERT-CONSTANT, "hello")
The
Title
field will contain the constant
"hello"
.
A special expression "
Numeric(NUM)
" can be used instead of a literal string. This means that the first position of the target field will contain the character value of the decimal number
NUM
using the computer’s native character set. For example,
FIELD=TabAndSpaces, C, 3, Xform(INSERT-CONSTANT, Numeric(9))
causes the first byte of the field TabAndSpace to contain a tab character (0x09) on computers using the ASCII character set. The remaining bytes in the field - two in this example - are filled with spaces.

Insert-Field Syntax

The Insert-Field transform has the following syntax:
Xform (INSERT-FIELD, "target field-name, [offset]")
The
field-name
specifies the field to which the current field will be appended at offset. The default value of offset is 0.
Example:
FIELD=Addr1, C, 45, Xform(INSERT-FIELD, "target ADDR") FIELD=Addr2, C, 45, Xform(INSERT-FIELD, "target ADDR,45")
The contents of
Addr1
will be copied to field
ADDR
at offset 0. The contents of field
Addr2
will be copied to field
ADDR
at offset 45.

Uppercase/Lowercase Syntax

The Uppercase/Lowercase transform has the following syntax:
Xform (UPPERCASE) Xform (LOWERCASE)
It changes the string in the data to the specified case.
Example:
FIELD=Surname, C, 15, Xform(UPPERCASE) FIELD=First, C, 45, Xform(LOWERCASE)
Fields
Surname
and
First
will be converted to upper and lowercase respectively

Transformation User-Exit

A Transform User-Exit (TUE) is used to alter a record prior to insertion into the IDT.
The TUE is called after reading a record from the source file and before any field level transforms have been performed. The TUE is a "record level" exit, meaning that it has access to the entire record. Upon return from the exit, Data Clustering Engine will perform field-level transforms while converting the view record into IDT layout.
The normal use for a TUE is to insert data into a new field. Anew field can be created with the transform by specifying a name, format and length. The field can then be referenced in the TUE.
The TUE is enabled by adding a user-exit transform definition. For example,
VIEW-DEFINITION *============== NAME=DATAIN FIELD=Name, C, 60 FIELD=Myfield, C, 50, XFORM(user-exit, "mydll myfunc")
defines a field called
Myfield
which can be populated by the user-exit function
myfunc
, which is available in a shared object called
mydll
.
User-Exits must conform to a specific protocol in order to communicate with Data Clustering Engine. A User-Exit is written in C and compiled and linked as a DLL/shared library. DCE will load the User-Exit and call a predefined entry point when a "service" is required from the exit.
The parameters and other details for Transformation User-Exits are only available on request.

0 COMMENTS

We’d like to hear from you!