TranIn (Socket function): Difference between revisions

From m204wiki
Jump to navigation Jump to search
m (1 revision)
 
(4 intermediate revisions by 2 users not shown)
Line 1: Line 1:
 
{{Template:Socket:TranIn subtitle}}
<span class="pageSubtitle"><section begin=dpl_desc/><section end=dpl_desc/></span>
[[Category:Socket methods|TranIn function]]
<p>
<var>TranIn</var> is a member of the <var>[[Socket class|Socket]]</var> class.
</p>


This method translates an individual string,
This method translates an individual string,
Line 13: Line 8:


==Syntax==
==Syntax==
<p class="syntax">%str = %socko:TranIn(string)
{{Template:Socket:TranIn syntax}}
</p>
 
===Syntax terms===
<table class="syntaxTable">
<table class="syntaxTable">
<tr><th>%str
<tr><th>%string
</th><td>String that is to contain the translation of the input string into the local character set.
</th><td>String that is to contain the translation of the input string into the local character set.
</td></tr>
</td></tr>
<tr><th>%socko
<tr><th>socket
</th><td>A variable or an expression that is a reference to a <var>Socket</var> object.
</th><td>A variable or an expression that is a reference to a <var>Socket</var> object.
</td></tr>
</td></tr>
Line 41: Line 37:
</ul>
</ul>


==Example==
==Examples==
 
In the following example, parsed but not translated lines are received into the
In the following example, parsed but not translated lines are received into the
<code>%s</code> variable, then translated, and printed in EBCDIC.
<code>%s</code> variable, then translated, and printed in EBCDIC.
Line 58: Line 53:
%old = %sock:Set('BINARY', %old)
%old = %sock:Set('BINARY', %old)
</p>
</p>
{{Template:Socket:TranIn footer}}

Latest revision as of 19:28, 11 June 2012

Translate a remote=encoded string to internal (Socket class)


This method translates an individual string, from the character set of the remote to the local internal character set (EBCDIC). Designed for cases where translation needs to be selective, the TranIn function has an effect similar to its equivalent $function, $Sock_Tran_In.

Syntax

%string = socket:TranIn( string)

Syntax terms

%string String that is to contain the translation of the input string into the local character set.
socket A variable or an expression that is a reference to a Socket object.
string The string that is to be translated to the socket's local character set.

Usage notes

  • The translate table TranIn uses is the input table defined by the XTAB parameter of the socket.
  • The TranIn method can cause a jump to the ONRESET label or request cancellation, and it can set the last error information, but it does not return any error indication.
  • The TranIn method 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, TranIn 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.

Examples

In the following example, parsed but not translated lines are received into the %s variable, then translated, and printed in EBCDIC.

%sock is Object Socket %sock = New %old = %sock:Set('BINARY') Repeat %len = %sock:ReceiveAndParse(%s) If %len le 0 Then Loop End End If %xlate = %sock:TranIn(%s) Print %xlate End Repeat %old = %sock:Set('BINARY', %old)