[attr := ] OUTPUT(recordset, [ format ] ,file ,XML [ (xmloptions) ] [,ENCRYPT( key ) ] [, CLUSTER( target ) ] [, OVERWRITE ][, UPDATE] [, EXPIRE( [ days ] ) ] )
CLUSTER | Optional. Specifies writing the file to the specified list of target clusters. If omitted, the file is written to the cluster on which the workunit executes. The number of physical file parts written to disk is always determined by the number of nodes in the cluster on which the workunit executes, regardless of the number of nodes on the target cluster(s). |
target | A comma-delimited list of string constants containing the names of the clusters to write the file to. The names must be listed as they appear on the ECL Watch Activity page or returned by the Std.System.Thorlib.Group() function, optionally with square brackets containing a comma-delimited list of node-numbers (1-based) and/or ranges (specified with a dash, as in n-m) to indicate the specific set of nodes to write to. |
ENCRYPT | Optional. Specifies writing the file to disk using both 256-bit AES encryption and LZW compression. |
key | A string constant containing the encryption key to use to encrypt the data. |
OVERWRITE | Optional. Specifies overwriting the file if it already exists. |
UPDATE | Specifies that the file should be rewritten only if the code or input data has changed. |
EXPIRE | Optional. Specifies the file is a temporary file that may be automatically deleted after the specified number of days. |
days | Optional. The number of days after which the file may be automatically deleted. If omitted, the default is seven (7). |
This form writes the recordset to the specified file as XML data with the name of each field in the specified format becoming the XML tag for that field's data. The valid set of xmloptions are:
'rowtag'
HEADING( headertext [, footertext ] )
rowtag | The text to place in record delimiting tag. |
HEADING | Specifies placing header and footer records in the file. |
headertext | The text of the header record to place in the file. |
footertext | The text of the footer record to place in the file. |
TRIM | Specifies removing trailing blanks from string fields before output. |
OPT | Specifies omitting tags for any empty string field from the output. |
If no xmloptions are specified, the defaults are:
XML('Row',HEADING('<Dataset>\n','</Dataset>\n'))
Example:
R := {STRING10 fname,STRING12 lname};
B := DATASET([{'Fred','Bell'},{'George','Blanda'},{'Sam',''}],R);
OUTPUT(B,,'fred1.xml', XML); // writes B to the fred1.xml file
/* the Fred1.XML file looks like this:
<Dataset>
<Row><fname>Fred </fname><lname>Bell</lname></Row>
<Row><fname>George</fname><lname>Blanda </lname></Row>
<Row><fname>Sam </fname><lname></lname></Row>
</Dataset> */
OUTPUT(B,,'fred2.xml',XML('MyRow', HEADING('<?xml version=1.0 ...?>\n<filetag>\n','</filetag>\n')));
/* the Fred2.XML file looks like this:
<?xml version=1.0 ...?>
<filetag>
<MyRow><fname>Fred </fname><lname>Bell</lname></MyRow>
<MyRow><fname>George</fname><lname>Blanda</lname></MyRow>
<MyRow><fname>Sam </fname><lname></lname></MyRow>
</filetag> */
OUTPUT(B,,'fred3.xml',XML('MyRow',TRIM,OPT));
/* the Fred3.XML file looks like this:
<Dataset>
<MyRow><fname>Fred</fname><lname>Bell</lname></MyRow>
<MyRow><fname>George</fname><lname>Blanda</lname></MyRow>
<MyRow><fname>Sam</fname></MyRow>
</Dataset> */