Delimited file format

A delimited file is a sequential file with column delimiters. Each delimited file is a stream of records, which consists of fields that are ordered by column.

Each record contains fields for one row. Within each row, individual fields are separated by column delimiters. All fields must be delimited character strings, non-delimited character strings, or external numeric values. Delimited character strings can contain column delimiters and can also contain character string delimiters when two successive character string delimiters are used to represent one character.

All characters in all records are in the same CCSID. If EBCDIC or ASCII data contains DBCS characters, the data must be in an appropriate mixed CCSID. If the data is Unicode it must be in CCSID 1208.

The following figure describes the format of delimited files that can be loaded into or unloaded from tables by using the LOAD and UNLOAD utilities.

Figure 1. Format of delimited files
Delimited file ::= Row 1 data ||
                   Row 2 data || 
                   .
                   .
                   .
                   Row n data   

Row i data ::= Cell value(i,1) || Column delimiter || 
               Cell value(i,2) || Column delimiter || 
               .
               .
               .
               Cell value(i,m)  

Column delimiter ::= Character specified by COLDEL option; 
                       the default value is a comma (,)  

Cell value(i,j) ::= Leading spaces || 
                    External numeric values || 
                    Delimited character string ||  
                    Non-delimited character string ||
                    Trailing spaces

Non-delimited character string ::= A set of any characters except 
                                     a column delimiter  

Delimited character string ::= A character string delimiter ||   
                               A set of any characters except a 
                                 character string delimiter unless
                                 the character string delimiter is
                                 part of two successive character
                                 string delimiters ||
                               A character string delimiter ||  
                               Trailing garbage

Character string delimiter ::= Character specified by CHARDEL option; the default
                                 value is a double quotation mark (")

Trailing garbage ::= A set of any characters except a column delimiter