Open topic with navigation
WTSupported in traditional Synergy on Windows
WNSupported in Synergy .NET on Windows
USupported on UNIX
VSupported on OpenVMS
PUT(channel, data_area, record) [[error_list]]
The channel to which you want to send data. The channel must already have been opened in output, append, or update mode with no submode specified. (n)
On OpenVMS, the file must have a stream record format.
An expression whose contents are to be written. The size of the result of the expression determines the number of characters transmitted. For example, an a623 variable causes 623 characters to be written. (a)
An expression defining which record is written. If the value is less than 1, you’ll get an “Illegal record number specified” error ($ERR_RECNUM). (n)
(optional) An I/O error list. If any one of the specified errors occurs during the PUT, control is transferred to the associated label.
The PUT statement performs random-access binary output. It does not interpret the data being transmitted. It assumes that each character is an 8-bit binary value.
The record number is interpreted according to the size of the data area. The position of the first character is calculated as follows:
((record - 1) * (size of data_area)) + 1
During PUT processing, record terminators are not automatically attached or stripped.
The examples below use the following data division.
record area1 ,a38 area2 ,a1967 area3 ,a5
The following example sends the 157th five-byte record to the specified channel. The record starts at position 781 from the beginning of the file [ ((157–1) * 5) + 1 = 781 ].
put(CHN, area3, 157)
The next example sends the 1967-byte record whose number is defined by recno to the file opened on CHN. If a trappable error occurs, control immediately transfers to the statement labeled lbl1.
put(CHN, area2, recno) [err=lbl1]