$Sock_Tran_In

From m204wiki
Revision as of 02:53, 20 January 2012 by Admin (talk | contribs) (1 revision)
Jump to navigation Jump to search

Translate string from remote's character set

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)