Input pipes

You can only use input pipes when an RSP is invoked through the Access Service Library or gateway-less; you cannot use input pipes when an RSP is invoked through TRS. The RSP uses input pipes to read rows of data from the client application.

NoteInput pipes must be defined as standard (STD) or binary (BIN) format.

The following code example shows how an RSP uses the SPAREA fields to define an input pipe, then opens, reads from, and closes the input pipe:

MOVE 'INPUT' TO SPMODE
 MOVE 'STD' TO SPFORMAT
 MOVE nnnn TO SPMAXLEN
 SET ADDRESS SPINTO TO dataarea
 CALL 'OPENPIPE' USING SPAREA
 CALL 'GETPIPE' USING SPAREA
 PROCESS INPUT DATA
CALL 'CLOSPIPE' USING SPAREA
 CALL ‘MESSAGE’ USING SPAREA
 CALL 'STATUS' USING SPAREA

– defines an input pipe – defines input pipe as STD format – set maximum size of data record – sets input pointer to record – opens the pipe – reads from the pipe where your code processes data – closes the pipe – writes messages – sets the return code and returns messages and data

A STD or BIN format pipe requires that the SPMAXLEN field provides the maximum size (in bytes) of the data record written to or read from the data pipe.

When defining an input pipe, you need to specify the format of the data to be transmitted through the pipe. An input pipe uses only STD and BIN formats, which do not require data structure information.

STD

(Standard) The simplest type of data pipe to use is the STD format. With a standard data pipe, records are transmitted as a single character string between the client and the RSP. The data is transmitted as variable-length character (VARCHAR) records. Use STD only with input pipes.

BIN

(Binary) With the BIN format, data is transmitted as a binary string. If you transmit records of binary data and you do not want ASCII-EBCDIC or EBCDIC-ASCII conversion done, specify a data pipe in the BIN format. Use BIN only with input pipes.

NoteYou can transmit any data, including DB2 data, using a STD or BIN data pipe.

For more information about input pipes, see “Using input pipes” and “Using concurrent input and output pipes”.