DELIMITER |
|
|
The DELIMITER display option keyword specifies the separating character(s) to be used in a delimited report.
Format
DELIMITER "string" {TO pathname | AS file id {ENCODING name} {NO.QUERY | APPENDING}} where
A delimited report displays it output as a series of items separated by the given string instead of the usual tabular style of report. The DELIMITER keyword causes the query processor to produce this style of report and specifies the separator to be used. The output from a delimited report can, for example, be structured with comma separators, sent to a file using the LPTR keyword and then read into applications such as Microsoft Excel.
The string may contain tab characters by use of the special syntax "<TAB>". Other non-printing characters can be included by use of the ^nnn notation where nnn is the three digit character number from the ASCII character set.
Multivalued items will be split over multiple lines of delimited output. If an item is defined as single valued in the dictionary (or by use of the SINGLE.VALUE keyword) but the corresponding data contains value marks, the marks are treated as normal data characters and the entire multivalued item, including the embedded value marks, will be output as a single element of the delimited output.
The TO option directs output to an operating system file by pathname. The AS option directs output to a named record in a QM directory file. If the destination item already exists, the user will be prompted to confirm whether it should be overwritten. The NO.QUERY option suppresses this prompt, overwriting the existing file. The APPENDING option causes the output to be appended to the output file if it already exists. The NO.QUERY and APPENDING options may not be used together. The optional ENCODING qualifier can be used to set or override the character encoding for the destination file.
Use of TO or AS implies use of HDR.SUP as the output is not paginated.
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.
Examples
The command LIST INVOICES VALUE CUSTOMER.NAME DELIMITER "," HDR.SUP COL.SUP COUNT.SUP would produce a display such as that below.
74529,£1712.43,J McTavish 74273,£95.23,County Newspapers 63940,£141.00,R Bryant 74993,£9.29,Write Right Stationery
The command LIST INVOICES VALUE CUSTOMER.NAME DELIMITER "<tab>" HDR.SUP COUNT.SUP would produce a display such as that below where the spacing is performed by tab characters.
74529 £1712.43 J McTavish 74273 £95.23 County Newspapers 63940 £141.00 R Bryant 74993 £9.29 Write Right Stationery
A command such as LIST SALES ITEM.NO DELIMITER "," where ITEM.NO is multivalued might produce a report containing 26832,176 ,218 ,398
Modifying the command to be LIST SALES ITEM.NO SINGLE..VALUE DELIMITER would change the output to be 16832,176VM218VM398
See also: CSV |