$Sock Tran In: Difference between revisions

From m204wiki
Jump to navigation Jump to search
m (1 revision)
(Automatically generated page update)
Line 1: Line 1:
{{DISPLAYTITLE:$Sock_Tran_In}}
{{DISPLAYTITLE:$Sock_Tran_In}}
<span class="pageSubtitle">Translate string from remote's character set</span>
<span class="pageSubtitle">Translate string from remote's character set</span>
<p class="warning">Most Sirius $functions have been deprecated in favor of Object Oriented
<p class="warn"><b>Note: </b>Most Sirius $functions have been deprecated in favor of Object Oriented
methods. There is currently no direct OO equivalent for this $function.</p>
methods. There is currently no direct OO equivalent for this $function.</p>
[[Category: Janus Sockets $functions]]
[[Category: Janus Sockets $functions]]

Revision as of 18:59, 19 July 2013

Translate string from remote's character set

Note: Most Sirius $functions have been deprecated in favor of Object Oriented methods. There is currently no direct OO equivalent for this $function.

$Sock_Tran_In translates a string, from the character set of the remote, to the local internal character set (EBCDIC). It is a bit different from other $Sock functions:

  • The socket number is the second argument, not the first.
  • Although it references a socket number, and it can cause a jump to the ONRESET label or request cancellation and can set the last error information, it does not return any error indication.

Syntax

%string = $Sock_Tran_In(string, sockNum)

Syntax terms

%string A string that is to contain the translation of the input string into the local character set.
string The string to be translated.
sockNum The socket number, which has associated with it the translation table used by $Sock_Tran_In.

Usage notes

  • $Sock_Tran_In continues with the next statement if ONRESET CONTINUE, CANCELC, or LABELC is in effect for the socket. It always returns the translated string; it never returns an error indicator.
  • Typically the $Sock_Tran_In function is used to translate into EBCDIC strings that are received from non-mainframe sources that use other character mapping schemes, like ASCII or non-English character sets.

Example

In the following example, parsed lines are received into the %s variable, then translated, and printed in EBCDIC. The translate table used is the input table defined by the XTAB parameter of the socket.

%old = $Sock_Set(%socket, 'BINARY') Repeat %len = $Sock_RecvPrs(%socket, %s) If %len Le 0 Then Loop End End If %xlate = $Sock_Tran_In(%s, %socket) Print %xlate End Repeat %old = $Sock_Set(%socket, 'BINARY', %old)