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 Received: from CORNELLC.CCS.CORNELL.EDU by KL.SRI.COM with TCP; Mon 28 Mar 88 22:12:23-PST Received: from SASK.BITNET by CORNELLC.CCS.CORNELL.EDU ; Tue, 29 Mar 88 01:13:02 EST Date: Tue, 29 Mar 88 00:11 CST From: (Glenn Hollinger) 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.COM >Sender: INFO-VAX Discussion >From: ACM_CSA@SWTEXAS >Subject: Question on f$getdvi lexical function > >[...] > >By executing this command file, > >$ On Control Then Exit >$ TOP: Write sys$output F$Getdvi(F$GetJPI(F$Pid(CONTEXT),"TERMINAL"),"DEVTYPE") >$ Goto TOP > >the error becomes illustrated. The value will be correct the first two loops, >different the third, and then crash on the fourth. (After executing this, >you can stop your temporary sub-process by STOP TEST.) > > [example deleted] > >Although application of this syntax does not often require a loop, the >F$GETDVI function is commonly called and I suspect it has something to >do with its call. We are presently running under V5.7. > >My question(s): > > Why this error is occuring? There might be your problem, this must be a beta-test of version 5.7! ;-) The error message is being caused by handing an empty string, "", to f$getdvi. The F$pid wild-cards all the process IDs you have access to in the system. This includes your interactive job as well as any subprocess, batch, network, and detached processes. The non-interactive jobs have no terminal associated with them, so getjpi returns an empty string for the terminal name. Getdvi tries to translate this empty string as a device name and returns the error you report. The error will not be limited to just subprocesses. The same error should occur for batch and network jobs under your UIC/Username. > How it can be prevented? The solution is not to hand the empty string to getdvi. Two solutions 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) $ if f$getjpi(x,"MODE") .eqs. "INTERACTIVE" .and. - ! only interactive f$getjpi(x,"MASTER_PID") .eqs. x then - ! not subprocess 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.