Thanks Mike!
Terry ________________________________ From: The IBM z/VM Operating System [mailto:[EMAIL PROTECTED] On Behalf Of Michael Coffin Sent: Thursday, November 06, 2008 2:36 PM To: [email protected] Subject: Re: PIPES Ooops, missing an END. Sorry, my bad. :) -MC -----Original Message----- From: The IBM z/VM Operating System [mailto:[EMAIL PROTECTED] On Behalf Of Michael Coffin Sent: Thursday, November 06, 2008 2:33 PM To: [email protected] Subject: Re: PIPES Hi Terry, I was just catching up on some old posts to the list, so you've probably already resolved this - but I thought I'd let you know a much better way of doing this: /*Query if a virtual machine is logged on and exit on CP QUERY USER RC*/ Trace Off /*No need to trace*/ Address Command /*Always better than ADDRESS CMS*/ Parse Upper Arg LinuxGuest . /*Get the name of the target virtual machine*/ If LinuxGuest='' Then Do Say 'You did not provide the name of a VM to query.' Exit 45 /*Same RC as CP QUERY USER will yield for user not logged on*/ End 'PIPE CP QUERY USER' LinuxGuest '| HOLE' /*Is the user logged on?*/ If Rc=0 Then Say LinuxGuest 'is logged on.' /*RC0=Yes*/ Else Say LinuxGuest 'is not logged on.' /*RC45=No*/ Exit Rc /*Exit on CP QUERY USER RC, in case we are called by another program*/ Invoke with your "guest" as an argument, so for example if you named this exec QLINUX and wanted to query LINUX1, you'd execute it as: QLINUX LINUX1 Once you get familiar with the various commands and return codes available, you'll find it helps quite a bit to simply check RC's from commands. :) -Mike -----Original Message----- From: The IBM z/VM Operating System [mailto:[EMAIL PROTECTED] On Behalf Of Martin, Terry R. (CMS/CTR) (CTR) Sent: Friday, October 10, 2008 2:15 PM To: [email protected] Subject: PIPES Hi In the pipe command below where GUEST is the name of a Linux that I PULLED from a previous SAY. I want to use GUEST in the LOCATE can I do this and if so is the syntax correct? I have tried this but it does not work unless I put a specific Linux name in the LOCATE. This is just a test EXEC while I get a feel for all of this. SAY 'LINUX GUEST ID' PULL GUEST 'PIPE CP Q NAMES | LOCATE /GUEST/ | SPLIT | LOCATE /GUEST/', '| > LINUX USERS A' USERID = 'LINUX USERS A' PARSE VALUE STREAM(USERID,'C','OPEN READ') WITH OK FILE_HANDLE IF OK /= 'READY:' THEN DO SAY 'NO LINUX USERS LOGGED ON' END 'CP I CMS' EXIT /* RETURN TO CMS */ Thank You, Terry Martin Lockheed Martin - Information Technology z/OS & z/VM Systems - Performance and Tuning Cell - 443 632-4191 Work - 410 786-0386 [EMAIL PROTECTED]
