AppendCPCommandOutput (Stringlist function)

From m204wiki
Revision as of 22:23, 2 September 2015 by ELowell (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

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.


[%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 will not fit into the output buffer, the request is cancelled.
  • 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').


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