TO

Synopsis

HELP:   Convert from a neutral FL5 element to a string data type
TYPE:   OBJECT
SYNTAX: TO(REGEXP(),CHRSET(),NUMBER(),MODE=STOP/CUT,FIXEDLENGTH=num,PADDING=NONE/RIGHT/LEFT,PADCHAR='bin'/BINARY-ZERO/ASCII-BLANK/EBCDIC-BLANK/UTF08-BLANK/UTF16BE-BLANK/UTF16LE-BLANK/UTF32BE-BLANK/UTF32LE-BLANK,NULLTERM)

Description

This object can be used to convert an FL5-internal string data type into one of several supported string representations (ASCII, EBCDIC, Unicode strings and numbers).

The string can be validated or manipulated using regular expressions.

The NUMBER object can be used for string-based sanitizing/cleanup of numbers and only works with the local character set. If only NUMBER is specified, then a CHRSET definition with CCSID=DEFAULT (local charset) and WHITESPACE=NUMBER is activated. The returned string containing the number is always in the local ASCII or EBCDIC representation.

If you need character set independent conversion of number strings, including conversion to various number formats (e.g. BCD, binary, ...), you should use the INTEGER or FLOAT number converters which can also read and write strings.

The string can be specified as a fixed-length string by setting the length parameter. The string is then padded with whitespace on the right side by default. The padding sequence can by set as (hex) string. If no length parameter is provided and padding is activated, the strings are padded to fill all of the provided space in memory.

Additionally, you can activate null termination for the string. The returned output length does not include the null termination character.

Arguments