Skip to main content

USE Command for TCP Devices

USE Command for TCP Devices

The USE command issued from either the client or server lets you prepare to send or receive data using a TCP connection you previously opened. It has the following syntax (colons must be specified as shown):

USE devicename:(::mode:terminators)

Where:

devicename

A string of the form |TCP| followed by some number of numeric digits. The numeric portion of the device name is called the device identifier. If the port number is not specified in the OPEN parameters, this device identifier must be a unique five-digit TCP port number. If the port number is specified in the OPEN parameters (which is the preferred practice), this device identifier can be any unique number, so long as all the TCP device names used by a single job are distinct.

mode

OptionalUSE supports the same mode parameters as OPEN. See OPEN and USE Command Keywords for TCP Devices.

terminators

Optional — A list of up to eight user terminator characters that will terminate reads on the TCP binding device. It does not make sense to specify both T mode and user terminators at the same time, but if you do then T mode is ignored.

The simplest form of USE takes its mode and terminators parameters from the OPEN command, as shown in the following example:

   USE "|TCP|4"

You can replace, add, or delete mode parameters and user terminators after the device has been opened.

To replace the parameters specified in OPEN, specify replacement values in USE. In the following example, the USE command replaces the OPEN mode with PSTE mode and turns off any user terminators:

   USE "|TCP|4":(::"PSTE")

To add to or delete from the mode parameters specified in OPEN, use the + sign to introduce mode parameters that will be turned on, and the - sign to introduce mode parameters that will be turned off. If you do not specify either + or -, the new set of mode parameters replaces the existing mode parameters. In the following example, the USE command turns off Q mode (send immediate) and turns on W mode (wait). It leaves the rest of the mode string unchanged:

   USE "|TCP|4":(::"-Q+W")

In the following example, the USE command leaves the mode string unchanged and specifies a new set of user terminators.

   USE "|TCP|4":(::"+":$CHAR(3,4))
FeedbackOpens in a new tab