Data Transformation Engine Functions and Expressions Reference Guide

Chapter 3 - Function Reference CONVERT
Functions and Expressions Reference Guide
76
CONVERT
The CONVERT function replaces each byte of a byte stream or text expression with
a byte from another byte stream or text expression. The decimal value of each
byte of the first argument is used to locate the corresponding byte in the second
argument that will replace it.
Syntax
CONVERT ( single-byte-stream-or-text-expression , single-
byte-stream-or-text-expression )
Meaning
CONVERT (bytes_to_replace , replacement_bytes)
Returns
This function returns a single-byte-stream-or-text-item.
Replaces each byte of bytes_to_replace with a byte from replacement_bytes.
The byte chosen from replacement_bytes is the one whose index is the decimal
value of bytes_to_replace. The first byte of replacement_bytes has the index
value of zero. If there is no corresponding byte in replacement_bytes,
CONVERT returns NONE.
Example
CONVERT ( SYMBOL ( 0 ) ,"AB" ) returns A
CONVERT ( SYMBOL ( 1 ) ,"AB" ) returns B
CONVERT ( SYMBOL ( 2 ) ,"AB" ) returns NONE
CONVERT ( ASCII , ATOETable ) converts ASCII text to EBCDIC,
based on values in a table named ATOETable
Uses
Use the
CONVERT function to convert ASCII to EBCDIC or EBCDIC to ASCII
data. See the convert.mms map source file in the
examples\general\portdata directory. One of the maps in convert.mms is
ASCII_TO_EBCDIC, which converts ASCII to EBCDIC; another map,
EBCDIC_TO_ASCII converts EBCDIC to ASCII.
Note ASCII to EBCDIC conversion can be performed automatically by defining the
appropriate data language (ASCII or EBCDIC) for each data item.