TranOut (Socket function): Difference between revisions
Jump to navigation
Jump to search
(Created page with " <span class="pageSubtitle"><section begin=dpl_desc/><section end=dpl_desc/></span> TranOut function <p> <var>TranOut</var> is a member of the <var>[[...") |
m (→Examples) |
||
(5 intermediate revisions by 3 users not shown) | |||
Line 1: | Line 1: | ||
{{Template:Socket:TranOut subtitle}} | |||
This method translates an individual string, | This method translates an individual string, | ||
Line 13: | Line 8: | ||
==Syntax== | ==Syntax== | ||
{{Template:Socket:TranOut syntax}} | |||
===Syntax terms=== | |||
<table class="syntaxTable"> | <table class="syntaxTable"> | ||
<tr><th>% | <tr><th>%string | ||
</th><td>String that is to contain the translation of the input string into the remote character set. | </th><td>String that is to contain the translation of the input string into the remote character set. | ||
</td></tr> | </td></tr> | ||
<tr><th> | <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 42: | Line 38: | ||
==Examples== | ==Examples== | ||
< | <ol> | ||
<li>In the following example, database fields only are translated and sent to the remote. | <li>In the following example, database fields only are translated and sent to the remote. | ||
<p class="code">%sock is Object <var>Socket</var> | <p class="code">%sock is Object <var>Socket</var> | ||
Line 63: | Line 59: | ||
... | ... | ||
</p> | </p> | ||
</ | </ol> | ||
{{Template:Socket:TranOut footer}} |
Latest revision as of 19:13, 11 June 2012
Translate an internal-encoded string to remote (Socket class)
This method translates an individual string,
from the local internal character set (EBCDIC),
to the character set of the remote.
Designed for cases where translation needs to be selective, the TranOut function
has an effect similar to its equivalent $function, $Sock_Tran_Out.
Syntax
%string = socket:TranOut( string)
Syntax terms
%string | String that is to contain the translation of the input string into the remote 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 remote character set. |
Usage notes
- The translate table TranOut uses is the input table defined by the XTAB parameter of the socket.
- The TranOut 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 TranOut method continues with the next statement if
ONRESET CONTINUE
,CANCELC
, orLABELC
is in effect for the socket. It always returns the translated string; it never returns an error indicator. - Typically, TranOut is used to translate from EBCDIC strings that are sent to non-mainframe sources that use other character mapping schemes, like ASCII or non-English character sets.
Examples
- In the following example, database fields only are translated and sent to the remote.
%sock is Object Socket %sock = New %old = %sock:Set('BINARY') For Each Record %xlate = %sock:TranOut(DATA_FIELD) %rc = %sock:SendWithLineEnd(%xlate) End For %old = %sock:Set('BINARY', %old)
- TranOut can be useful if you want to use a "normal" character as either the LINEND or
PRSTOK value (see Set) for communication with the remote.
In the following example, LINEND is set to a pair of plus sign (+) characters:
Begin %sock is Object Socket %sock = New('SOCKEM') %s = %sock:TranOut('++') %t = %sock:Set('LINEND', %s) ...