Operating System - OpenVMS
1827808 Members
2274 Online
109969 Solutions
New Discussion

Re: Capture output from REPLY/STATUS

 
SOLVED
Go to solution
Lester Dreckow
Advisor

Capture output from REPLY/STATUS

Hi,
This may be an old one, but I have not been able to find the answer as yet.

How can we capture the output of the REPLY/STATUS command. It seems that it does not write to sys$output (or sys$error).

For example ...

$ reply/enable=tape
$ define sys$output x.tmp
$ reply/status
%%%%%%%%%%% OPCOM 22-JUN-2007 15:22:13.68 %%%%%%%%%%%
Operator status for operator _AUC052$TNA156:
TAPES

$ deass sys$output
$ dir/siz/dat x.tmp

Directory DISK1:[SITE.MANAGER]

X.TMP;1 0 22-JUN-2007 15:22:10.55

Total of 1 file, 0 blocks.

Or ...

$ ty replystatus.com
$reply/status
$exit
$
$ @replystatus.com/out=x.tmp
%%%%%%%%%%% OPCOM 22-JUN-2007 17:06:39.82 %%%%%%%%%%%
Operator status for operator _AUC052$TNA156:
TAPES

$ dir/siz/dat x.tmp

Directory DISK1:[SITE.MANAGER]

X.TMP;2 0 22-JUN-2007 17:06:39.82
X.TMP;1 0 22-JUN-2007 15:22:10.55

Total of 2 files, 0 blocks.


Why? Thought we might DCL script a reply to some backup-related OPCOM messages, and expected this to be briefer than parsing operator.log, and simpler than intercepting OPCOM events.


Platform?
HP TCP/IP Services for OpenVMS Industry Standard 64 Version V5.6
on an HP rx3600 (1.59GHz/9.0MB) running OpenVMS V8.3


Thanks and regards,
Lester
25 REPLIES 25
Heinz W Genhart
Honored Contributor

Re: Capture output from REPLY/STATUS

Hi Lester

I have a similar problem I'm working on, just now.

One possibility to capture Opcom Messages is as follows:

- Create a Terminal with the PTD (Pseudo Terminal Driver)
- Create a Mailbox
- use $Assign to assoziate the ptd with the mailbox
- Issue repl/enable within the pseudo terminal
- ...and read the Opcom Messages from the mailbox

If you have enoug time, I can supply some example code in C within this week I hope

Regards

Geni
Volker Halle
Honored Contributor

Re: Capture output from REPLY/STATUS

Lester, Geni,

there is an OPCOM-TO-PTD C source code example at:

http://wwwvms.mppmu.mpg.de/vmssig/src/c/OPCOM-TO-PTD.C

Volker.
Heinz W Genhart
Honored Contributor

Re: Capture output from REPLY/STATUS

Hi Volker

thanks for the example. I have some problems with reading the example, because it's all on one line and several #include statements are empty (there is nothing behind #include)

Is it possible to supply the example in a more readable format?

thanks

Geni
Volker Halle
Honored Contributor

Re: Capture output from REPLY/STATUS

Geni,

go to

http://wwwvms.mppmu.mpg.de/vmssig/src/C/

and find the line with the URL to OPCOM-TO-PTD

Download the file as .C and open with notepad. It works for me.

Volker.
Dean McGorrill
Valued Contributor

Re: Capture output from REPLY/STATUS

Volker,
I went and looked at some of those
modules, there are all unreadable from a
browser. What can Geni use to retrieve it
in a readable format?
Hein van den Heuvel
Honored Contributor

Re: Capture output from REPLY/STATUS

Dean,

Yes they seem unreadable from limited functionality windoze browsers.

But do as Volker told you. Go to the directory above it, find the line with opcom-to-ptd (alphabetic), right click "Save Target as". Now open and voila.

From VMS the LYNX browser has no problem directly displaying the file and print --> save-to-file--> be happy.

fwiw,
Hein.

Robert_Boyd
Respected Contributor

Re: Capture output from REPLY/STATUS

Here is a simple DCL procedure I wrote 20 years ago that handles some cases of this. It depends on what you need to accomplish.

See what you think. I posted this to dcl.OpenVMS.org as well.

Robert
Master you were right about 1 thing -- the negotiations were SHORT!
Robert_Boyd
Respected Contributor

Re: Capture output from REPLY/STATUS

I just noticed -- you may want to open the file with WordPad instead of NotePad

Robert
Master you were right about 1 thing -- the negotiations were SHORT!
Robert Atkinson
Respected Contributor

Re: Capture output from REPLY/STATUS

We've used a very simple method that works, by running the commands in a batch job :-

$ DEFINE SYS$COMMAND TNA0:
$ REPLY /ENABLE /TEMP
$ REPLY /STATUS

The log file can then be interrogated.

For a much more fluid solution, use IAM:Consoles from Itheon, which you can script to take specific actions dependent on the text it sees.

Rob.
Lester Dreckow
Advisor

Re: Capture output from REPLY/STATUS

Thank you for the replies.

Robert A,
That is as simple as I hoped it to be! But those commands don't work for me in a batch job. I've tried it on I64 and Alpha, and for TNA0: and OPA0:. Nothing returned in the log file.

$ exit 1 !SYLOGIN
$ SHOW QUEUE SYS$BATCH
Batch queue SYS$BATCH, available, on AUC051::

Entry Jobname Username Status
----- ------- -------- ------
79 REPLY_STATUS SYSTEM Executing
$ DEFINE SYS$COMMAND TNA0:
$ REPLY /ENABLE /TEMP
$ REPLY /STATUS
$ WAIT 00:01:00
SYSTEM job terminated at 26-JUN-2007 19:06:15.05


Robert B,
Nice and simple, but I'm looking for the request text, not a reply.


Volker,
I understand now that we may need a pseudo-terminal to do this. The code compiles with warnings on our system, but still runs. It needs to be running before the a request is posted, rather than obtain the current status of outstanding requests as per "reply/status".


Geni,
I'd be interested in how you go as I'm not a C programmer.

Thanks,
Lester











Volker Halle
Honored Contributor

Re: Capture output from REPLY/STATUS

Lester,

did you look at the $SNDOPR system service ?

This service can send an OPC$_RQ_STATUS request and receive a list of outstanding requests in a mailbox.

There does not seem to be an example around for this type of operation.

Volker.
Volker Halle
Honored Contributor
Solution

Re: Capture output from REPLY/STATUS

Lester,

there is an example available:

Search for OPC$_RQ_STATUS in Google Groups

and look at the thread from 21-SEP-2000 titled:

Alternative to REPLY/ENABLE=TAPES ?

http://groups.google.de/group/comp.os.vms/browse_frm/thread/8577108b24e58802/80ca0b0a765b501d?lnk=st&q=OPC%24_RQ_STATUS&rnum=2&hl=de#80ca0b0a765b501d

Volker.
Lester Dreckow
Advisor

Re: Capture output from REPLY/STATUS

Volker,
Thanks. I found that example today, but I was still wondering why it doesn't quite work for me.

Run gives no output, but it does enable itself ans an operator console. Interesting thing is I do get the output when run in debug mode with "set mode screen" turned on and stepping. But no output when not stepping - seems bizarre, but leads me to think that I have some logical wrong or something. Still working on it.

Lester
Volker Halle
Honored Contributor

Re: Capture output from REPLY/STATUS

Lester,

I downloaded, compiled and linked the example. Worked for me, once I turned on OPER privilege ;-)

Volker.
Joseph Huber_1
Honored Contributor

Re: Capture output from REPLY/STATUS

Just a remark to the source (and other) files on wwwvms.mppmu.mpg.de:

The files are served by a VMS web server (OSU HTTPD), and all source files are correctly sent as text/plain.
There will be no problem downloading the files on a VMS (or Unix) system.
On windows systems there are the usual problems: the mime-type is ignored, so windows handles it according to the filename-extension, not as text files.
After downloading in binary mode, notepad is too simple to handle files of records, which are not terminated.
Use a more clever text editor!

All files in /vmssig/... are for VMS, and meant to be used on VMS.
(And although my desktops are all Linux, I have no problems to display the VMSSIG repository with Mozilla/Firefox ...)

Cheers, and enjoy wwwvms.mppmu.mpg.de as long as it exists !
http://www.mpp.mpg.de/~huber
Lester Dreckow
Advisor

Re: Capture output from REPLY/STATUS

Thanks Volker,
And yes, it works for me on Alpha VMS V7.3-1. A perfect solution if I can get it to go on I64 VMS V8.3. Working on it.

Lester
Lester Dreckow
Advisor

Re: Capture output from REPLY/STATUS

Hi C gurus,

The code example (attached) now works on I64, when it includes a printf statement immediately before the sys$qiow call.

Code snippet ...

for (;;) {
printf ("%s\n", ""); /* makes it work on I64, VMS V8.3, HP C V7.2-001-50G14 */

status = sys$qiow (0, mbx_chan, IO$_READVBLK|IO$M_NOW, &iosb, 0, 0,
&reply, OPC_BUFSIZ, 0, 0, 0, 0);

printf ("%s %i\n", "..status ",status);
printf ("%s %i\n", "..iosb ",iosb[0]);


Without this printf, sys$qiow immediately returns %SYSTEM-W-ENDOFFILE, end of file ...

$ run OPCOM_STATUS
..status 1
..iosb 2160
$


With this printf, it works as expected ...

$ run OPCOM_STATUS

..status 1
..iosb 1
%%%%%%%%%%% OPCOM 4-JUL-2007 17:10:59.89 %%%%%%%%%%%
Operator _AUC051$FTA95: has been enabled, username SYSTEM


..status 1
..iosb 1
%%%%%%%%%%% OPCOM 4-JUL-2007 17:10:59.89 %%%%%%%%%%%
Operator status for operator _AUC051$FTA95:
CENTRAL, PRINTER, TAPES, DISKS, DEVICES, CARDS, NETWORK, CLUSTER, SECURITY


..status 1
..iosb 1
%%%%%%%%%%% OPCOM 4-JUL-2007 17:10:59.89 %%%%%%%%%%%
Operator status for operator _AUC051$FTA95:
CENTRAL, PRINTER, TAPES, DISKS, DEVICES, CARDS, NETWORK, CLUSTER, SECURITY


..status 1
..iosb 2160
$

Not being a C programmer, I can't see what difference it should make. But, no doubt there is an explanation.

Platform: I64, VMS V8.3, HP C V7.2-001-50G14

Regards,
Lester

Heinz W Genhart
Honored Contributor

Re: Capture output from REPLY/STATUS

Hi Lester

I think the problem you have is the qio

Exchange

IO$_READVBLK|IO$M_NOW
with IO$_READVBLK|IO$M_WRITERCHECK,

This may solve the problem

Regards

Geni
Volker Halle
Honored Contributor

Re: Capture output from REPLY/STATUS

Lester,

I just removed the '|IO$M_NOW' modifier and it works fine for me on OpenVMS I64 V8.2.

You want to wait for a MBX message, so why specify IO$M_NOW, which will terminate the QIOW, if no message is available.

Volker.
Lester Dreckow
Advisor

Re: Capture output from REPLY/STATUS

Thanks Geni and Volker,

Removing IO$M_NOW causes the code to loop and wait for future requests, like the OPCOM-TO-PTD eaxample, rather than display the current reply/status and then exit.

Regards,
Lester

Volker Halle
Honored Contributor

Re: Capture output from REPLY/STATUS

Lester,

just capturing the 'current status' may need some mechanism with a timer, as you cannot rely on the number of OPCOM messages shown as a result of REPLY/STATUS.

You could try to put a wait instead of the printf.

Volker.
Lester Dreckow
Advisor

Re: Capture output from REPLY/STATUS

Thanks Volker,

I'm continuing to work with the code examples.

Lester
Heinz W Genhart
Honored Contributor

Re: Capture output from REPLY/STATUS

Hi Lester

as I mentioned before, I wrote now a program which is capturing Opcom messages and transfer them to a Unix Syslog Server. Because we will use it on many machines, I created a VMSINSTALable Kit. If you are interested I can post the kit here. The problem will be that the Release Notes, the helpfile and the comments in the startup/shutdown commanfile is in german.

Let me know if you are interested

Regards

Geni
Troodon
Frequent Advisor

Re: Capture output from REPLY/STATUS

You know you can assign a static LAT port, and in the set characteristics assign a broadcast mailbox.

Sounds a lot simpler than most of these ideas.

Starting LAT is not such a big deal.