Previous Topic: CA ADS Structure DescriptionNext Topic: Notes


Socket Call Interface for COBOL

Programs written in COBOL use the CALL statement to exploit TCP/IP sockets:

CALL 'IDMSOCKI' USING
         function,
         return-code,
         errno,
         reason-code,
         function-dependent-parameter1,
           . . .

A call to IDMSOCKI must pass the following four parameters:

Parameter

Description

function

Specifies a 4-byte, fullword-aligned, integer field that the program sets to the desired socket function. The following is the sample definition of a function field:

01 SOCKET-FUNCTION PIC S9(8) COMP.

A detailed description of the supported functions can be found in Function Descriptions.

return-code

Specifies a 4-byte, fullword-aligned, integer field that receives the outcome of the operation. The following are the returned values:

  • 0—No errors occurred.
  • 20—A parameter list error was encountered.
  • -1—A socket error was encountered; the errno and reason-code fields contain more detailed information about the error.

The following is the sample definition of a return-code field:

01 SOCKET-RETCD PIC S9(8) COMP.

errno

Specifies a 4-byte, fullword-aligned, integer field that receives the ERRNO value when return-code is -1. The following is the sample definition of an errno field:

01 SOCKET-ERRNO PIC S9(8) COMP.

For more information, see Return, Errno, and Reason Codes.

reason-code

Specifies a 4-byte, fullword-aligned, integer field that receives the reason code value when return-code is -1. The following is the example definition of a reason-code field:

01 SOCKET-RSNCD PIC S9(8) COMP.

For more information, see Return, Errno, and Reason Codes.

Depending on the function, zero or more parameters can follow.