Open topic with navigation
WTSupported in traditional Synergy on Windows
WNSupported in Synergy .NET on Windows
USupported on UNIX
VSupported on OpenVMS
PUTS(channel, data_area[, label]) [[error_list]]
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.
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)
(optional) A label to which control is transferred if an “End of file” error ($ERR_EOF) occurs.
(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.
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]