[comp.os.vms] Operator queries from batch

"Bruce_G._Kahler.rochX2"@XEROX.COM (06/25/87)

This seems like a trivial question, but I can't find a satisfactory
answer, so maybe it isn't.  How do you prompt the operator(console) and
accept the response from a batch job?  It seems like there are times
when this is desirable (for tape information, e.g.) but I can't see a
way to do it with the standard commands.
 Thanx - Bruce Kahler
	  Xerox Corp.
	   Rochester, NY	

carl@CITHEX.CALTECH.EDU.UUCP (06/28/87)

 > This seems like a trivial question, but I can't find a  satisfactory  answer,
 > so  maybe  it  isn't.  How do you prompt the operator(console) and accept the
 > response from a batch job?  It seems  like  there  are  times  when  this  is
 > desirable  (for  tape  information, e.g.) but I can't see a way to do it with
 > the standard commands.

I take it that you want more than just a YES/NO response.  The way to do
this is to put something like the dcl script that follows into your procedure.
This DCL is more complicated than you'll generally need, but in case you've
got a wise-guy operator (having filled in for operators occasionally when
they had to be away unexpectedly, I'm a living exmample that this can happen)
who responds with something like:

	$ foo = f$fao("!AS!/!AS!/!AS", "This is the first of three records", -
		"This is the second of three records",-
		"This is the third of three records")
	$ reply/to=17 "''foo'"

then the extra code can be useful.  Hope this helps.
                             
	$	set noon
	$	set NOverify          
	$	REP_FILE = F$GETJPI("","PID")+".REPLY-FILE"
	$	IF F$SEARCH(REP_FILE) .NES. "" THEN DELETE 'REP_FILE';*
	$	DEFINE/USER SYS$OUTPUT 'REP_FILE'
	$	req/rep "REPLY with text.  The batch job will read the reply"
	$!	set verify
	$	OPEN/READ FILE 'REP_FILE'
	$	DELETE 'REP_FILE';*
	$	READ FILE RECORD
	$	READ FILE RECORD
	$	CLOSE FILE
	$	CRLF:=
	$	CRLF[0,16] = %X0A0D
	$	END :=
	$	END[0,16] = %XFFFF
	$	RECORD = RECORD - ("%OPCOM-S-OPREPLY, " + CRLF)
	$	REPLY :=
	$ LOOP: LEN = F$LOCATE(CRLF, RECORD)
	$	IF LEN .EQ. F$LENGTH(RECORD) THEN GOTO DONE
	$	TMP = F$EXTRACT(0, LEN + 2, RECORD)
	$	REPLY = REPLY + TMP
	$	RECORD = RECORD - TMP
	$	GOTO LOOP
	$ DONE:	REPLY = (REPLY + END) - (CRLF + END)
	$	IF REPLY .nes. "" then WRITE/symbol SYS$OUTPUT REPLY

F1142S30%unika2@germany.CSNET (Juergen Renz) (06/30/87)

Hello Bruce,

some time ago, I wrote a testprogram dealing with Mailboxes and $SNDOPR too.
Here is my suggestion solving your problem:

1. Create a Mailbox with $CREMBX and save the channel number.
2. Send the REQUEST-message using $SNDOPR and give the channel number
   as second parameter.
3. Read the REPLY-message with $QIOW ,channel,IO$_READVBLK,...
4. Take any action according to the received message.
   e.g. define a logical name using LIB$SET_LOGICAL 
        or define a DCL symbol using LIB$SET_SYMBOL.

Please refer to:
        VAX/VMS System Services Reference Manual
                PART I    INTRODUCTION TO SYSTEM SERVICES
                          Section 7.18 MAILBOXES
                PART II   SYSTEM SERVICE DESCRIPTIONS
                          $CREMBX
                          $SNDOPR
                          $QIOW

Juergen Renz                                        Universitaet Karlsruhe
Falkengarten 7                                      Institut fuer Informatik IV
7530 Pforzheim
West-Germany