PUTS

Write sequential fixed-length data

WSupported on Windows
USupported on Unix
VSupported on OpenVMS
NSupported in Synergy .NET
PUTS(channel, data_area[, label]) [[error_list]]

channel

The channel to which you want to write the data. The channel must already have been opened in output, append, or update mode with no submode specified. (n)

On OpenVMS, the channel must be open to a file that has a stream record format, or be opened to a serial or terminal device.

data_area

An expression whose contents are to be transmitted. The size of the result of the expression determines how many characters are output. For example, an a623 variable sends the next 623 characters. (a)

label

(optional) The label to which control is transferred if the output device is full.

error_list

(optional) An I/O error list. If any one of the specified errors occurs during the PUTS, control is transferred to the associated label.

The PUTS statement writes the specified data area’s next sequential fixed-length record to a channel. It does not interpret the data being transmitted. It assumes that each character is an 8-bit binary value.

During PUTS processing, record terminators are not automatically attached or stripped.

When using xfServer, setting the SCSPREFETCH environment variable turns on record buffering for the PUTS statement. See SCSPREFETCH for more information.

The examples below use the following data division.

record
    area1               ,a38
    area2               ,a1967
    area3               ,a5

The following example sends the five bytes contained in area3 to the specified channel. Since PUTS performs sequential access, the output begins at the current position in the file.

puts(CHN, area3)

The next example outputs a 1967-byte record to the file opened on CHN. If an error is trapped, control immediately transfers to the statement lbl1.

puts(CHN, area2) [err=lbl1]