Normally, for each editing operation, PMDF MAIL starts up a new editing session. This may even involve spawning a new subprocess for every operation. This overhead can be avoided by keeping an editing subprocess and attaching to it for each editing operation. When PMDF MAIL is invoked with the command
$ PMDF MAIL/EDIT=KEPTit will attempt to attach to the subprocess with the name Edit_x whenever the editor is needed. x is the name of the PMDF MAIL process's terminal device with all underscores, dashes, and colons removed. For instance, for the terminal device _FTA123: the expected subprocess name would be Edit_FTA123. The name is truncated to fifteen characters.
If no subprocess exists with the name Edit_x, or if that subprocess cannot be attached to, then PMDF MAIL will attempt to spawn a process with that name and have it execute the command specified with the MAIL$EDIT logical. Appended to this command will be the four parameters described in Section 7.9.1.2 ; the job logical names described below will also be defined. This behavior allows PMDF MAIL to actually create the editing subprocess itself if it does not already exist.6 For this reason, it is recommended that in your login command procedure you define MAIL$EDIT to be the name of a command procedure to invoke your editor; e.g.,
$ DEFINE MAIL$EDIT "@PMDF_ROOT:[DOC.EXAMPLES]MAILEDIT.COM"This procedure would then simply invoke your editor. For instance, the command procedure shown below invokes TPU.
$ VERI = 'F$VERIFY(0)' $ ! MAILEDIT.COM - Startup TPU as this process's editor $ ! $ ! P1 = Input file name $ ! P2 = Output file name $ ! P3 = Ignored; used by PMDF MAIL $ ! P4 = Starting position $ ! $ DEFINE/NOLOG SYS$INPUT SYS$COMMAND: $ P2 = F$EDIT(P2, "COLLAPSE") $ P4 = F$EDIT(P4, "COLLAPSE") $ IF P2 .NES. "" THEN P2 = "/OUTPUT=''P2'" $ IF P4 .NES. "" THEN P4 = "/START_POSITION=''P4'" $ EDIT/TPU'P2''P4' 'P1' $ VERI = F$VERIFY (VERI)Keep in mind that the MAIL$EDIT command procedure will be executed from a subprocess; there is no need for it itself to spawn out a subprocess to run your editor.
When the editor is attached to, it should make use of the following job logicals to determine which input file to edit and where to write its output:
Logical name | Usage |
---|---|
PMDF_MAIL_INPUT_FILE | Input file to edit. |
PMDF_MAIL_OUTPUT_FILE | Output file to generate; to cancel mail operation, do not generate an output file. |
PMDF_MAIL_COMMAND | Interactive PMDF MAIL command which requested the editing operation. Always one of EDIT, DIRECTORY, DIRECTORY/FOLDER, FORWARD, READ, REPLY, or SEND. |
PMDF_MAIL_START_POSITION | If possible, place the edit insert point on this line of the input file. That is, initial line of the file to place the cursor at. First line is line 1. |
A "kept" editor used with PMDF MAIL should do the following:
Use the command
$ PMDF MAIL/EDIT=KEPT=process-nameto specify an explicit process name,
process-name
, for the editor subprocess. PMDF
MAIL will then try to attach to the subprocess with the specified name;
if no subprocess with that name exists, then a subprocess will be
created and given that name.