STD and BIN format pipes can transmit either fixed- or variable-length records. They are the only data pipe formats that use the SPAREA SPMAXLEN and SPRECLEN properties. SPMAXLEN sets the maximum length for data records to be passed through a data pipe; SPRECLEN specifies the actual length of a particular data record.
When you define an input pipe to handle fixed-length records, you set SPMAXLEN. The RSP needs to read SPMAXLEN only once. SPRECLEN is not required and is set by MainframeConnect.
For every record sent through an input pipe, MainframeConnect places the record length in SPRECLEN, overwriting the existing SPRECLEN value. You must check this value (record length) for each record after every GETPIPE.
The following table explains how to set input pipes for fixed- or variable-length records.
Fixed-length data |
Set SPMAXLEN on the OPENPIPE command to the length of a single data record. |
Variable-length data |
Set SPMAXLEN; then after each GETPIPE, check SPRECLEN and process the incoming record accordingly. Check SPRECLEN only if it is possible that the client application passes variable-length records. |
For every record sent through an output pipe—that is, before every PUTPIPE—the RSP must place the record length in SPRECLEN. The following table explains how to set output pipes for fixed- or variable-length records.
Fixed-length data |
Set SPMAXLEN with the OPENPIPE command. |
Variable-length data |
Set SPMAXLEN with the OPENPIPE command, then set SPRECLEN with every PUTPIPE. |
If both an input pipe and an output pipe are open simultaneously, the RSP needs to know whether the value in SPMAXLEN reflects the input or output pipe. In addition, depending on whether the data is fixed- or variable-length, the RSP may need to reset or restore and reread the SPRECLEN value for every output data record. The following table summarizes how you set fixed- and variable-length data for concurrent input and output pipes.
Input and output pipes both fixed-length data |
If both data records are the same length:
If the data records are different lengths:
|
Input and output pipes both variable-length data |
|
Input pipe fixed-length; Output pipe variable- length |
Handle as if they were both fixed-length, and of the length set in the output pipe SPMAXLEN. |
Input pipe variable- length; Output pipe fixed-length |
Handle as if they were both variable-length. |
Copyright © 2005. Sybase Inc. All rights reserved. |
![]() |