WRITE

The WRITE call writes data on a connected socket.

Sockets act like streams of information with no boundaries separating data. For example, if a program wants to send 1000 bytes, each call to this function can send any number of bytes, up to the entire 1000 bytes. The number of bytes sent will be returned in RETCODE. Therefore, programs should place this call in a loop, calling this function until all data has been sent.

Example of WRITE call

SOC_FUNCTION DC   CL16'WRITE'
S            DS   H
NBYTE        DS   F
BUF          DS   CL(length of buffer)
ERRNO        DS   F
RETCODE      DS   F
 
             CALL DFHSOKET,(SOC_FUNCTION,S,NBYTE,BUF,ERRNO,RETCODE)

Input parameters

SOC_FUNCTION
A 16-byte character field containing WRITE. The field is left-justified and padded on the right with blanks.
S
A halfword binary field set to the socket descriptor.
NBYTE
A fullword binary field set to the number of bytes of data to be transmitted.
BUF
Specifies the buffer containing the data to be transmitted.

Output parameters

ERRNO
A fullword binary field. If RETCODE is negative, the field contains an error number. See Return codes for information about ERRNO return codes.
RETCODE
A fullword binary field that returns one of the following:
Value
Description
≥0
A successful call. A return code greater than zero indicates the number of bytes of data written.
-1
Check ERRNO for an error code.


dfhtn10.html | Timestamp icon Last updated: Monday, 5 June 2017