Reading and Writing Dad Pipes

The following list of functions may be used to write and read from Dad pipes:

What is a Dad Pipe?

Pipes in dad are quite similar to and actually using UNIX pipes. Data from one process is piped into another process without using intermediate disk i/o. In addition dad pipes can fork and collect data on record basis. So a fast I/O intensive process will fork it's output to a rather CPU intensive processes and a collector in the end will collect the chain's output:

In fact Dad Pipes (even each forked one) start with a header containing the Metatable information about the stored dataflows and tables followed by so called records. This records are copies of the Adamo dataflow at the time the user wrote the dataflow into the pipe. Dad files have the same structure as the Dad files.

Reading from a Dad Pipe

For reading a Dad pipe a dadOpenPipe opens the pipe to be read:
f77: Call dadOpenPipe( Id, Pipename, Dataflow, Split, CAC_READ, err )
  or
c:   dadOpenPipe( &Id, Pipename, Dataflow, Split, CAC_READ, &err )
Later subsequent calls to dadRead will read the sequential records from the pipe:
f77: Call dadRead( Id, err )    
  or
C:   dadRead( Id, &err )
dadRead will return an error message in err after the writer has closed the pipe.

The Dad pipe has to be closed by a call to dadClosePipe.

f77: Call dadClosePipe( Id, err )
  or
c:   dadClosePipe( Id, &err )

Writing to a Dad Pipe

For writing to a Dad pipe also a dadOpenPipe creates the pipe to be written to:
f77: Call dadOpenPipe( Id, Pipename, Dataflow, Split, CAC_WRITE, err )
  or
C:   dadOpenPipe( &Id, Pipename, Dataflow, Split, CAC_WRITE, &err )
Later subsequent calls to dadWrite will write sequential records into the pipe (the contents of the above named dataflow):
f77: Call dadWrite( Id, err )
  or
C:   dadWrite( Id, &err )
The Dad pipe has to be closed by a call to dadClosePipe.
f77: Call dadClosePipe( Id, err )
  or
C:   dadClosePipe( Id, &err ) 

Examples

Another way of writing to pipes is the piper program.
This page is maintained by Wolfgang Wander