[comp.os.vms] old prompt question which I never saw answered.

WIZARD@RITA.ACS.WASHINGTON.EDU ("The Bandit . . . ", on RITA) (06/08/88)

Some time back, someone asked the following question:

>  Hi world,
>  I have a program that spawns a process to execute DCL commands. I have
>  arranged to have this process (running DCL) read input from a mailbox
>  and output to another mailbox. Then I use read qio's on the second mailbox
>  and send whatever the qio's return to my screen and to a log file. What
>  I am trying to get is the prompt. Where does it go? Reading from the second
>  mailbox only shows DCL output. No prompt!

Now, I have no idea who it was that asked this question, but I do have a brief
answer.  The problem is that VMS tries to be "smart" about issuing prompts.
If your input and output device specifications are NOT identical, the prompt
is simply NOT issued.  For you normal interactive session, SYS$INPUT has the
same translation as SYS$OUTPUT, and so prompts are issued.  For your normal
batch job, SYS$INPUT <> SYS$OUTPUT, and your batch log file does NOT contain
the prompts.   There is no reasonable work-around that I know of at this time.

Derek Haining
Academic Computing Services
University of Washington
Seattle, Washington
(206) 543-5852

DEREK@RITA.ACS.WASHINGTON.EDU
        -or-
DEREK@UWARITA.BITNET

JONES-D@OSU-20.IRCC.OHIO-STATE.EDU (Dave Jones) (06/12/88)

Mr. Haining's statements regarding how VMS issues prompts are wrong.  Whether 
a prompt appears has nothing to do with whether SYS$INPUT is the same as 
SYS$OUTPUT.  The prompt is written to SYS$INPUT ONLY if SYS$INPUT is a 
terminal, prompts are never sent to SYS$OUTPUT.

The VMS terminal driver has a feature called read-with-prompt that 
treats the display of a prompt and reading of input as a single operation.
DCL and most VMS utilities use read-with-prompt when reading from a terminal
and a normal read when reading from a non-terminal (e.g. mailbox) device.

An additional caveat about assigning SYS$INPUT to a mailbox is that
DCL will 'read ahead' 1 record from the mailbox, so you can't simply use
read attention AST's to synchronize processing of output to SYS$OUTPUT
with the commands you are sending to SYS$INPUT.

(Note that this disscussion concerns the operation of DCL and VMS utilities,
 user-written and third-party software may actually write their prompts
 using the write function.)
------
David Jones
Ohio State University
1981 Neil Ave. Rm. 406
Columbus OH, 43210
-------

lawrenc@nvanbc.UUCP (Lawrence Harris) (06/29/88)

In response to the reply on where the prompts go.  I had exactly this
question some time ago and after some research I came to the conclusion
that when you issue a $QIO with prompt, that VMS actually writes to the
input channel.  It really has no choice since you can't specify an
output channel to prompt on.  What happens to the prompt is therefore
device specific.  On a terminal it actually writes the prompt out, on
mailboxes the option to prompt is simply ignored.

What DCL needs is another i/o device SYS$PROMPT however I think that
would mess up the command line refresh and related stuff.
-- 
------------------------------------------------------------------------------
UUCP:  {ihpn4!alberta,uw-beaver}!ubc-vision!ubc-cs!van-bc!nvanbc!lawrence
SNAIL: 733 Sylvan Ave., North Vancouver, B.C., Canada, V7R 2E8
PHONE: 1-604-736-9241 (09:00-17:00 PST) 1-604-420-9518 (after 17:00 PST)

woerz@iaoobelix.UUCP (Dieter Woerz) (07/14/88)

In article <8806280841.AA18214@ucbvax.Berkeley.EDU> WIZARD@RITA.ACS.WASHINGTON.EDU ("The Bandit . . . ", on RITA) writes:
> ...

>The problem is that VMS tries to be "smart" about issuing prompts.
>If your input and output device specifications are NOT identical, the prompt
>is simply NOT issued.  For you normal interactive session, SYS$INPUT has the
>same translation as SYS$OUTPUT, and so prompts are issued.  For your normal
>batch job, SYS$INPUT <> SYS$OUTPUT, and your batch log file does NOT contain
>the prompts.   There is no reasonable work-around that I know of at this time.

> ...

This is not completely right.
If a prompt is issued, it is always written to the SYS$INPUT. I think
that has todo with reissuing the prompt, when broadcast messages are
written to the terminal. And the prompt is only written, if SYS$INPUT
is a terminal.

------------------------------------------------------------------------------

Dieter Woerz
Fraunhofer Institut fuer Arbeitswirtschaft und Organisation
Abt. 453
Holzgartenstrasse 17
D-7000 Stuttgart 1
W-Germany

BITNET: iaoobel.uucp!woerz@unido.bitnet
UUCP:   ...{uunet!unido, pyramid}!iaoobel!woerz