CSV

Top  Previous  Next

 

The CSV display option keyword specifies that the report should be produced in CSV format.

 

 

Format

 

CSV {mode} {"delimiter"}

 

where

 

modeis a numeric value specifying the format rules to be applied.

 

delimiteris an alternative delimiting character. This may not be a double quote.

 

 

The CSV keyword produces a report in CSV (comma separated variable) format as used by many software products. In this format, each item in the report is separated by a comma instead of the usual tabular style of report. QM extends this format by allowing use of an alternative delimiter character.

 

The mode option specifies the format rules to be applied. A mode value of 1 (the default if no mode is given) produces output that conforms to the CSV format specification (RFC 4180). This requires that items containing double quotes or the delimiter character are enclosed in double quotes with embedded double quotes replace by two adjacent double quotes.

 

A mode value of 2 encloses all non-null values in double quotes except for numeric items that do not contain a comma. Embedded double quotes are replaced by two adjacent double quotes.

 

The delimiter may be set to a tab character by use of the special syntax "<TAB>". Other non-printing characters can be specified by use of the ^nnn notation where nnn is the three digit character number from the ASCII character set.

 

In normal usage, the page heading and record counts would probably need to be suppressed using the HDR.SUP and  COUNT.SUP keywords. The COL.SUP keyword can be used to suppress column headings.

 

The TO keyword can be used to specify the pathname of a file to receive the output. Use of this option implies use of HDR.SUP as the output is not paginated.

 

 

Example

 

The command

LIST CUSTOMERS NAME TEL HDR.SUP COL.SUP COUNT.SUP CSV

would produce a display such as that below.

 

17463,Arkright Tool Hire,01726-48745

56221,"Smith,Price and Samuel", 01876-28414

 

Note how the customer name in the second line has been quoted because it contains a comma.

 

 

See also: DELIMITER