OUTPUT Thor/Flat Files

[attr := ] OUTPUT(recordset [, [ format ] [,file [, CLUSTER( target ) ] [,ENCRYPT( key ) ]

[,COMPRESSED] [,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.
COMPRESSEDOptional. Specifies writing the file using LZW compression.
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 since the file was read.
daysOptional. The number of days from last file read after which the file may be automatically deleted. If EXPIRE is specified without number of days, it defaults to use the ExpiryDefault setting in Sasha.

This form writes the recordset to the specified file in the specified format. If the format is omitted, all fields in the recordset are output. If the file is omitted, then the result is sent back to the requesting program (usually the ECL IDE or the program that sent the SOAP query to a Roxie).

Example:

OutputFormat1 := RECORD
  People.firstname;
  People.lastname;
END;
  
A_People := People(lastname[1]='A');
Score1 := HASHCRC(People.firstname);
Attr1 := People.firstname[1] = 'A';

OUTPUT(SORT(A_People,Score1),OutputFormat1,'hold01::fred.out');
  // writes the sorted A_People set to the fred.out file in
  // the format declared in the OutputFormat1 definition

OUTPUT(People,{firstname,lastname});
  // writes just First and Last Names to the command issuer
  // full qualification of the fields is unnecessary, since
  // the "on-the-fly" records structure is within the
  // scope of the OUTPUT -- People is assumed

OUTPUT(People(Attr1=FALSE));
  // writes all Peeople fields from records where Attr1 is
  // false to the command issuer