$Web Proc Send or $Web ProcSend: Difference between revisions
m (1 revision) |
mNo edit summary |
||
(24 intermediate revisions by 2 users not shown) | |||
Line 1: | Line 1: | ||
{{DISPLAYTITLE:$Web_Proc_Send or $Web_ProcSend}} | {{DISPLAYTITLE:$Web_Proc_Send or $Web_ProcSend}} | ||
<span class="pageSubtitle" | <span class="pageSubtitle">Add contents of procedure to response</span> | ||
<var>$Web_Proc_Send</var> adds the contents of a procedure to the client buffer. | <var>$Web_Proc_Send</var> adds the contents of a procedure to the client buffer. | ||
<b>Note:</b> <var>$Web_ProcSend</var> is a synonym for <var>$Web_Proc_Send</var>. | <b>Note:</b> <var>$Web_ProcSend</var> is a synonym for <var>$Web_Proc_Send</var>. | ||
<var>$Web_Proc_Send</var> is a [[Calling Sirius Mods $functions|callable]] $function. | |||
==Syntax== | ==Syntax== | ||
<p class="syntax">< | <p class="syntax"><span class="term">%rc</span> = $Web_Proc[_]Send( <span class="term">filename, procname, p_flag</span> ) | ||
< | </p> | ||
<var> | ===SYntax terms=== | ||
<table class="syntaxTable"> | |||
<tr><th>filename</th> | |||
<td>The name of the <var class="product">Model 204</var> file or group containing the procedure to be sent. This parameter is optional. If it is not specified, the default file or group is used. | |||
The parameter may be specified in either of these ways: | |||
<ul> | <ul> | ||
<li>As a name only | <li>As a name only | ||
<li>Prefixed with "FILE" or GROUP. | <li>Prefixed with "FILE" or "GROUP" | ||
<p> | |||
In this case, "FILE JANWEB" will look for the specified procedure in the file named JANWEB, "GROUP JANWEB" will look for the procedure in the group named JANWEB, and a bare "JANWEB" will look in a group first if it is open, then in a file. </p> | |||
</ul> | </ul> | ||
< | <p> | ||
The file privileges for this procedure file must be at least X'02' (copy or display internal procedures).</p></td></tr> | |||
<tr><th>procname</th> | <tr><th>procname</th> | ||
<td>The name of the <var class="product">Model 204</var> procedure to be sent to the client. This parameter is required.</td></tr> | <td>The name of the <var class="product">Model 204</var> procedure to be sent to the client. This parameter is required.</td></tr> | ||
<tr><th>p_flag</th> | <tr><th>p_flag</th> | ||
<td>Processing indicators for how the client should handle the procedure. This parameter is optional. It consists of a combination of blank-separated options. Valid options are: | <td>Processing indicators for how the client should handle the procedure. This parameter is optional. It consists of a combination of blank-separated options. Valid options are: | ||
<table | |||
<tr><th>BINARY</th> | <table> | ||
<td>Procedure must be in either the binary or the base64 encoded format used by <var class="product"> | <tr><th><var>BINARY</var></th> | ||
<tr><th>CR</th> | <td>Procedure must be in either the binary or the base64 encoded format used by <var class="product">Janus Web Server</var>. For further description of these encodings, see <var class="product">Janus Web Server</var> will perform no EBCDIC to ASCII translation on the contents.</td></tr> | ||
<tr><th><var>CR</var></th> | |||
<td>Indicates that lines of text data should be separated by the ASCII carriage return (X'0D') character. This parameter has no effect if the BINARY option is used, and it is mutually exclusive with the LF and CRLF parameters.</td></tr> | <td>Indicates that lines of text data should be separated by the ASCII carriage return (X'0D') character. This parameter has no effect if the BINARY option is used, and it is mutually exclusive with the LF and CRLF parameters.</td></tr> | ||
<tr><th>CRLF</th> | |||
<tr><th><var>CRLF</var></th> | |||
<td>Indicates that lines of text data should be separated by the ASCII carriage return and line feed (X'0D0A') characters. This parameter has no effect if the BINARY option is used, and it is mutually exclusive with the CR and LF parameters.</td></tr> | <td>Indicates that lines of text data should be separated by the ASCII carriage return and line feed (X'0D0A') characters. This parameter has no effect if the BINARY option is used, and it is mutually exclusive with the CR and LF parameters.</td></tr> | ||
<tr><th>LF</th> | |||
<tr><th><var>LF</var></th> | |||
<td>Indicates that lines of text data should be separated by the ASCII line feed (X'0D') character. This parameter has no effect if the BINARY option is used, and it is mutually exclusive with the CR and CRLF parameters.</td></tr> | <td>Indicates that lines of text data should be separated by the ASCII line feed (X'0D') character. This parameter has no effect if the BINARY option is used, and it is mutually exclusive with the CR and CRLF parameters.</td></tr> | ||
<tr><th>MORE</th> | |||
<tr><th><var>MORE</var></th> | |||
<td>More data will be sent to the browser after the procedure.</td></tr> | <td>More data will be sent to the browser after the procedure.</td></tr> | ||
<tr><th>SSI</th> | |||
<tr><th><var>SSI</var></th> | |||
<td>The procedure content sent to the web buffer should be scanned for Server Side Include tags to see if the server needs to substitute content into the HTML. "SSI" can be specified for either the CMD or SEND form of the JANUS WEB ON command. See for a discussion of how Server Side Include tags can be used.</td></tr> | <td>The procedure content sent to the web buffer should be scanned for Server Side Include tags to see if the server needs to substitute content into the HTML. "SSI" can be specified for either the CMD or SEND form of the JANUS WEB ON command. See for a discussion of how Server Side Include tags can be used.</td></tr> | ||
<tr><th>TEXT</th> | |||
<td>Content is treated as plain text: <var class="product"> | <tr><th><var>TEXT</var></th> | ||
<td>Content is treated as plain text: <var class="product">Janus Web Server</var> will translate from EBCDIC to ASCII, regardless of the mime type. :note. Unless you specify TEXT, or unless the output mime type (see <var>[[$Web_Type]]</var>) starts with the string "text/", <var>$Web_ProcSend</var> assumes BINARY. | |||
</td></tr></table> | </td></tr></table> | ||
</td></tr></table> | </td></tr></table> | ||
<table | ===Status codes=== | ||
<table> | |||
<tr><th>Code</th> | <tr><th>Code</th> | ||
< | <th>Meaning</th></tr> | ||
<tr><th>0</th> | <tr><th> 0</th> | ||
<td>Procedure successfully sent.</td></tr> | <td>Procedure successfully sent.</td></tr> | ||
<tr><th>-1</th> | <tr><th>-1</th> | ||
<td>Not a web thread</td></tr> | <td>Not a web thread</td></tr> | ||
</table> | </table> | ||
==Examples== | |||
Sample code follows: | Sample code follows: | ||
<p class="code"> %X = $Web_Type('text/HTML') | <p class="code">%X = $Web_Type('text/HTML') | ||
%X = $Web_On | |||
... | ... | ||
%X = $Web_ProcSend( 'PROMOS', 'SALUTATION', 'MORE' ) | |||
%X = $Web_Put_Text( '<p>Dear ' WITH %FULLNAME) | |||
%X = $Web_ProcSend( 'PROMOS', 'DUFF_BEER_PROMO', 'MORE' ) | |||
%X = $Web_Put_Text( '<p>Act now ' WITH %FIRSTNAME WITH ', while supplies last' ) | |||
%X = $Web_ProcSend( 'PROMOS' ) | |||
STOP | |||
</p> | </p> | ||
<p> | |||
This sample shows how customized lines of HTML can be interspersed with static bodies of HTML by alternate calls to $Web_ProcSend and $Web_Put_Text. First the procedure SALUTATION is sent to the client buffer from file PROMOS. The MORE flag allows us to continue sending. Next a customized greeting is placed in the buffer, then the body of the document is taken from procedure DUFF_BEER_PROMOTION, again with the MORE flag, then a custom sign-off line, then the end of the HTML document without the MORE flag. | This sample shows how customized lines of HTML can be interspersed with static bodies of HTML by alternate calls to <var>$Web_ProcSend</var> and <var>$Web_Put_Text</var>. First the procedure SALUTATION is sent to the client buffer from file PROMOS. The MORE flag allows us to continue sending. Next a customized greeting is placed in the buffer, then the body of the document is taken from procedure DUFF_BEER_PROMOTION, again with the MORE flag, then a custom sign-off line, then the end of the HTML document without the MORE flag. </p> | ||
<p> | |||
The $ | The <var>$Web_Proc_Send</var> without the MORE sends all the content that has been accumulated to that point, followed by the indicated procedure. After everything has been sent, the connection with the client is terminated. Any functions that start with <code>$Web</code> that require a connection with the client would cause a user restart after this point, as would any other attempt to communicate with the client. Because of this, there's relatively little that can usually be done after a <var>$Web_Proc_Send</var> without MORE (or a <var>$Web_Done</var>); so it's not atypical, as in this example, for such a call to be followed almost immediately by a STOP statement.</p> | ||
[[Category:Janus Web Server $functions|$Web_ProcSend]] | [[Category:Janus Web Server $functions|$Web_ProcSend]] |
Latest revision as of 22:06, 5 June 2013
Add contents of procedure to response
$Web_Proc_Send adds the contents of a procedure to the client buffer.
Note: $Web_ProcSend is a synonym for $Web_Proc_Send.
$Web_Proc_Send is a callable $function.
Syntax
%rc = $Web_Proc[_]Send( filename, procname, p_flag )
SYntax terms
filename | The name of the Model 204 file or group containing the procedure to be sent. This parameter is optional. If it is not specified, the default file or group is used.
The parameter may be specified in either of these ways:
The file privileges for this procedure file must be at least X'02' (copy or display internal procedures). | ||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
procname | The name of the Model 204 procedure to be sent to the client. This parameter is required. | ||||||||||||||
p_flag | Processing indicators for how the client should handle the procedure. This parameter is optional. It consists of a combination of blank-separated options. Valid options are:
|
Status codes
Code | Meaning |
---|---|
0 | Procedure successfully sent. |
-1 | Not a web thread |
Examples
Sample code follows:
%X = $Web_Type('text/HTML') %X = $Web_On ... %X = $Web_ProcSend( 'PROMOS', 'SALUTATION', 'MORE' ) %X = $Web_Put_Text( '
Dear ' WITH %FULLNAME) %X = $Web_ProcSend( 'PROMOS', 'DUFF_BEER_PROMO', 'MORE' ) %X = $Web_Put_Text( '
Act now ' WITH %FIRSTNAME WITH ', while supplies last' ) %X = $Web_ProcSend( 'PROMOS' ) STOP
This sample shows how customized lines of HTML can be interspersed with static bodies of HTML by alternate calls to $Web_ProcSend and $Web_Put_Text. First the procedure SALUTATION is sent to the client buffer from file PROMOS. The MORE flag allows us to continue sending. Next a customized greeting is placed in the buffer, then the body of the document is taken from procedure DUFF_BEER_PROMOTION, again with the MORE flag, then a custom sign-off line, then the end of the HTML document without the MORE flag.
The $Web_Proc_Send without the MORE sends all the content that has been accumulated to that point, followed by the indicated procedure. After everything has been sent, the connection with the client is terminated. Any functions that start with $Web
that require a connection with the client would cause a user restart after this point, as would any other attempt to communicate with the client. Because of this, there's relatively little that can usually be done after a $Web_Proc_Send without MORE (or a $Web_Done); so it's not atypical, as in this example, for such a call to be followed almost immediately by a STOP statement.