Translate string to remote's character set
Note: Many $functions have been deprecated in favor of Object Oriented methods. The OO equivalent for $Sock_Tran_Out is the TranOut method.
$Sock_Tran_Out translates a string, from the local internal character set ("EBCDIC"), to the character set of the remote. 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.
%string = $Sock_Tran_Out(string, sockNum)
|%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_Out.|
- $Sock_Tran_Out 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, $Sock_Tran_Out is used to translate into ASCII strings from mainframe sources.
- In the following example, database fields are translated and sent to the remote:
%old = $Sock_Set(%socket, 'BINARY') For Each record %xlate = $Sock_Tran_Out(DATA_FIELD, %socket) %rc = $Sock_SendLn(%socket, %xlate) End For %old = $Sock_Set(%socket, 'BINARY', %old)
- $Sock_Tran_Out can be useful if you wish to use a "normal" character
in either the LINEND or
PRSTOK parameter, since you must specify it in the character set used to
communicate with the remote.
For example, the following sets LINEND to a pair of plus sign (+) characters:
Begin %socket = $Sock_Conn('SOCKEM') %s = $Sock_Tran_Out('++', %socket) %t = %SOCK_SET(%socket, 'LINEND', %s) ...
The translate table used is the output table defined by the XTAB parameter of the socket.