Sample DECTPU Procedures
A.4 Running DECTPU from an OpenVMS Subprocess
A.4 Running DECTPU from an OpenVMS Subprocess
Example A–4 shows one way of running DECTPU from a subprocess. It also
shows how to move to or from the subprocess.
Example A–4 Procedure to Run DECTPU from a Subprocess
!
!DCL command procedure to run DECTPU from subprocess
!
!Put $ e = "@keptedit"
!in your login.com. This spawns the editor the first time
!and attaches to it after that. I have defined a key to be
!"attach" so it always goes back to the parent.
$ tt = f$getdvi("sys$command","devnam") - "_" - "_" - ":"
$ edit_name = "Edit_" + tt
$ priv_list = f$setprv("NOWORLD, NOGROUP")
$ pid = 0
$10$:
$ proc = f$getjpi(f$pid(pid), "PRCNAM")
$ if proc .eqs. edit_name then goto attach
$ if pid .ne. 0 then goto 10$
$spawn:
$ priv_list = f$setprv(priv_list)
$ write sys$error "[Spawning a new Kept Editor]"
$ define/nolog sys$input sys$command:
$ t1 = f$edit(p1 + " " + p2 + ""+p3+""+p4+""
+ p5 + " " + p6 + " " + p7 + " " + p8,"COLLAPSE")
$ spawn/process="’’edit_name’" /nolog edit/tpu ’t1’
$ write sys$error "[Attached to DCL in directory ’’f$env("DEFAULT")’]"
$ exit
$attach:
$ priv_list = f$setprv(priv_list)
$ write sys$error "[Attaching to Kept Editor]"
$ define/nolog sys$input sys$command:
$ attach "’’edit_name’"
$ write sys$error "[Attached to DCL in directory ’’f$env("DEFAULT")’]"
$ exit
Sample DECTPU Procedures A–7