Inflate (String function): Difference between revisions

From m204wiki
Jump to navigation Jump to search
ELowell (talk | contribs)
No edit summary
Tom (talk | contribs)
No edit summary
Line 1: Line 1:
{{Template:String:Inflate subtitle}}
{{DISPLAYTITLE:$Inflate}}
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.
<span class="pageSubtitle">Decompress a longstring with inflate</span>
 
<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==
{{Template:String:Inflate syntax}}
<p class="syntax"><span class="term">%lstrc</span> = <span class="literal">$Inflate</span>(<span class="term">%lstr</span>, [<span class="term">option</span>])
</p>
 
<p>%lstrc is the returned longstring.</p>
 
===Syntax terms===
===Syntax terms===
<table class="syntaxTable">
<table class="syntaxTable">
<tr><th>%outString</th>
<tr><th>%lstr</th>
<td>The resulting decompressed string.</td></tr>
<td>The longstring to be decompressed; it is required.</td></tr>
 
<tr><th>option</th>
<td>[Introduced in Model 204 version 8.0]
<p>An optional string that controls the decompression method. The only valid option is:</p>
 
<table class="syntaxTable">
<tr><th><var>SOFTWARE</var></th>
<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>
</table>


<tr><th>string</th>
<p>If the option is omitted, hardware decompression is used automatically when DFLTCC is available, falling back to software decompression on older processors.</p>
<td>The compressed string to be decompressed.</td></tr>
</td></tr>
</table>
</table>


==Exceptions==
<var>Inflate</var> can throw the following exception:
<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>The <var>[[NCMPBUF parameter|NCMPBUF]]</var> parameter must be set to a
<li> If the input string is not a valid deflated string, the request is cancelled.
non-zero value during <var class="product">Model 204</var>initialization to allow
<li> If compression is not enabled for the current run, the request is cancelled.
use of the <var>Inflate</var> function; otherise, invoking <var>Inflate</var>
<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.
causes request cancellation.
<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, <code>%out</code> is set to the original string (<code>How much</code>..<code>chuck</code>):
In the following example, %LSTR is set to the uncompressed version of the given string:
<p class="code">%temp = 'How much wood could a woodchuck chuck':deflate(fixedCode=true)
<p class="code"> %LSTRC = $Deflate('How much wood could a woodchuck chuck', 'FIXED')
%out = %temp:Inflate
%LSTR = $Inflate(%LSTRC)
</p>
</p>
==See also==
 
<ul>
The following example forces software decompression:
<li><var>[[Deflate (String function)|Deflate]]</var> is used to compress a string using the "deflate" algorithm.
<p class="code"> %LSTR = $Inflate(%LSTRC, 'SOFTWARE')
<li>Other related methods:
</p>
<ul>
 
<li><var>[[Gunzip (String function)|Gunzip]]</var>
==Products authorizing $Inflate==
<li><var>[[GunzipDatetimeNS (String function)|GunzipDatetimeNS]]</var>
==Products authorizing {{PAGENAMEE}}==
<li><var>[[GunzipFilename (String function)|GunzipFilename]]</var>
<ul class="smallAndTightList">
<li><var>[[Gzip (String function)|Gzip]]</var>
<li>[[List of $functions|Sirius functions]]</li>
<li><var>[[Zip (String function)|Zip]]</var>
<li>[[Fast/Unload User Language Interface]]</li>
</ul>
<li>[[Media:JoclrNew.pdf|Janus Open Client]]</li>
<li>[[Media:JosrvrNew.pdf|Janus Open Server]]</li>
<li>[[Janus Sockets]]</li>
<li>[[Janus Web Server]]</li>
<li>Japanese functions</li>
<li>[[Media:SirfieldNew.pdf|Sir2000 Field Migration Facility]]</li>
</ul>
</ul>


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

Revision as of 13:16, 19 May 2026

Decompress a longstring with inflate

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

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

%lstrc = $Inflate(%lstr, [option])

%lstrc is the returned longstring.

Syntax terms

%lstr The longstring to be decompressed; it is required.
option [Introduced in Model 204 version 8.0]

An optional string that controls the decompression method. The only valid option is:

SOFTWARE 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.

If the option is omitted, hardware decompression is used automatically when DFLTCC is available, falling back to software decompression on older processors.

Usage notes

  • If the input string is not a valid deflated string, the request is cancelled.
  • If compression is not enabled for the current run, the request is cancelled.
  • 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.
  • 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 .

Examples

In the following example, %LSTR is set to the uncompressed version of the given string:

%LSTRC = $Deflate('How much wood could a woodchuck chuck', 'FIXED') %LSTR = $Inflate(%LSTRC)

The following example forces software decompression:

%LSTR = $Inflate(%LSTRC, 'SOFTWARE')

Products authorizing $Inflate

Products authorizing Inflate_(String_function)