From: SMTP%"Poser@vxdsyc.desy.de" 13-DEC-1993 10:07:55.57 To: EVERHART CC: Subj: Re: Duplicate process names.. X-Newsgroups: comp.os.vms Subject: Re: Duplicate process names.. Message-ID: From: poser@vxdsyc.desy.de (Till Poser) Date: Thu, 9 Dec 1993 21:18:59 GMT Reply-To: Poser@vxdsyc.desy.de Sender: poser@dsf58a.desy.de (Till Poser) Organization: Deutsches Elektronen Synchrotron, VXDESY System Gruppe Lines: 52 To: Info-VAX@CRVAX.SRI.COM X-Gateway-Source-Info: USENET In article <2dudakINN466@dns1.NMSU.Edu> neds@acca.nmsu.edu (Blue Blaze Irregular) writes: |>Okay, here's my problem.. I log into a terminal, run my login.com which |>has the line $set process/name="my name" Then, I log into a second |>terminal. When it gets to that line in the login.com file, it bombs out |>because that process name already exists. How do I test to see if that |>process name is already in use, and tell the computer to set a different |>process name? Silly, silly, silly, specifically some of the solutions that I have seen. But what the hell, here is my bit of sillyness: $ name = "«Pøsër»" $ pid: dummy = f$context("process",context,"username",- f$getjpi("","username"),"eql") $ pidloop: pid = f$pid(context) $ if pid.eqs."" then goto notfnd $ if f$getjpi(pid,"prcnam").nes.name then goto pidloop $ name="''name' " $ dummy = f$context("process",context,"cancel") $ goto pid $ notfnd: set proc/name="''name'" $ exit This will result in superficially identical process names in sh sys or sh user/fu. It's quite bullet proof and will fill "free" slots when it finds them. It will also work with funny characters that tend to be seen as wildcards in f$context. If You want a list of names, try: $ names = "junk,trash,dreck,glop" $ ind=0 $ pid: name=f$element(ind,",",names) $ dummy = f$context("process",context,"username",- f$getjpi("","username"),"eql") $ pidloop: pid = f$pid(context) $ if pid.eqs."" then goto notfnd $ if f$getjpi(pid,"prcnam").nes.name then goto pidloop $ ind = ind +1 $ dummy = f$context("process",context,"cancel") $ goto pid $ notfnd: set proc/name="''name'" $ exit but this could use a bit of bulletproofing, i.e. termination code. Till Poser Internet: poser@vxdsyc.desy.de -R- DESY Computing Bitnet: POSER@DESYVAX bldg.2b-314, Notkestr.85 Hepnet: VXDESY::POSER (13313::Poser) D-22603 Hamburg 52 Tel.: -49-40-8998-3219