On Wednesday, 01/10/2018 at 10:30 GMT, Miguel Soltero Diaz <[email protected]> wrote: > hello guys, > I am trying to execute a VMSECURE command and capture the return code of that > command. So far, I am able to get the results from the command but not the rc. > Is there a way to capture the rc from that command? > is this something I should be talking to CA instead? > > This is the way I am executing the command using pipes. > 'pipe (stagesep ! endchar ?)', > '! VAR VMCMD !STARMSG *MSGALL', > '! >> GTPRIV REPT A', > > When the command is executed I get > whatever results from the command and ... > Ready(00024); T=0.01/0.01 14:18:19 > > > Ready(00024) is what I am after... and so far unable to get to it. > > is there a way to get it?
What the other responders are trying to say is that you're using the wrong tool for the job. STARMSG *MSG (not *MSGALL, please) is how you collect console activity that is NOT the result of a program (e.g. VMSECURE) doing I/O to the console. Examples include data sent to your console by: - The CP MESSAGE, WARNING or SMSG commands - Console activity of virtual machines you are monitoring with SET SECUSER or SET OBSERVER - Unsolicited asynchronous CP-generated output (e.g. RDR FILE FROM or TAPE 181 ATTACHED) But the synchronous output from a CP or CMS command doesn't require that technique. Instead, it's all in the primary output stream of the CP, CMS, and COMMAND stages: PIPE CMS QUERY DISK | STEM OUTPUT. Assuming there are no construction or flow errors in the PIPE itself, the return code from PIPE is the return code generated by the command. Sometimes a PIPE is sufficiently complicated that you can lose the return code, particularly when the pipe issues multiple commands. In that case the plumber will use the secondary output stream of CP, CMS, and COMMAND stages to get the return codes. As Mike Harding points out, VMSECURE is a command like any other, so "PIPE CMS VMSECURE ... | STEM OUTPUT." and it sets the variable 'rc' to the return code of the VMSECURE command.. Alan Altmark Senior Managing z/VM and Linux Consultant IBM Systems Lab Services IBM Z Delivery Practice ibm.com/systems/services/labservices office: 607.429.3323 mobile; 607.321.7556 [email protected] IBM Endicott
