OUTPUT XML Files

[attr := ] OUTPUT(recordset, [ format ] ,file ,XML [ (xmloptions) ] [,ENCRYPT( key ) ] [, CLUSTER( target ) ] [, OVERWRITE ][, UPDATE] [, EXPIRE( [ days ] ) ] )

CLUSTEROptional. 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).
targetA 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.
ENCRYPTOptional. Specifies writing the file to disk using both 256-bit AES encryption and LZW compression.
keyA string constant containing the encryption key to use to encrypt the data.
OVERWRITEOptional. Specifies overwriting the file if it already exists.
UPDATESpecifies that the file should be rewritten only if the code or input data has changed.
EXPIREOptional. Specifies the file is a temporary file that may be automatically deleted after the specified number of days.
daysOptional. 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 ] )

TRIM

OPT

rowtagThe text to place in record delimiting tag.
HEADINGSpecifies placing header and footer records in the file.
headertextThe text of the header record to place in the file.
footertextThe text of the footer record to place in the file.
TRIMSpecifies removing trailing blanks from string fields before output.
OPTSpecifies 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> */