$CommndL: Difference between revisions
mNo edit summary |
No edit summary |
||
(32 intermediate revisions by 3 users not shown) | |||
Line 2: | Line 2: | ||
<span class="pageSubtitle">Execute Model 204 command on sdaemon, results to $list</span> | <span class="pageSubtitle">Execute Model 204 command on sdaemon, results to $list</span> | ||
<p class=" | <p class="warn"><b>Note:</b> Many $functions have been deprecated in favor of Object Oriented methods. The OO equivalent for the <var>$CommndL</var> function is [[Run (Daemon function)]]. The OO APIs emphasize the use of the [[List of Daemon methods|Daemon methods]]; users are strongly urged to use the new Daemon API instead of the old $functions.</p> | ||
This function allows a <var class="product">Model 204</var> command to be executed on an sdaemon with the results captured into a $list. $CommndL performs the same function as [[$Command]] except that data is returned to a $list rather than an image. | This function allows a <var class="product">Model 204</var> command to be executed on an [[Sdaemons|sdaemon]] with the results captured into a $list. <var>$CommndL</var> performs the same function as [[$Command]] except that data is returned to a $list rather than an [[Images|image]]. | ||
The <var>$CommndL</var> function accepts five arguments and returns a number indicating the success of the function. It is also [[Calling Sirius Mods $functions|callable]]. | |||
==Syntax== | ==Syntax== | ||
<p class="syntax">< | <p class="syntax"><span class="term">%rc</span> = <span class="literal">$CommndL</span>(<span class="term">cmd</span>, [<span class="term">msgctl</span>], [<span class="term">list_id</span>], [<span class="term">file</span>], [<span class="term">width</span>]) | ||
< | |||
< | |||
</p> | </p> | ||
<table | <table> | ||
<tr><th>%rc</th> | |||
<td>A numeric variable that is set to 0 or to a [[#Return codes|return code]].</td></tr> | |||
<tr><th>cmd</th> | <tr><th>cmd</th> | ||
<td>A string containing the <var class="product">Model 204</var> command to be executed. This is a required argument.</td></tr> | <td>A string containing the <var class="product">Model 204</var> command to be executed. This is a required argument.</td></tr> | ||
<tr><th>msgctl</th> | <tr><th>msgctl</th> | ||
<td>A number indicating the setting to be used for MSGCTL when issuing the command in the sdaemon. This is an optional parameter, and it defaults to the user's current MSGCTL setting.</td></tr> | <td>A number indicating the setting to be used for <var>[[MSGCTL parameter|MSGCTL]]</var> when issuing the command in the sdaemon. This is an optional parameter, and it defaults to the user's current <var>MSGCTL</var> setting.</td></tr> | ||
<tr><th>list_id</th> | <tr><th>list_id</th> | ||
<td>The identifier of the $list that is to receive the command output. This is an optional parameter; if omitted, command output is placed on the audit trail as " | <td>The identifier of the $list that is to receive the command output. This is an optional parameter; if omitted, command output is placed on the [[Tracking system activity (CCAJRNL, CCAAUDIT, CCAJLOG)#Audit trail format|audit trail]] as "RK" lines.</td></tr> | ||
<tr><th>file</th> | <tr><th>file</th> | ||
<td>A string indicating the name of a file that is to be automatically opened by the sdaemon and made the current file before | <td>A string indicating the name of a file that is to be automatically opened by the sdaemon and made the current file before <var class="term">cmd</var> is executed. This file is opened with the same access privileges the user currently has for the file. This is an optional parameter.</td></tr> | ||
<tr><th>width</th> | <tr><th>width</th> | ||
<td>A number indicating the line width to be used for output lines. This is an optional argument, and it defaults to 256. | <td>A number indicating the line width to be used for output lines. This is an optional argument, and it defaults to 256. This value can be specified as any value between 1 and the minimum <var>[[LOBUFF parameter|LOBUFF]]</var> value for any sdaemon thread in the Online, and if the value is not a valid number or not in this range, the request is cancelled. | ||
</td></tr> | </td></tr> | ||
</table> | </table> | ||
<p class="code"> | ===Return codes=== | ||
<p class="code"> 0 - Command successfully executed | |||
4 - Command processed, errors produced | |||
8 - sdaemon restarted | |||
12 - sdaemon required more input | |||
16 - No sdaemons are running | |||
20 - Out of storage | |||
36 - Line control settings invalid | |||
40 - Invalid file identifier | |||
</p> | </p> | ||
<p class=" | |||
==Example== | |||
The following program issues a <var>VIEW</var> command and displays the result at the user's terminal. | |||
<p class="code">b | |||
%list = $ListNew | |||
%rc = $CommndL('VIEW', ,%list) | |||
FOR %i FROM 1 TO $ListCnt(%list) | |||
PRINT $ListInf(%list, %i) | |||
END FOR | |||
end | |||
</p> | </p> | ||
==Products authorizing {{PAGENAMEE}}== | |||
< | <ul class="smallAndTightList"> | ||
<li>[[Janus Sockets]]</li> | |||
<li>[[Janus Web Server]]</li> | |||
</ul> | |||
</ | |||
[[Category:$Functions|$CommndL]] | [[Category:$Functions|$CommndL]] |
Latest revision as of 13:50, 22 November 2018
Execute Model 204 command on sdaemon, results to $list
Note: Many $functions have been deprecated in favor of Object Oriented methods. The OO equivalent for the $CommndL function is Run (Daemon function). The OO APIs emphasize the use of the Daemon methods; users are strongly urged to use the new Daemon API instead of the old $functions.
This function allows a Model 204 command to be executed on an sdaemon with the results captured into a $list. $CommndL performs the same function as $Command except that data is returned to a $list rather than an image.
The $CommndL function accepts five arguments and returns a number indicating the success of the function. It is also callable.
Syntax
%rc = $CommndL(cmd, [msgctl], [list_id], [file], [width])
%rc | A numeric variable that is set to 0 or to a return code. |
---|---|
cmd | A string containing the Model 204 command to be executed. This is a required argument. |
msgctl | A number indicating the setting to be used for MSGCTL when issuing the command in the sdaemon. This is an optional parameter, and it defaults to the user's current MSGCTL setting. |
list_id | The identifier of the $list that is to receive the command output. This is an optional parameter; if omitted, command output is placed on the audit trail as "RK" lines. |
file | A string indicating the name of a file that is to be automatically opened by the sdaemon and made the current file before cmd is executed. This file is opened with the same access privileges the user currently has for the file. This is an optional parameter. |
width | A number indicating the line width to be used for output lines. This is an optional argument, and it defaults to 256. This value can be specified as any value between 1 and the minimum LOBUFF value for any sdaemon thread in the Online, and if the value is not a valid number or not in this range, the request is cancelled. |
Return codes
0 - Command successfully executed 4 - Command processed, errors produced 8 - sdaemon restarted 12 - sdaemon required more input 16 - No sdaemons are running 20 - Out of storage 36 - Line control settings invalid 40 - Invalid file identifier
Example
The following program issues a VIEW command and displays the result at the user's terminal.
b %list = $ListNew %rc = $CommndL('VIEW', ,%list) FOR %i FROM 1 TO $ListCnt(%list) PRINT $ListInf(%list, %i) END FOR end