P From:	CSBVAX::MRGATE!HOLLINGE%SASK.BITNET@CUNYVM.CUNY.EDU@SMTP  3-APR-1988 16:15 To:	ARISIA::EVERHART/ Subj:	RE: Question on f$getdvi lexical function     Z Received: from CORNELLC.CCS.CORNELL.EDU by KL.SRI.COM with TCP; Mon 28 Mar 88 22:12:23-PSTT Received: from SASK.BITNET by CORNELLC.CCS.CORNELL.EDU ; Tue, 29 Mar 88 01:13:02 EST" Date:     Tue, 29 Mar 88 00:11 CSTK From:     <HOLLINGE%SASK.BITNET@CORNELLC.CCS.CORNELL.EDU> (Glenn Hollinger) 3 Subject:  RE: Question on f$getdvi lexical function  To:       info-vax@kl.sri.com . X-Original-To:  info-vax@kl.sri.com, HOLLINGER   >From: Jnet%"ACM_CSA@SWTEXAS" * >Date:         Mon, 28 Mar 88 01:38:00 CST" >Reply-To:     INFO-VAX@KL.SRI.COM2 >Sender:       INFO-VAX Discussion <INFO-VAX@UBVM> >From:         ACM_CSA@SWTEXAS4 >Subject:      Question on f$getdvi lexical function >  >[...] >   >By executing this command file, >  >$ On Control Then Exit P >$ TOP: Write sys$output F$Getdvi(F$GetJPI(F$Pid(CONTEXT),"TERMINAL"),"DEVTYPE") >$ Goto TOP  > N >the error becomes illustrated. The value will be correct the first two loops,K >different the third, and then crash on the fourth.  (After executing this, 7 >you can stop your temporary sub-process by STOP TEST.)  >  > [example deleted]  > G >Although application of this syntax does not often require a loop, the G >F$GETDVI function is commonly called and I suspect it has something to 8 >do with its call.  We are presently running under V5.7. >  >My question(s): >  >  Why this error is occuring?  I There might be your problem, this must be a beta-test of version 5.7! ;-)   D The error message is being caused by handing an empty string, "", toF f$getdvi.  The F$pid wild-cards all the process IDs you have access toA in the system.  This includes your interactive job as well as any H subprocess, batch, network, and detached processes.  The non-interactiveF jobs have no terminal associated with them, so getjpi returns an emptyC string for the terminal name.  Getdvi tries to translate this empty D string as a device name and returns the error you report.  The errorF will not be limited to just subprocesses.  The same error should occur3 for batch and network jobs under your UIC/Username.    >  How it can be prevented?   F The solution is not to hand the empty string to getdvi.  Two solutionsG come to mind.  The first mearly discards invalid cases while the second < predicts which cases not to do based on the type of process.   1) quick and dirty   $ On Control Then Exit. $ TOP: x = F$GetJPI(F$Pid(CONTEXT),"TERMINAL"); $ if x .nes. "" then Write sys$output F$Getdvi(x,"DEVTYPE") 
 $ Goto TOP   2) check process first   $ On Control Then Exit $ TOP: x = F$Pid(CONTEXT) J $ if f$getjpi(x,"MODE") .eqs. "INTERACTIVE" .and. -     ! only interactiveH         f$getjpi(x,"MASTER_PID") .eqs. x then -         ! not subprocessK                 Write sys$output F$Getdvi(F$GetJPI(x,"TERMINAL"),"DEVTYPE") 
 $ Goto TOP   > % >                        Ray Renteria ) >                        ACM_CSA@SWTNYSSA    Glenn Hollinger, Systems Programmer,  Computing Services,  University of Saskatchewan. 