You'll probably get a bunch of answers. The following two files make it easy from the command line, from an EXEC (even as a rexx function call), and from a Pipes stage.
Mike Walter Hewitt Associates The opinions expressed herein are mine alone, not my employer's. /* Prolog; See Epilog for additional information ******************** * Exec Name - DIRECTID REXX * * Unit Support - IS * * Status - Version 2, Release 1.0 * ********************************************************************/ /*address 'COMMAND'*/ /* <-- Not a good idea in a Pipe! */ parse source xos xct xfn xft xfm xcmd xenvir . parse upper arg InputRange If InputRange='' then InputRange='1.8' 'SCANRANGE REQUIRED field rest' InputRange If rc<>0 then Exit rc 'SELECT INPUT 0' 'READTO in' /* Prime the DO loop with 1 rec. */ Do while rc=0 /* Read all the records on the pipe*/ 'GETRANGE field VARIABLE testid' in /* Get specified substr */ parse var testid w1 w2 /* In case range of 'n.n' > 1 word */ Do v=1 to 1 If w1<>'*' & w2='' then /* Not self, and not > 1 word */ Do parse value diagrc(08,'CP LINK' testid) with , drc dcc qid '15'x rest ?cpid=(drc<>20 & drc<>52 & drc<>53) End Else ?cpid=0 If ?cpid then 'SELECT OUTPUT 0' /* Valid ID to primary stream */ else 'SELECT OUTPUT 1' /* Invalid ID to secondary */ If rc<>0 then Leave v 'OUTPUT' in End v 'READTO in' /* Read one record from pipe */ End Exit 0 /* Epilog *********************************************************** * Function - A CMS Pipeline filter to validate userids in the * * CP Directory from a PIPE. * * Component of - Hewitt Associates Pipe filters. * * Command format- DIRECTID inputrange * * Command format- | REXX DIRECTID <range> * * O/P Stream 1 - Records with valid userids in the CP directory. * * O/P Stream 2 - Records with userids not in the CP directory. * * Called by - CMS Pipeline stage (not the first stage). * * Dependencies - CMS PIPELINES. * * Program Lang. - CMS REXX * * Date Written - 05/25/93 * * Author - Michael R. Walter * * Changed | By | Description of Change * * --------+-----+------------------------------------------------- * * 06/04/93 MRW -Update to use diag08 vs PIPE CP QUERY. * * 06/04/93 MRW -Update to support begcol.count format. * * 06/22/94 MRW -Move 'in' variable outside quotes for 'PAM' * * -Handle 'CONSOLE' as a userid. * * 12/07/95 MRW -Simplify DirectID (?cpid) processing. * * 20001205 MRW -Support InputRanges as defined by Pipes. * * * ********************************************************************/ and... /* Prolog; See Epilog for additional information ******************** * Exec Name - DIRECTID EXEC * * Unit Support - IS * * Status - Version 1, Release 1.0 * ********************************************************************/ address COMMAND parse source xos xct xfn xft xfm xcmd xenvir . parse upper arg parms 0 operands '(' options ')' parmrest parse upper var operands testid . parse value diagrc(08,'CP LINK' testid) with , drc dcc qid '15'x rest ?cpid=(drc<>20 & drc<>52 & drc<>53) Call Exit ?cpid /********************************************************************/ /* Sub-Routines below this point */ /********************************************************************/ Exit: parse arg exitrc . If verify(exitrc,0123456789)=0 then Exit exitrc else Exit 999999 /* Epilog *********************************************************** * Function - A REXX EXEC to validate that a given userid is * * in the CP Directory. * * Component of - Hewitt Associates tool kit. * * Command format- If directid(userid) then say 'It is valid!' * * else say 'Not in CP direct!' * * Usage Note - Using 'CP SPOOL testid' will return rc<>0 if * * the user has VM:Secure rule "REJECT * SPOOL". * * Called by - REXX EXECs * * Dependencies - VM/SP 3 or higher. * * Program Lang. - CMS REXX * * Date Written - 03/03/98 * * Author - Michael R. Walter * * Changed | By | Description of Change * * --------+-----+------------------------------------------------- * * 03/03/98 MRW -Port from DIRECTID REXX. * * * ********************************************************************/ "Frank M. Ramaekers" <framaek...@ailife.com> Sent by: "The IBM z/VM Operating System" <IBMVM@LISTSERV.UARK.EDU> 03/15/2010 02:20 PM Please respond to "The IBM z/VM Operating System" <IBMVM@LISTSERV.UARK.EDU> To IBMVM@LISTSERV.UARK.EDU cc Subject Check for User... What?s the best way to check: 1) UserID is valid (a user on this system) 2) UserID is logged on (or not) Frank M. Ramaekers Jr. Systems Programmer MCP, MCP+I, MCSE & RHCE American Income Life Insurance Co. Phone: (254)761-6649 1200 Wooded Acres Dr. Fax: (254)741-5777 Waco, Texas 76701 _____________________________________________________ This message contains information which is privileged and confidential and is solely for the use of the intended recipient. If you are not the intended recipient, be aware that any review, disclosure, copying, distribution, or use of the contents of this message is strictly prohibited. If you have received this in error, please destroy it immediately and notify us at privacy...@ailife.com. The information contained in this e-mail and any accompanying documents may contain information that is confidential or otherwise protected from disclosure. If you are not the intended recipient of this message, or if this message has been addressed to you in error, please immediately alert the sender by reply e-mail and then delete this message, including any attachments. Any dissemination, distribution or other use of the contents of this message by anyone other than the intended recipient is strictly prohibited. All messages sent to and from this e-mail address may be monitored as permitted by applicable law and regulations to ensure compliance with our internal policies and to protect our business. E-mails are not secure and cannot be guaranteed to be error free as they can be intercepted, amended, lost or destroyed, or contain viruses. You are deemed to have accepted these risks if you communicate with us by e-mail.