PIPE

PIPE( command, recorddef [, CSV | XML ] )

PIPE( recordset, command [, recorddef ] [, REPEAT] [, CSV | XML ] [, OUTPUT( CSV | XML ) ] [, GROUP] [, UNORDERED | ORDERED( bool ) ] [, STABLE | UNSTABLE ] [, PARALLEL [ ( numthreads ) ] ] [, ALGORITHM( name ) ] )

commandThe name of a program to execute, which must take any input data through stdin and produce its output through stdout. This program must have already been deployed on the HPCC Systems cluster in the Thor instance directory (such as: /var/lib/HPCCSystems/mythor/) but that can be overridden by the externalProgDir environment setting for the Thor cluster).
recorddefThe RECORD structure format for output. If omitted, output is the same as the input format.
CSVOptional. In form 1 (and as the parameter to the OUTPUT option), specifies the output data format is CSV. In form 2, specifies the input data format is CSV. If omitted, the format is raw.
XMLOptional. In form 1 (and as the parameter to the OUTPUT option), specifies the output data format is XML. In form 2, specifies the input data format is XML. If omitted, the format is raw.
recordsetThe input dataset.
REPEATOptional. Specifies a new instance of the command program is created for each row in the recordset.
OUTPUTOptional. Specifies CSV or XML result data format.
GROUPOptional. Specifies each result record is generated in a separate GROUP (only if REPEAT is specified).
UNORDEREDOptional. Specifies the output record order is not significant.
ORDEREDSpecifies the significance of the output record order.
boolWhen False, specifies the output record order is not significant. When True, specifies the default output record order.
STABLEOptional. Specifies the input record order is significant.
UNSTABLEOptional. Specifies the input record order is not significant.
PARALLELOptional. Try to evaluate this activity in parallel.
numthreadsOptional. Try to evaluate this activity using numthreads threads.
ALGORITHMOptional. Override the algorithm used for this activity.
nameThe algorithm to use for this activity. Must be from the list of supported algorithms for the SORT function's STABLE and UNSTABLE options.
Return:PIPE returns a record set.

The PIPE function allows ECL code to launch an external command program on each node, effectively parallelizing a non-parallel processing program. PIPE has two forms:

Form 1 takes no input, executes the command, and produces its output in the recorddef format. This is an "input" pipe (like the PIPE option on a DATASET definition).

Form 2 takes the input recordset, executes the command, producing output in the recorddef format. This is a "through" pipe.

Example:

namesRecord := RECORD
  STRING10 forename;
  STRING10 surname;
  STRING2 nl := '\r\n';
END;

d := PIPE('pipeRead 200', namesRecord); //form 1 - input pipe

t := PIPE(d, 'pipeThrough'); //form 2 - through pipe

OUTPUT(t,,PIPE('pipeWrite \\thordata\\names.all')); //output pipe

//Form 2 with XML input:
namesRecord := RECORD
  STRING10 Firstname{xpath('/Name/FName')};
  STRING10 Lastname{xpath('/Name/LName')};
END;

p := PIPE('echo <Name><FName>George</FName><LName>Jetson</LName></Name>', namesRecord, XML); 
OUTPUT(p);

See Also: OUTPUT, DATASET