$Web Put Text: Difference between revisions

From m204wiki
Jump to navigation Jump to search
m (1 revision)
mNo edit summary
Line 1: Line 1:
{{DISPLAYTITLE:$Web_Put_Text}}
{{DISPLAYTITLE:$Web_Put_Text}}
<span class="pageSubtitle"><section begin="desc" />Add text string to response buffer<section end="desc" /></span>
<span class="pageSubtitle"><section begin="desc" />Add text string to response buffer<section end="desc" /></span>


$Web_Put_Text sends a text string to the client buffer.
$Web_Put_Text sends a text string to the client buffer.
Line 9: Line 7:
<section end="syntax" /></p>
<section end="syntax" /></p>


$Web_Put_Text is a callable $function (see [[Calling_Sirius_Mods_$functions|Calling Sirius Mods $functions]]), and it takes a single required string argument and returns a status code.


$Web_Put_Text is a callable $function (see [[Calling_Sirius_Mods_$functions|Calling Sirius Mods $functions]]), and it takes a single required string argument and returns a status code.
<table class="syntaxTable">
<table class="syntaxTable">
<tr><th>string</th>
<tr><th>string</th>
<td>A text string that is translated from EBCDIC to ASCII and added to the client buffer. <blockquote>Under ''[[Sirius Mods]]'' Version 6.7 and later, $Web_Put_Text is longstring capable: it can send a longstring with a length greater than 255 bytes.:enote.
<td>A text string that is translated from EBCDIC to ASCII and added to the client buffer. Under ''[[Sirius Mods]]'' Version 6.7 and later, $Web_Put_Text is longstring capable: it can send a longstring with a length greater than 255 bytes.
</td></tr></table>
</td></tr>
</table>


<table class="syntaxTable">
<table class="syntaxTable">
Line 25: Line 24:
<tr><th>-4</th>
<tr><th>-4</th>
<td>Missing argument</td></tr>
<td>Missing argument</td></tr>
</table>
</table>
<p class="caption">$WEB_PUT_TEXT return codes</p>
<p class="caption">$WEB_PUT_TEXT return codes</p>


Sample code follows:


Sample code follows:
<p class="code"> %X = $Web_Type('text/HTML')
<p class="code"> %X = $Web_Type('text/HTML')
  %X = $Web_Put_Text( '<HTML>' )
  %X = $Web_Put_Text( '<HTML>' )
Line 38: Line 35:
  %X = $Web_Put_Text( 'Hello World' )
  %X = $Web_Put_Text( 'Hello World' )
  %X = $Web_Put_Text( '</h1>' )
  %X = $Web_Put_Text( '</h1>' )
%X = $Web_Put_Text( '</p>' )
  %X = $Web_Put_Text( '</HTML>' )
  %X = $Web_Put_Text( '</HTML>' )
  STOP
  STOP
</p>
</p>


The above example shows an entire HTML document being sent to the client, a line at a time. Note that you could also direct HTML to the client by sending a procedure that contains HTML (using [[$Web_ProcSend]]) or simply with PRINT statements (unless $Web_Off has been issued).


The above example shows an entire HTML document being sent to the client, a line at a time. Note that you could also direct HTML to the client by sending a procedure that contains HTML (using $Web_ProcSend) or simply with PRINT statements (unless $Web_Off has been issued).
The two primary uses for $Web_Put_Text are


The two primary uses for $Web_Put_Text are
<ol>
<ol>
 
<li>To send text to a browser when [[$Web_Off]] is set: it might be easier to do a $Web_Put_Text than a [[$Web_On]], PRINT, [[$Web_Off]] sequence.  
<li>To send text to a browser when $Web_Off is set: it might be easier to do a $Web_Put_Text than a $WEB_ON, PRINT, $Web_Off sequence.  
<li>To have text that is to be sent to a browser embedded in code that is also used in non-browser (for example, 3270 or BATCH2) mode. $Web_Put_Text acts as a no-op when executed on a non-web thread so can be used instead of an IF test (to determine if running on a web thread) followed by a PRINT statement.
<li>To have text that is to be sent to a browser embedded in code that is also used in non-browser (for example, 3270 or BATCH2) mode. $Web_Put_Text acts as a no-op when executed on a non-web thread so can be used instead of an IF test (to determine if running on a web thread) followed by a PRINT statement.
</ol>
</ol>


[[Category:Janus Web Server $functions|$Web_Put_Text]]
[[Category:Janus Web Server $functions|$Web_Put_Text]]

Revision as of 21:21, 22 February 2011

<section begin="desc" />Add text string to response buffer<section end="desc" />

$Web_Put_Text sends a text string to the client buffer.

Syntax

<section begin="syntax" /> %RC = $Web_Put_Text( string ) <section end="syntax" />

$Web_Put_Text is a callable $function (see Calling Sirius Mods $functions), and it takes a single required string argument and returns a status code.

string A text string that is translated from EBCDIC to ASCII and added to the client buffer. Under Sirius Mods Version 6.7 and later, $Web_Put_Text is longstring capable: it can send a longstring with a length greater than 255 bytes.
Code Meaning
0 String sent to the client buffer.
-1 Invalid call, not a Web thread
-4 Missing argument

$WEB_PUT_TEXT return codes

Sample code follows:

%X = $Web_Type('text/HTML') %X = $Web_Put_Text( '<HTML>' ) %X = $Web_Put_Text( '

' ) %X = $Web_Put_Text( '

' ) %X = $Web_Put_Text( 'Hello World' ) %X = $Web_Put_Text( '

' )

%X = $Web_Put_Text( '</HTML>' )
STOP

The above example shows an entire HTML document being sent to the client, a line at a time. Note that you could also direct HTML to the client by sending a procedure that contains HTML (using $Web_ProcSend) or simply with PRINT statements (unless $Web_Off has been issued).

The two primary uses for $Web_Put_Text are

  1. To send text to a browser when $Web_Off is set: it might be easier to do a $Web_Put_Text than a $Web_On, PRINT, $Web_Off sequence.
  2. To have text that is to be sent to a browser embedded in code that is also used in non-browser (for example, 3270 or BATCH2) mode. $Web_Put_Text acts as a no-op when executed on a non-web thread so can be used instead of an IF test (to determine if running on a web thread) followed by a PRINT statement.