#### TXT

#### Synopsis

    HELP:   Format data based on delimiters in text elements (record and rest)
    TYPE:   OBJECT
    SYNTAX: TXT(METHOD=BIN/TXT/DLM/REC,CHRSET=NONE/SYSTEM/ASCII/UCS1/UTF8/EBCDIC/UCS2BE/UTF16BE/UCS2LE/UTF16LE/UCS4BE/UTF32BE/UCS4LE/UTF32LE/LOCAL,RPLFFD[=num],SUPTWS,NELDLM,PADCHR=num,RECLEN=num,BUFSIZ=num,INICNT=num,BINERR,CHRERR,REGEXP())

#### Description

The object "format text" splits the data into text records and rest elements based on delimiters (METHOD=TXT). The rest element contains the delimiter and optional trailing whitespace if the suppression of trailing whitespace is activated. The text record and the rest element together compose the original data.

If the data contains no delimiters but record length is available, record formatting (METHOD=REC) is used. In this case, the rest element is empty unless suppression of trailing whitespace is used. If no delimiters and no length fields are found and the BINERR switch is not set, then binary formatting (wrapping of the data into records of the defined length) is done. If the BINERR switch is set, an error is triggered if the data is binary. Delimiter, record or binary formatting can be enforced by defining the corresponding method or the data dependent automatism can be used.

If you have text in one of the ISO code pages with 0x85 (NEL) as delimiter, you can optionally enable recognition of NEL as delimiter. NEL (next line) is optional because this value is the general currency sign or the continuation symbol and not a new line in many single byte ASCII codepages.

- 0x00 (padding character (can be changed))
- 0x0A (carriage return (EBCDIC 0x25))
- 0x0D (line feed (EBCDIC 0x0D))
- 0x0A, 0x0D (carriage return line feed)
- 0x0A, ..., 0x0A, 0x0D (dirty delimiters)
- 0x0A, 0x0D, ..., 0x0D (dirty delimiters)
- 0x0C (form feed (EBCDIC 0x0C))
- 0x85 (new/next line (EBCDIC 0x15, optional if single byte ASCII))

The raw text record (without the rest element) can be validated using a regular expression. Non-matching records can be configured to be ignored or cause an error (default).

Text formatting supports a lot of powerful features which can be accessed with the parameters below.

#### Arguments

- `NUMBER: METHOD=BIN/TXT/DLM/REC - Method for text formatting [DEFAULT]`
  - `BIN - Wrap data block in records of record length`
  - `TXT - Parse data block for text delimiter (DEFAULT)`
  - `DLM - Parse data block for text delimiter (DEFAULT)`
  - `REC - Parse data block based on record length fields`
- `NUMBER: CHRSET=NONE/SYSTEM/ASCII/UCS1/UTF8/EBCDIC/UCS2BE/UTF16BE/UCS2LE/UTF16LE/UCS4BE/UTF32BE/UCS4LE/UTF32LE/LOCAL - Character set [auto detection]`
  - `NONE - No character set defined`
  - `SYSTEM - SYSTEM (environment specific (on mainframe EBCDIC else ASCII))`
  - `ASCII - ASCII (mainly used in the for open system)`
  - `UCS1 - UCS-1 (for text formatting identical to ASCII < 64k)`
  - `UTF8 - UTF-8 (for text formatting identical to ASCII < 2M)`
  - `EBCDIC - EBCDIC (mainly used on IBM mainframe)`
  - `UCS2BE - UCS-2 Big Endian (multibyte character set < 64k)`
  - `UTF16BE - UTF-16 Big Endian (multibyte character set < 2M)`
  - `UCS2LE - UCS-2 Little Endian (multibyte character set < 64k)`
  - `UTF16LE - UTF-16 Little Endian (multibyte character set < 2M)`
  - `UCS4BE - UCS-4 Big Endian (multibyte character set < 64k)`
  - `UTF32BE - UTF-32 Big Endian (multibyte character set < 2M)`
  - `UCS4LE - UCS-4 Little Endian (multibyte character set < 64k)`
  - `UTF32LE - UTF-32 Little Endian (multibyte character set < 2M)`
  - `LOCAL - LOCAL (platform specific (on mainframe EBCDIC else ASCII))`
- `NUMBER: RPLFFD=num - Replace form feeds, filling rest of page with blank lines assuming n lines per page [60]`
- `SWITCH: SUPTWS - Suppress trailing whitespaces [FALSE]`
- `SWITCH: NELDLM - Activate NEL (0x85) as delimiter for ASCII character sets [FALSE]`
- `NUMBER: PADCHR=num - Padding character (is regarded as additional delimiter) [0x00]`
- `NUMBER: RECLEN=num - Maximum length of a text record (Host) / line (Unix/Win) [512]`
- `NUMBER: BUFSIZ=num - Initial buffer size for preallocation [65536]`
- `NUMBER: INICNT=num - Initial amount of records for preallocation [128]`
- `SWITCH: BINERR - Enforce an error if binary data detected [FALSE]`
- `SWITCH: CHRERR - Enforce an error if character data without delimiter detected [FALSE]`