Set (Socket function): Difference between revisions
m (1 revision) |
m (1 revision) |
||
Line 28: | Line 28: | ||
<td>The value the parameter or setting should be changed to. If the keyword is self-defining, this argument may be omitted or left null. Valid values are explained in the keyword list provided below. | <td>The value the parameter or setting should be changed to. If the keyword is self-defining, this argument may be omitted or left null. Valid values are explained in the keyword list provided below. | ||
<table> | <table> | ||
<tr><th>Keyword</th> <th>Meaning </th></tr> | <tr><th><var>Keyword</var></th> <th><var>Meaning </var></th></tr> | ||
<tr><th>AUDTERM</th> | <tr><th><var>AUDTERM</var></th> | ||
<td>Terminal output '''is sent''' to the audit trail. | <td>Terminal output '''is sent''' to the audit trail. | ||
Not valid for <var>[[JANUS DEFINE#type|CLSOCK]]</var> sockets. | Not valid for <var>[[JANUS DEFINE#type|CLSOCK]]</var> sockets. | ||
Line 35: | Line 35: | ||
Not valid for <var>CLSOCK</var> sockets. | Not valid for <var>CLSOCK</var> sockets. | ||
The default is taken from the socket's port definition (see <var>[[NOAUDTERM]]</var>). This requires that the socket be <var>OPEN</var>. </td></tr> | The default is taken from the socket's port definition (see <var>[[NOAUDTERM]]</var>). This requires that the socket be <var>OPEN</var>. </td></tr> | ||
<tr><th>BINARY</th> | <tr><th><var>BINARY</var></th> | ||
<td>Do not translate bytes sent and received. | <td>Do not translate bytes sent and received. | ||
The default is taken from the socket's port definition. This requires that the socket be <var>OPEN</var>. </td></tr> <tr><th>CHAR</th> | The default is taken from the socket's port definition. This requires that the socket be <var>OPEN</var>. </td></tr> <tr><th><var>CHAR</var></th> | ||
<td>Translate strings sent and received with <var>Socket</var> methods between the internal representation within <var class="product">Model 204</var> (EBCDIC) and the character representation used by the remote end of the connection. | <td>Translate strings sent and received with <var>Socket</var> methods between the internal representation within <var class="product">Model 204</var> (EBCDIC) and the character representation used by the remote end of the connection. | ||
The default is taken from the socket's port definition. This requires that the socket be <var>OPEN</var>. </td></tr> <tr><th>CLOSE</th> | The default is taken from the socket's port definition. This requires that the socket be <var>OPEN</var>. </td></tr> <tr><th><var>CLOSE</var></th> | ||
<td>Close socket at end of request; this is the default for <var>CLSOCK</var> sockets. | <td>Close socket at end of request; this is the default for <var>CLSOCK</var> sockets. | ||
This applies to any in-use socket. <br>'''Note:''' This option is [[#close|not valid]] as of <var class="product">Sirius Mods</var> version 6.6. </td></tr> | This applies to any in-use socket. <br>'''Note:''' This option is [[#close|not valid]] as of <var class="product">Sirius Mods</var> version 6.6. </td></tr> | ||
<tr><th>NOCLOSE</th> | <tr><th><var>NOCLOSE</var></th> | ||
<td>Close socket at <var>LOGOUT</var>, not at end of request; this is the default for <var>[[JANUS DEFINE#type|SRVSOCK]]</var> sockets. | <td>Close socket at <var>LOGOUT</var>, not at end of request; this is the default for <var>[[JANUS DEFINE#type|SRVSOCK]]</var> sockets. | ||
This applies to any in-use socket. <br>'''Note:''' This option is [[#close|not valid]] as of <var class="product">Sirius Mods</var> version 6.6. </td></tr> | This applies to any in-use socket. <br>'''Note:''' This option is [[#close|not valid]] as of <var class="product">Sirius Mods</var> version 6.6. </td></tr> | ||
<tr><th>LINEND</th> | <tr><th><var>LINEND</var></th> | ||
<td>This parameter must have an accompanying value (<var>NONE</var> or <var class="term">hexchars</var>), specified as the <var class="term">value</var> argument of the <var>Set</var> method. | <td>This parameter must have an accompanying value (<var>NONE</var> or <var class="term">hexchars</var>), specified as the <var class="term">value</var> argument of the <var>Set</var> method. | ||
<ul> | <ul> | ||
Line 52: | Line 52: | ||
</ul> | </ul> | ||
The <var>LINEND</var> default is taken from the socket's port definition. This requires that the socket be <var>OPEN</var>. </td></tr> | The <var>LINEND</var> default is taken from the socket's port definition. This requires that the socket be <var>OPEN</var>. </td></tr> | ||
<tr><th>ONRESET</th> | <tr><th><var>ONRESET</var></th> | ||
<td>This setting, which applies to any in-use socket, must be accompanied by one of the following values, specified as the <var class="term">value</var> argument of the <var>Set</var> method. | <td>This setting, which applies to any in-use socket, must be accompanied by one of the following values, specified as the <var class="term">value</var> argument of the <var>Set</var> method. | ||
<table> | <table> | ||
<tr><th>CANCEL</th> | <tr><th><var>CANCEL</var></th> | ||
<td><var>Socket</var> reset conditions are handled by cancelling the <var class="product">User Language</var> request.</td></tr> | <td><var>Socket</var> reset conditions are handled by cancelling the <var class="product">User Language</var> request.</td></tr> | ||
<tr><th>CANCELC</th> | <tr><th><var>CANCELC</var></th> | ||
<td><var>Socket</var> reset conditions are handled depending on whether the given operation can complete. Operations that cannot complete are handled by cancelling the <var class="product">User Language</var> request. | <td><var>Socket</var> reset conditions are handled depending on whether the given operation can complete. Operations that cannot complete are handled by cancelling the <var class="product">User Language</var> request. | ||
If the operation can complete, the request continues as usual to the next statement, and an error indicator is returned by the method that encountered the condition. The last error indicator can also be retrieved using the <var>[[ErrInfo (Socket function)]]</var>.</td></tr> | If the operation can complete, the request continues as usual to the next statement, and an error indicator is returned by the method that encountered the condition. The last error indicator can also be retrieved using the <var>[[ErrInfo (Socket function)]]</var>.</td></tr> | ||
<tr><th>CONTINUE</th> | <tr><th><var>CONTINUE</var></th> | ||
<td>If a socket reset condition is encountered, the request continues as usual to the next statement, and an error indicator is returned by the method that encountered the condition. The last error indication can also be retrieved using the <var>ErrInfo</var> method. </td></tr> | <td>If a socket reset condition is encountered, the request continues as usual to the next statement, and an error indicator is returned by the method that encountered the condition. The last error indication can also be retrieved using the <var>ErrInfo</var> method. </td></tr> | ||
<tr><th>LABEL</th> | <tr><th><var>LABEL</var></th> | ||
<td>All socket reset conditions are handled by the label established by the most recent <var>[[OnReset (Socket function)|OnReset]]</var> method call. If there is no <var>ONRESET</var> label, the request is cancelled. </td></tr> | <td>All socket reset conditions are handled by the label established by the most recent <var>[[OnReset (Socket function)|OnReset]]</var> method call. If there is no <var>ONRESET</var> label, the request is cancelled. </td></tr> | ||
<tr><th>LABELC</th> | <tr><th><var>LABELC</var></th> | ||
<td>How the socket reset conditions are handled depends on whether the given operation can complete. Operations that cannot complete are handled by the label established by the most recent <var>OnReset</var> method call. If there is no <var>ONRESET</var> label, the request is cancelled. | <td>How the socket reset conditions are handled depends on whether the given operation can complete. Operations that cannot complete are handled by the label established by the most recent <var>OnReset</var> method call. If there is no <var>ONRESET</var> label, the request is cancelled. | ||
<p> | <p> | ||
Line 72: | Line 72: | ||
The default is <var>LABEL</var>. | The default is <var>LABEL</var>. | ||
See [[Janus Sockets User Language coding considerations#Handling connection errors and RESET sockets| "Handling connection errors and RESET sockets"]]. </td></tr> | See [[Janus Sockets User Language coding considerations#Handling connection errors and RESET sockets| "Handling connection errors and RESET sockets"]]. </td></tr> | ||
<tr><th>PRSTOK</th> | <tr><th><var>PRSTOK</var></th> | ||
<td>This parameter must have a value (<code>NONE</code> or <code>[AMBIG|]''hexchars''[|''hexchars'']...</code>), specified as the <var class="term">value</var> argument of the <var>Set</var> method: | <td>This parameter must have a value (<code>NONE</code> or <code>[AMBIG|]''hexchars''[|''hexchars'']...</code>), specified as the <var class="term">value</var> argument of the <var>Set</var> method: | ||
<ul> | <ul> | ||
Line 79: | Line 79: | ||
</ul> | </ul> | ||
The default is taken from the socket's port definition (see <var>[[PRSTOK]]</var>). This requires that the socket be <var>OPEN</var>. </td></tr> | The default is taken from the socket's port definition (see <var>[[PRSTOK]]</var>). This requires that the socket be <var>OPEN</var>. </td></tr> | ||
<tr><th>RECVLIM </th> | <tr><th><var>RECVLIM </var></th> | ||
<td>A number ranging from 0 to 2,147,483,647, specifying the limit on total bytes of data plus "parse tokens" scanned by subsequent receive operations. The default is 0, indicating no limit. | <td>A number ranging from 0 to 2,147,483,647, specifying the limit on total bytes of data plus "parse tokens" scanned by subsequent receive operations. The default is 0, indicating no limit. | ||
<var>RECVLIM</var> is discussed in [[$Sock_Recv#Lengths: maximum, minimum, truncation, RECVLIM|"Lengths: maximum, minimum, truncation, RECVLIM"]] and [[$Sock_Recvprs#Lengths: maximum, truncation, RECVLIM|"Lengths: maximum, truncation, RECVLIM"]]. | <var>RECVLIM</var> is discussed in [[$Sock_Recv#Lengths: maximum, minimum, truncation, RECVLIM|"Lengths: maximum, minimum, truncation, RECVLIM"]] and [[$Sock_Recvprs#Lengths: maximum, truncation, RECVLIM|"Lengths: maximum, truncation, RECVLIM"]]. | ||
This requires that the socket be <var>OPEN</var>. </td></tr> <tr><th>TIMEOUT</th> <td>Number indicating the port <var>[[TIMEOUT]]</var> time, in seconds. | This requires that the socket be <var>OPEN</var>. </td></tr> <tr><th><var>TIMEOUT</var></th> <td>Number indicating the port <var>[[TIMEOUT]]</var> time, in seconds. | ||
The default is taken from the socket's port definition. This requires that the socket be <var>OPEN</var>. </td></tr> <tr><th>XTAB</th> | The default is taken from the socket's port definition. This requires that the socket be <var>OPEN</var>. </td></tr> <tr><th><var>XTAB</var></th> | ||
<td>The EBCDIC-to-ASCII, ASCII-to-EBCDIC, and character entity translation tables to be used for the socket. The <var>XTAB</var> table to use is specified as the <var class="term">value</var> argument of the <var>Set</var> method. | <td>The EBCDIC-to-ASCII, ASCII-to-EBCDIC, and character entity translation tables to be used for the socket. The <var>XTAB</var> table to use is specified as the <var class="term">value</var> argument of the <var>Set</var> method. | ||
The default is taken from the socket's port definition (see <var>[[XTAB]]</var>). This requires that the socket be <var>OPEN</var>. </td></tr> </table> | The default is taken from the socket's port definition (see <var>[[XTAB]]</var>). This requires that the socket be <var>OPEN</var>. </td></tr> </table> |
Revision as of 17:39, 9 November 2011
<section begin=dpl_desc/><section end=dpl_desc/>
Set is a member of the Socket class.
This method changes the value of a parameter or setting on the indicated socket. The Set function, which may be invoked with a Call statement, has an effect similar to $Sock_Set.
Syntax
[%old =] %socko:Set(keyword, [value])
Syntax terms
%old | If specified, string that is to contain either:
| ||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
%socko | A variable or an expression that is a reference to a Socket object. | ||||||||||||||||||||||||||||||||||||
keyword | Any of the keywords from the parameter and settings list provided below. Some of these keywords require that the socket be OPEN for the setting to take effect; for these, if the socket is not OPEN, the operation is ignored. | ||||||||||||||||||||||||||||||||||||
value | The value the parameter or setting should be changed to. If the keyword is self-defining, this argument may be omitted or left null. Valid values are explained in the keyword list provided below.
|
Usage notes
- The Set method differs from $Sock_Set as follows:
- $Sock_Set may optionally be applied to "all relevant single sockets," but the Set method applies only to a single Socket object.
- As of version 6.6, the CLOSE and NOCLOSE keywords are not valid options for the Set method. Since Socket objects may persist (Global or Session) beyond a request, and since they are also subject to discard, it is whether or not the object has been discarded that determines whether the socket gets closed at the end of the request.
- If the Set method is invoked for a socket
that is RESET, the results depend on several factors:
- If the keyword argument is
ONRESET
, the operation is performed normally, and there is no indication of the fact that the socket is RESET. - Otherwise, if the keyword argument
is one which does not require an
OPEN socket, and
ONRESET CONTINUE
,CANCELC
, orLABELC
is in effect for the socket, the stringRESET
is returned, and the last error information is set. - Otherwise, if
ONRESET CONTINUE
is in effect for the socket, the stringRESET
is returned, and the last error information is set. - Otherwise, the request is canceled or the ONRESET label is jumped to, as explained in "Handling connection errors and RESET sockets".
- If the keyword argument is
- The keyword argument can be omitted for keywords that are self-defining:
%t = %sock:Set('BINARY')
This sets the socket to binary mode, in which bytes sent over the connection are not translated in any way. "Self-defining" keywords can also be accompanied by a value argument, which allows you to restore a previous value:
FOO: Subroutine %t = %sock:Set('BINARY') ... %t = %sock:Set('BINARY', %t) Return
The value argument is required for keywords that need a value:
%t = %sock:Set('LINEND', 'NONE')
This disables the sending of the line-end string.
- You can use the Info) method to obtain the current value of the setting of any of the keywords that can be specified as the keyword argument of the Set method.