$Lstr X2C: Difference between revisions

From m204wiki
Jump to navigation Jump to search
m (1 revision)
(Automatically generated page update)
 
(21 intermediate revisions by 5 users not shown)
Line 2: Line 2:
<span class="pageSubtitle">Convert from hexadecimal to byte string</span>
<span class="pageSubtitle">Convert from hexadecimal to byte string</span>


<p class="warning">Most Sirius $functions have been deprecated in favor of Object Oriented methods. The OO equivalent for the $Lstr_X2C function is the [[HexToString (String function)]].</p>
<p class="warn"><b>Note: </b>Many $functions have been deprecated in favor of Object Oriented methods. The OO equivalent for the $Lstr_X2C function is the <var>[[HexToString (String function)|HexToString]]</var> function.</p>


This function converts from a hexadecimal encoded string to the decoded byte string. It is identical to $X2C (see the <i>[http://www.rocketsoftware.com/m204/products/index/documentation/v7r4/M204-User-Language/view Rocket Model 204 User Language Manual]</i>), except it is longstring capable.  
This function converts from a hexadecimal encoded string to the decoded byte string. It is identical to <var>[[$X2C]]</var>, except it is longstring capable.  


The $Lstr_X2C function accepts one argument and returns a string result whose hexadecimal encoding is that argument.  
The <var>$Lstr_X2C</var> function accepts one argument and returns a string result whose hexadecimal encoding is that argument.  


The first argument is a longstring which is a hexadecimal encoding.  
The first argument is a Longstring which is a hexadecimal encoding.  


The returned value is the hexadecimal decoding of the argument string. If the argument is not a valid hexadecimal encoding, the null string is returned.
The returned value is the hexadecimal decoding of the argument string. If the argument is not a valid hexadecimal encoding, the null string is returned.


==Syntax==
==Syntax==
<p class="syntax"><section begin="syntax" />%DECODED = $Lstr_X2C(string)
<p class="syntax"><span class="term">%decoded</span> = <span class="literal">$Lstr_X2C</span>(<span class="term">string</span>)
<section end="syntax" /></p>
</p>
 
<p>
<p>
</p>
<var class="term">%decoded</var> is set to the hexadecimal decoding of <var class="term">string</var>.</p>
<p>%DECODED is set to the hexadecimal decoding of '''string'''</p>
 
==usage notes==
<ul>
<li>You can check for an invalid hexadecimal encoding by checking for the null string return value from $Lstr_X2C. Of course, if it is possible that the argument is null, the null string is a valid returned value. If you need to check for errors, and the null string is a possible argument value, you can use an approach such as the following:


For example, the following code
<p class="code">%STR = $Lstr_X2C(%IN)
<p class="code"> PRINT $Lstr_X2C('D985844099A494')
IF %STR EQ &apos;&apos;
IF %IN NE &apos;&apos; THEN
error code ...
END IF
END IF
</p>
</p>


would print <tt>Red rum</tt>, which is the character representation of the EBCDIC characters represented in hexadecimal as "D985844099A494".
<li><var>[[$Lstr_C2X]]</var> is the inverse of <var>$Lstr_X2C</var>.  
</ul>


You can check for an invalid hexadecimal encoding by checking for the null string return value from $Lstr_X2C. Of course, if it is possible that the argument is null, the null string is a valid returned value. If you need to check for errors, and the null string is a possible argument value, you can use an approach such as the following:
==Example==
The following code would print <code>Red rum</code>, which is the character representation of the EBCDIC characters represented in hexadecimal as "D985844099A494":


<p class="code"> %STR = $Lstr_X2C(%IN)
<p class="code">PRINT $Lstr_X2C('D985844099A494')
IF %STR EQ ''
IF %IN NE '' THEN
error code ...
END IF
END IF
</p>
</p>


[[$Lstr_C2X]] is the inverse of $Lstr_X2C.
==Products authorizing {{PAGENAMEE}}==
 
<ul class="smallAndTightList">
This $function is new in Version 6.8 of the <var class="product">[[Sirius Mods]]</var>.
<li>[[List of $functions|Sirius functions]]</li>
 
<p>
<h2>Products authorizing {{PAGENAMEE}}</h2><ul class="smallAndTightList">
<li>[[Sirius functions]]</li>
<li>[[Fast/Unload User Language Interface]]</li>
<li>[[Fast/Unload User Language Interface]]</li>
<li>[[Janus Open Client]]</li>
<li>[[Media:JoclrNew.pdf|Janus Open Client]]</li>
<li>[[Janus Open Server]]</li>
<li>[[Media:JosrvrNew.pdf|Janus Open Server]]</li>
<li>[[Janus Sockets]]</li>
<li>[[Janus Sockets]]</li>
<li>[[Janus Web Server]]</li>
<li>[[Janus Web Server]]</li>
<li>[[Japanese functions]]</li>
<li>Japanese functions</li>
<li>[[Sir2000 Field Migration Facility]]</li>
<li>[[Media:SirfieldNew.pdf|Sir2000 Field Migration Facility]]</li>
</ul>  
</ul>  
</p>
<p>2C
</p>


[[Category:$Functions|$Lstr_X2C]]
[[Category:$Functions|$Lstr_X2C]]

Latest revision as of 22:52, 20 September 2018

Convert from hexadecimal to byte string

Note: Many $functions have been deprecated in favor of Object Oriented methods. The OO equivalent for the $Lstr_X2C function is the HexToString function.

This function converts from a hexadecimal encoded string to the decoded byte string. It is identical to $X2C, except it is longstring capable.

The $Lstr_X2C function accepts one argument and returns a string result whose hexadecimal encoding is that argument.

The first argument is a Longstring which is a hexadecimal encoding.

The returned value is the hexadecimal decoding of the argument string. If the argument is not a valid hexadecimal encoding, the null string is returned.

Syntax

%decoded = $Lstr_X2C(string)

%decoded is set to the hexadecimal decoding of string.

usage notes

  • You can check for an invalid hexadecimal encoding by checking for the null string return value from $Lstr_X2C. Of course, if it is possible that the argument is null, the null string is a valid returned value. If you need to check for errors, and the null string is a possible argument value, you can use an approach such as the following:

    %STR = $Lstr_X2C(%IN) IF %STR EQ '' IF %IN NE '' THEN error code ... END IF END IF

  • $Lstr_C2X is the inverse of $Lstr_X2C.

Example

The following code would print Red rum, which is the character representation of the EBCDIC characters represented in hexadecimal as "D985844099A494":

PRINT $Lstr_X2C('D985844099A494')

Products authorizing $Lstr_X2C