#### CSV

#### Synopsis

    HELP:   Read a data field based on separators and optional enclosing characters (CSV - RCF4180)
    TYPE:   OBJECT
    SYNTAX: CSV(COLNAM='str',CHRSET=NONE/SYSTEM/ASCII/UCS1/UTF8/EBCDIC/UCS2BE/UTF16BE/UCS2LE/UTF16LE/UCS4BE/UTF32BE/UCS4LE/UTF32LE/LOCAL,SEPCHR[num/COMMA/COLON/SEMICOLON/TABULATOR/BLANK...],FLDCHR[num/QUOTATION/APOSTROPHE/GRAVEACCENT/PARENTHESES/RBRACKETS/SBRACKETS/BRACES/CBRACKETS/ABRACKETS...],EXCCHR[num/TABULATOR...],PADCHR=num,ALIGN=num,CASEHL,NONFLD)

#### Description

This object is used to read a column in CSV format, which exists in multiple variants. All that is necessary to parse CSV input is a list of column separators and optional field enclosing characters. A limit on the maximum length and/or an alignment can optionally be set for better format detection.

All control characters (0x00-0x19) are regarded as row delimiters. If a padding byte is specified, it is also regarded as control character. The field enclosing characters cannot be a control or whitespace character. The defined column separators are excluded from the control characters. An additional list of code points can be specified which are excluded from the control character list.

If a field is enclosed by field enclosing characters, any kind of control character and whitespace can be in the data. If the field enclosing character is also part of the actual data, it is expected to be escaped by doubling the character (i.e. two quotation marks for a quotation mark in the data). If a field consists of only two consecutive field enclosing characters, it is treated as an empty value. A special behavior is implemented for brackets. If one of the opening brackets "(<{[" is set as field enclosing character, then the corresponding closing bracket is expected for field termination. This allows to read CSV lines like: (John Doe),(123),(42,23)

If you need 0xC285 (UTF-8 NEL) as record delimiter or any other kind of binary delimiter, please use CNV.REC() for table formatting.

#### Arguments

- `STRING: COLNAM='str' - Column name to detect the headline [COLUMN-NAME]`
- `NUMBER: CHRSET=NONE/SYSTEM/ASCII/UCS1/UTF8/EBCDIC/UCS2BE/UTF16BE/UCS2LE/UTF16LE/UCS4BE/UTF32BE/UCS4LE/UTF32LE/LOCAL - Character set of the CSV column [SYSTEM]`
  - `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: SEPCHR[num/COMMA/COLON/SEMICOLON/TABULATOR/BLANK...] - List of separator characters as Unicode codepoints [COMMA,SEMICOLON]`
  - `COMMA - Comma separated (default)`
  - `COLON - Separated by colon (':')`
  - `SEMICOLON - Separated by semicolon (';')`
  - `TABULATOR - Separated by tabulator (x'0009')`
  - `BLANK - Separated by blank (x'0020')`
- `NUMBER: FLDCHR[num/QUOTATION/APOSTROPHE/GRAVEACCENT/PARENTHESES/RBRACKETS/SBRACKETS/BRACES/CBRACKETS/ABRACKETS...] - List of field enclosing characters as Unicode codepoints [QUOTATION,APOSTROPHE,GRAVE]`
  - `QUOTATION - Quotation mark as enclosing character`
  - `APOSTROPHE - Apostrophe as enclosing character`
  - `GRAVEACCENT - Grave accent as enclosing character`
  - `PARENTHESES - Round brackets as enclosing character`
  - `RBRACKETS - Round brackets as enclosing character`
  - `SBRACKETS - Square brackets as enclosing character`
  - `BRACES - Curly brackets as enclosing character`
  - `CBRACKETS - Curly brackets as enclosing character`
  - `ABRACKETS - Angle brackets as enclosing character`
- `NUMBER: EXCCHR[num/TABULATOR...] - Exclude from control characters as Unicode codepoint list [NONE]`
  - `TABULATOR - Apostrophe (Single quotation mark) as enclosing character`
- `NUMBER: PADCHR=num - Binary padding character (is regarded as additional control character) [0x00]`
- `NUMBER: ALIGN=num - Align data to the next multiple of this value in bytes [1 (no alignment)]`
- `SWITCH: CASEHL - Case-sensitive comparison of headline identifier [FALSE]`
- `SWITCH: NONFLD - No field enclosing character [FALSE]`