$Command: Difference between revisions
No edit summary |
(Automatically generated page update) |
||
Line 2: | Line 2: | ||
<span class="pageSubtitle">Execute Model 204 command on sdaemon, results to image</span> | <span class="pageSubtitle">Execute Model 204 command on sdaemon, results to image</span> | ||
<p class=" | <p class="warn"><b>Note: </b>Most Sirius $functions have been deprecated in favor of Object Oriented methods. The OO equivalent for the $Command function is the <var>[[Run (Daemon function)|Run]]</var> 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 returned to an image. <var>$Command</var> performs the same function as <var>$CommndL</var> except that data is returned to an image rather than a $list. <var>$CommndL</var> and <var>$CommBg</var> are recommended over $Command, as they run with less overhead, are simpler to use, and return their output in a $list. | This function allows a <var class="product">Model 204</var> command to be executed on an sdaemon with the results returned to an image. <var>$Command</var> performs the same function as <var>$CommndL</var> except that data is returned to an image rather than a $list. <var>$CommndL</var> and <var>$CommBg</var> are recommended over $Command, as they run with less overhead, are simpler to use, and return their output in a $list. |
Revision as of 20:30, 18 July 2013
Execute Model 204 command on sdaemon, results to image
Note: Most Sirius $functions have been deprecated in favor of Object Oriented methods. The OO equivalent for the $Command function is the Run 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 returned to an image. $Command performs the same function as $CommndL except that data is returned to an image rather than a $list. $CommndL and $CommBg are recommended over $Command, as they run with less overhead, are simpler to use, and return their output in a $list.
The $Command function accepts five arguments and returns a number indicating the success of the function. It is also callable.
Syntax
%rc = $Command(cmd, [msgctl], [image_name], [file], [width])
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. |
image_name | The name of an image to receive the command output. This image should have the following format:
IMAGE CMD_OUT ARRAY_SIZE IS BINARY LEN 4 DISC_NUM IS BINARY LEN 4 NEXT_OUT IS BINARY LEN 4 LINES_OUT IS BINARY LEN 4 ARRAY OCCURS n OUT_ARRAY IS STRING LEN x END ARRAY END IMAGE Where:
|
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. The 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 80. Under Sirius Mods Version 6.2 and earlier: if this value is not in the range 1-256, the default is used. Under Sirius Mods Version 6.3 and later: 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. |
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 24 - Specified output image not found 28 - Image not active 32 - Image too short 36 - Image contains invalid data 40 - Invalid file identifier
The following program issues a VIEW command and displays the result at the user's terminal.
B IMAGE CMD_OUT ARRAY_SIZE IS BINARY LEN 4 DISC_NUM IS BINARY LEN 4 NEXT_OUT IS BINARY LEN 4 LINES_OUT IS BINARY LEN 4 ARRAY OCCURS 10 OUT_ARRAY IS STRING LEN 80 END ARRAY END IMAGE %I IS FIXED DP 0 %RC IS FIXED DP 0 PREPARE IMAGE CMD_OUT %CMD_OUT:ARRAY_SIZE = 10 %RC = $Command('VIEW',,'CMD_OUT') FOR %I FROM 1 TO 10 PRINT %CMD_OUT:OUT_ARRAY(%I) END FOR PRINT '10 lines printed. RC= ' AND %RC END