AppendCPCommandOutput (Stringlist function): Difference between revisions

From m204wiki
Jump to navigation Jump to search
Line 23: Line 23:


==Examples==
==Examples==
The following program issues a CP <code>QUERY NAMES</code> command and displays the output on the user's terminal:
<p class="output">b
%sl is object stringlist auto new
%sl:appendCpCommandOutput('Q NAMES')
%sl:print
end
</p>
==See also==
==See also==
{{Template:Stringlist:AppendCPCommandOutput footer}}
{{Template:Stringlist:AppendCPCommandOutput footer}}

Revision as of 13:02, 21 September 2011

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.

The default value for BufferSize 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.

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