AppendCPCommandOutput (Stringlist function): Difference between revisions

From m204wiki
Jump to navigation Jump to search
Line 12: Line 12:
<td>The CP command to be issued.</td></tr>
<td>The CP command to be issued.</td></tr>
<tr><th><var>BufferSize</var></th>
<tr><th><var>BufferSize</var></th>
<td>The size of the virtual storage buffer to hold the result of the CP command. <var>AppendCpCommandOutput</var> uses Diagnose X'08' to issue the CP command and Diagnose X'08' requires that the output from the command go to a single contiguous buffer in virtual storage. This buffer is only used as a staging area to hold the command output until it is moved to the output <var>Stringlist</var>.<br/><br/>
<td>The size of the virtual storage buffer to hold the result of the CP command. <var>AppendCpCommandOutput</var> uses Diagnose X'08' to issue the CP command, and Diagnose X'08' requires that the output from the command go to a single contiguous buffer in virtual storage. This buffer is only used as a staging area to hold the command output until it is moved to the output <var>Stringlist</var>.
The default value for <var>BufferSize</var> is 64K (65536) and can set set to any value between 256 and 16M-1 (16777215). The default BufferSize is probably more than enough for almost all commands and there is probably little benefit to making the buffer smaller as it's only allocated for a fleeting instant.</td></tr>
<p>
<var>BufferSize</var> can be set to any value between 256 and 16M-1 (16777215). The default BufferSize, 64K (65536), is probably more than enough for almost all commands. There is probably little benefit to making the buffer smaller, as it is only allocated for a fleeting instant. </p></td></tr>
</table>
</table>



Revision as of 21:02, 4 May 2012

Add output from CP command to Stringlist (Stringlist class)

[Introduced in Sirius Mods 7.9]


This callable method invokes a CP command in the Online's virtual machine and adds the output from that command to a Stringlist. The AppendCPCommand method accepts one or more arguments and returns a numeric result. Since CP commands are only available in a CMS environment, this method is useless when running under z/OS (MVS) or VSE and will result in request cancellation if invoked under those operating systems.

Syntax

[%rc =] sl:AppendCPCommandOutput( command, [BufferSize= number])

Syntax terms

%rcThe return code from the issued CP command.
sl The Stringlist to receive output from the CP command.
command The CP command to be issued.
BufferSize The size of the virtual storage buffer to hold the result of the CP command. AppendCpCommandOutput uses Diagnose X'08' to issue the CP command, and Diagnose X'08' requires that the output from the command go to a single contiguous buffer in virtual storage. This buffer is only used as a staging area to hold the command output until it is moved to the output Stringlist.

BufferSize can be set to any value between 256 and 16M-1 (16777215). The default BufferSize, 64K (65536), is probably more than enough for almost all commands. There is probably little benefit to making the buffer smaller, as it is only allocated for a fleeting instant.

Usage notes

  • Since a CP command can do nasty things to an Online (like set storage or re-IPL the virtual machine), it is restricted to users with system manager privileges. An attempt to use it on a non-system manager account results in request cancellation.
  • If the CP command output won't fit into the output buffer the request is canceled.
  • Multiple CP commands can be issued in a single AppendCpCommandoutput invocation by separating them with an EBCDIC newline character (X'15') as in %sl:AppendCpCommandOutput('Q SET' '15':x 'IND').

Examples

The following program issues a CP QUERY NAMES command and displays the output on the user's terminal:

b %sl is object stringlist auto new %sl:appendCpCommandOutput('Q NAMES') %sl:print end

See also