SET OUTPUT FORMAT

Establishes the format for data output.

Syntax

SET OUTPUT FORMAT NORMAL|COMMADELIMITED|XML|XMLSIMPLE

Comments

The value of OUTPUT FORMAT is NORMAL by default. That is, the LIST and OUTPUT commands create output whose format exactly follows the Object Dictionary definitions of the individual fields being output. The SET OUTPUT FORMAT command can be reset to enable these commands to output data in comma delimited format, xml or xmlsimple formats.

When using the comma-delimited format, database fields are separated from one another by the current delimiter character. This is normally a comma, but can be changed using the SET DELIMITER command. Character-type fields have trailing blanks removed and are enclosed within a pair of text delimiters. This is normally double quotation marks, but can be changed using the SET TEXTDELIMITER command. Numeric fields have leading blanks removed.

When using the xml format, database fields are printed using XML conventions. Each XML "record" describes all fields in full detail of the actual record being printed. In other words, each row being printed has sub-rows displaying each field of the row. In turn, each sub-row displays the content of each field.

When using the xmlsimple format, database fields are printed using XML conventions in a simple format. Each XML "record" only describes the field names and their corresponding values.

Fields that are $Null are output using the current SET NULLVALUE string (without text delimiters). If NULLVALUE is a space character, fields that are $Null are output as a pair of text delimiters.

Remarks

The XML and XMLSIMPLE options are only designed for output.

A header can be attached to the output document by using the command SET XMLHEADER.

The identification of each row being printed can be changed by means of the command SET XML ROWELEMENT.

Example

set save
set heading off
set nullvalue "$null"
set output fieldlistwidth off
set output maskfield off
set output virtualfield off
set output format commadelimited
set output UnstructuredDoc
list all Customers
set restore
set output maskfield on    % not saved by save/restore

set save

set output format xmlsimple

set xml rowelement "MyRow"

set output MyDoc

list 1 Doc

set restore

 

Related Topics