Inflate (String function): Difference between revisions

From m204wiki
Jump to navigation Jump to search
Tom (talk | contribs)
No edit summary
Tom (talk | contribs)
No edit summary
 
Line 1: Line 1:
{{DISPLAYTITLE:$Inflate}}
{{Template:String:Inflate subtitle}}
<span class="pageSubtitle">Decompress a longstring with inflate</span>
This function takes a result from <var>[[Deflate (String function)|Deflate]]</var> (a compressed string) and decompresses it using the "inflate" algorithm. The inflate algorithm is described as part of the deflate specification in RFC 1951.
 
<p class="warn"><b>Note: </b>Many $functions have been deprecated in favor of Object Oriented methods. The OO equivalent for the $Inflate function is the <var>[[Inflate (String function)|Inflate]]</var> function.</p>
 
This function takes a deflated longstring input and decompresses it using the "inflate" algorithm. The inflate algorithm is described as part of the deflate specification in RFC 1951.
 
The $Inflate function accepts one or two arguments and returns a longstring result. The first argument is the longstring to be decompressed, and it is required.


==Syntax==
==Syntax==
<p class="syntax"><span class="term">%lstrc</span> = <span class="literal">$Inflate</span>(<span class="term">%lstr</span>, [<span class="term">option</span>])
{{Template:String:Inflate syntax}}
</p>
 
<p>%lstrc is the returned longstring.</p>


===Syntax terms===
===Syntax terms===
<table class="syntaxTable">
<table class="syntaxTable">
<tr><th>%lstr</th>
<tr><th>%outString</th>
<td>The longstring to be decompressed; it is required.</td></tr>
<td>The resulting decompressed string.</td></tr>


<tr><th>option</th>
<tr><th>string</th>
<td>The compressed string to be decompressed.</td></tr>
 
<tr><th><var>Software</var></th>
<td>[Introduced in Model 204 version 8.0]
<td>[Introduced in Model 204 version 8.0]
<p>An optional string that controls the decompression method. The only valid option is:</p>
<p><var>Software</var> is an optional, [[Notation conventions for methods#Named parameters|name required]], parameter that is a <var>[[Boolean_enumeration#Using_Boolean_enumerations|Boolean]]</var> value that specifies whether to force the use of software decompression instead of hardware decompression.</p>
 
<ul>
<table class="syntaxTable">
<li>When <code>software=true</code>, decompression is always performed in software, even if the DFLTCC hardware instruction is available on the processor. This can be useful for diagnostic purposes or when byte-for-byte reproducibility with pre-8.0 behavior is required.</li>
<tr><th><var>SOFTWARE</var></th>
<li>When <code>software=false</code> (the default), hardware decompression is used automatically when DFLTCC is available (IBM z15 and above), falling back to software decompression on older processors.</li>
<td>Forces the use of software decompression, bypassing the DFLTCC hardware instruction even when it is available on the processor (IBM z15 and above). This can be useful for diagnostic purposes or when byte-for-byte reproducibility with pre-8.0 behavior is required.</td></tr>
</ul>
The default value for this argument is <var>False</var>.
</td></tr>
</table>
</table>


<p>If the option is omitted, hardware decompression is used automatically when DFLTCC is available, falling back to software decompression on older processors.</p>
==Exceptions==
</td></tr>
<var>Inflate</var> can throw the following exception:
</table>
<dl>
<dt><var>[[InvalidDeflateData class|InvalidDeflateData]]</var>
<dd>This exception indicates that the method object <var class="term">string</var> does not contain a valid <var>[[Deflate (String function)|Deflate]]</var> string compression output.
</dl>


==Usage notes==
==Usage notes==
<ul>
<ul>
<li> If the input string is not a valid deflated string, the request is cancelled.
<li>The <var>[[NCMPBUF parameter|NCMPBUF]]</var> parameter must be set to a non-zero value during <var class="product">Model 204</var> initialization to allow use of the <var>Inflate</var> function; otherwise, invoking <var>Inflate</var> causes request cancellation.
<li> If compression is not enabled for the current run, the request is cancelled.
<li> The NCMPBUF parameter must be set by User 0 before the $Inflate function can be used. If $Inflate is called with NCMPBUF = 0, the request is cancelled.
<li> As with any compression scheme, it is possible that a particular string will become longer after compression. This would happen, for example, if a deflated string were passed to $Deflate .
</ul>
</ul>


==Examples==
==Examples==
In the following example, %LSTR is set to the uncompressed version of the given string:
In the following example, <code>%out</code> is set to the original string (<code>How much</code>..<code>chuck</code>):
<p class="code"> %LSTRC = $Deflate('How much wood could a woodchuck chuck', 'FIXED')
<p class="code">%temp = 'How much wood could a woodchuck chuck':deflate(fixedCode=true)
%LSTR = $Inflate(%LSTRC)
%out = %temp:Inflate
</p>
</p>


The following example forces software decompression:
The following example forces software decompression:
<p class="code"> %LSTR = $Inflate(%LSTRC, 'SOFTWARE')
<p class="code">%out = %temp:Inflate(software=true)
</p>
</p>


==Products authorizing $Inflate==
==See also==
==Products authorizing {{PAGENAMEE}}==
<ul>
<ul class="smallAndTightList">
<li><var>[[Deflate (String function)|Deflate]]</var> is used to compress a string using the "deflate" algorithm.
<li>[[List of $functions|Sirius functions]]</li>
<li>Other related methods:
<li>[[Fast/Unload User Language Interface]]</li>
<ul>
<li>[[Media:JoclrNew.pdf|Janus Open Client]]</li>
<li><var>[[Gunzip (String function)|Gunzip]]</var>
<li>[[Media:JosrvrNew.pdf|Janus Open Server]]</li>
<li><var>[[GunzipDatetimeNS (String function)|GunzipDatetimeNS]]</var>
<li>[[Janus Sockets]]</li>
<li><var>[[GunzipFilename (String function)|GunzipFilename]]</var>
<li>[[Janus Web Server]]</li>
<li><var>[[Gzip (String function)|Gzip]]</var>
<li>Japanese functions</li>
<li><var>[[Zip (String function)|Zip]]</var>
<li>[[Media:SirfieldNew.pdf|Sir2000 Field Migration Facility]]</li>
</ul>
</ul>
</ul>


 
{{Template:String:Inflate footer}}
[[Category:$Functions|$Inflate]]

Latest revision as of 13:18, 19 May 2026

Decompress a longstring with inflate (String class)

[Introduced in Sirius Mods 7.4]

This function takes a result from Deflate (a compressed string) and decompresses it using the "inflate" algorithm. The inflate algorithm is described as part of the deflate specification in RFC 1951.

Syntax

%outString = string:Inflate Throws InvalidDeflateData

Syntax terms

%outString The resulting decompressed string.
string The compressed string to be decompressed.
Software [Introduced in Model 204 version 8.0]

Software is an optional, name required, parameter that is a Boolean value that specifies whether to force the use of software decompression instead of hardware decompression.

  • When software=true, decompression is always performed in software, even if the DFLTCC hardware instruction is available on the processor. This can be useful for diagnostic purposes or when byte-for-byte reproducibility with pre-8.0 behavior is required.
  • When software=false (the default), hardware decompression is used automatically when DFLTCC is available (IBM z15 and above), falling back to software decompression on older processors.

The default value for this argument is False.

Exceptions

Inflate can throw the following exception:

InvalidDeflateData
This exception indicates that the method object string does not contain a valid Deflate string compression output.

Usage notes

  • The NCMPBUF parameter must be set to a non-zero value during Model 204 initialization to allow use of the Inflate function; otherwise, invoking Inflate causes request cancellation.

Examples

In the following example, %out is set to the original string (How much..chuck):

%temp = 'How much wood could a woodchuck chuck':deflate(fixedCode=true) %out = %temp:Inflate

The following example forces software decompression:

%out = %temp:Inflate(software=true)

See also