$Web Put Binary: Difference between revisions

From m204wiki
Jump to navigation Jump to search
mNo edit summary
(Automatically generated page update)
 
(16 intermediate revisions by 3 users not shown)
Line 1: Line 1:
<span class="pageSubtitle"><section begin="desc" />$Web_Put_Binary: Add binary string to response buffer<section end="desc" /></span>
<span class="pageSubtitle">$Web_Put_Binary: Add binary string to response buffer</span>


<var>$Web_Put_Binary</var> sends a binary string to the client buffer.  
<var>$Web_Put_Binary</var> sends a binary string to the client buffer.  
Line 5: Line 5:
<b>Note:</b> <var>$Web_Put_Bin</var> is a synonym for the <var>$Web_Put_Binary</var> function.  
<b>Note:</b> <var>$Web_Put_Bin</var> is a synonym for the <var>$Web_Put_Binary</var> function.  


==Syntax==
<var>$Web_Put_Bin</var> is a [[Calling Sirius Mods $functions|callable]] $function.
<p class="syntax"><section begin="syntax" /> %rc = $Web_Put_Binary( bin_string )
<section end="syntax" /></p>


$Web_Put_Bin is a callable $function (see [[Calling_Sirius_Mods_$functions|Calling Sirius Mods $functions]]).  
<var>$Web_Put_Bin</var> takes a single required string argument and returns a status code.


$Web_Put_Bin takes a single required string argument and returns a status code.
==Syntax==
<p class="syntax"><span class="term">%rc </span><span class="literal">= $Web_Put_Binary( </span><span class="term">bin_string </span><span class="literal">)</span>
</p>


<table class="syntaxTable">
<table class="syntaxTable">
<tr><th>%rc</th>
<td>A numeric variable to contain the returned status code.
<tr><th>bin_string</th>
<tr><th>bin_string</th>
<td>A "binary" string that is added to the client buffer without any translation. Since the client buffer is always sent to the browser without translation, the binary contents of ''bin_string'' will be received by the browser. Under ''[[Sirius Mods]]'' Version 6.7 and later, $Web_Put_Bin is longstring capable: it can send a longstring with a length greater than 255 bytes.
<td>A "binary" string that is added to the client buffer without any translation. Since the client buffer is always sent to the browser without translation, the binary contents of ''bin_string'' will be received by the browser. Under ''[[Sirius Mods]]'' Version 6.7 and later, <var>$Web_Put_Bin</var> is longstring capable: it can send a longstring with a length greater than 255 bytes.
</td></tr>
</td></tr>
</table>
</table>


<table class="syntaxTable">
These are the <var>$Web_Put_Bin</var> return codes:
 
<table>
<tr><th>Code</th>
<tr><th>Code</th>
<td>Meaning</td></tr>
<th>Meaning</th></tr>
<tr><th>0</th>
<tr><th>0</th>
<td>Binary string sent to the client buffer.</td></tr>
<td>Binary string sent to the client buffer</td></tr>
<tr><th>-1</th>
<tr><th>-1</th>
<td>Invalid call, not a Web thread</td></tr>
<td>Invalid call, not a Web thread</td></tr>
Line 29: Line 33:
<td>Missing argument</td></tr>
<td>Missing argument</td></tr>
</table>
</table>
<p class="caption">$Web_Put_Bin return codes</p>
 
This sample shows a binary image in <tt>.jpg</tt> format being sent from a %variable to the client buffer (the image would have to be pretty small, given the 255 byte limitation on %variables):


<p class="code"> %X = $Web_Type('binary/jpeg')
<p class="code"> %X = $Web_Type('binary/jpeg')
  %X = $Web_Put_Bin( %COMPANYX_LOGO )
  %X = $Web_Put_Bin( %companyx_logo )
  STOP
  Stop
</p>
</p>


This sample shows a binary image in .jpg format being sent from a %variable to the client buffer (the image would have to be pretty small, given the 255 byte limitation on %variables).
==See also==
 
binary data is to store it in a <var class="product">Model 204</var> procedure and send it to the client using
Note that another way to send binary data is to store it in a ''Model 204'' procedure and send it to the client using [[$Web_ProcSend]].
<ul>
<li><var>[[$Web_Proc_Send]]</var> can be used to send the contents of a <var class="product">Model 204</var> procedure, either as binary (that is, without translation) or translating from EBCDIC to ASCII.
<li><var>[[$Web_Put_Text]]</var> can be used to translated translate and send a string from EBCDIC to ASCII.
</ul>


[[Category:Janus Web Server $functions|$Web_Put_Bin, $Web_Put_Binary]]
[[Category:Janus Web Server $functions|$Web_Put_Bin, $Web_Put_Binary]]

Latest revision as of 18:18, 10 April 2013

$Web_Put_Binary: Add binary string to response buffer

$Web_Put_Binary sends a binary string to the client buffer.

Note: $Web_Put_Bin is a synonym for the $Web_Put_Binary function.

$Web_Put_Bin is a callable $function.

$Web_Put_Bin takes a single required string argument and returns a status code.

Syntax

%rc = $Web_Put_Binary( bin_string )

%rc A numeric variable to contain the returned status code.
bin_string A "binary" string that is added to the client buffer without any translation. Since the client buffer is always sent to the browser without translation, the binary contents of bin_string will be received by the browser. Under Sirius Mods Version 6.7 and later, $Web_Put_Bin is longstring capable: it can send a longstring with a length greater than 255 bytes.

These are the $Web_Put_Bin return codes:

Code Meaning
0 Binary string sent to the client buffer
-1 Invalid call, not a Web thread
-4 Missing argument

This sample shows a binary image in .jpg format being sent from a %variable to the client buffer (the image would have to be pretty small, given the 255 byte limitation on %variables):

%X = $Web_Type('binary/jpeg') %X = $Web_Put_Bin( %companyx_logo ) Stop

See also

binary data is to store it in a Model 204 procedure and send it to the client using

  • $Web_Proc_Send can be used to send the contents of a Model 204 procedure, either as binary (that is, without translation) or translating from EBCDIC to ASCII.
  • $Web_Put_Text can be used to translated translate and send a string from EBCDIC to ASCII.