Operating System - OpenVMS
1828225 Members
2347 Online
109975 Solutions
New Discussion

Re: How to find the command line of a process

 
Wim Van den Wyngaert
Honored Contributor

How to find the command line of a process

Isn't there some kind of freeeware program that shows the command line being executed by each process ? If possible the stack of command lines ?

So, a process that does
$ @wim.com
and wim.com contains
$ show time
$ wait 01:00

would be shown as
1) @wim.lis
2) wait 01:00

Wim
Wim
21 REPLIES 21
Bart Zorn_1
Trusted Contributor

Re: How to find the command line of a process

Wim,

Do you mean that you want to see what is executing inside the command procedure? In other words, you want to see more than what is kept in the command recall buffer?

Regards,

Bart
Wim Van den Wyngaert
Honored Contributor

Re: How to find the command line of a process

Exact Bart. The complete DCL stack.

Wim
Wim
Volker Halle
Honored Contributor

Re: How to find the command line of a process

Wim,

I've pointed to this article recently:

http://h71000.www7.hp.com/openvms/journal/v1/dcl.html

An Inside Look at DCL by Guy Peleg in the OpenVMS Technical Journal V1.

It has information on how to access the 'expansion buffer' with SDA.

Volker.
Wim Van den Wyngaert
Honored Contributor

Re: How to find the command line of a process

Just tried it on my 7.3 and it doesn't work.

virtaual locations ... are not accessible
unable to access ...
unknown symbol prc_g_commands

Wim
Wim
labadie_1
Honored Contributor

Re: How to find the command line of a process

I guess you are searching for a linux equivalent of /proc/'pid'/cmdline ?
Wim Van den Wyngaert
Honored Contributor

Re: How to find the command line of a process

labadie,

I think so. But a stack would even be better.
(i'm out of unix since 1994)

Wim
Wim
Volker Halle
Honored Contributor

Re: How to find the command line of a process

Wim,

it works for me (on V7.3-1 and V8.2), if you use the following SDA command to define the address of the WRK data structure:

SDA> def wrk=@(prc+prc_l_curwrk)

The expansion buffer WRK_G_BUFFER just provides the most recently executed DCL command as a zero-terminated string.

Volker.
Wim Van den Wyngaert
Honored Contributor

Re: How to find the command line of a process

OK Volker, this is usable for problem cases.

But a freeware program would still be nicer.

Wim
Wim
Volker Halle
Honored Contributor

Re: How to find the command line of a process

Wim,

how about writing your own DCL$SDA SDA extension ? You now have all the necessary information.

But the only information readily available would be:

- the DCL recall buffer (showing @WIM.COM)
=> this is available from SDA> CLUE PROC/RECALL

- the most recent DCL command issued (WAIT 01:00)
=> this is available from the instructions given

Volker.
labadie_1
Honored Contributor

Re: How to find the command line of a process

>>> But a freeware program would still be nicer.


Write a Sda extension, like this, if there is a bug, you will crash your process, not the system !

You may have a look at sys$examples:mbx$sda, for a basic and simple sda extension

You have modes$sda ( I do not remember where I saw it), which does some sums from the cpu ticks of a process in the 4 modes (kernel, exec, super, user, see
exam pcb+pcb$l_kernel_counter
and the 3 others)

and ctlpa$sda, procio$sda, s0s1$sda...
Ian Miller.
Honored Contributor

Re: How to find the command line of a process

Other SDA extension examples can be found at

http://eisner.encompasserve.org/~miller/

An SDA extension would be the simpler way of implementing this although it could be done in other ways but they would be more problematic.
____________________
Purely Personal Opinion
Paul Beaudoin
Regular Advisor

Re: How to find the command line of a process

Wim

Is this what you had in mind (My applogies to the original author - I can't remember where I got this)
Watch for wrapping

Paul
DCL_NUMBERING.COM
$! Run this proc against DCL source
$! 2. output will be named proc.post_com
$! 3. execute proc.post_com instead of source
$! 4. source line nr will be recorded in local symbol "L" for each DCL line
$! interpreted
$! 5. write error handler to display/print last line number when triggered.
$ v=f$v(0)
$ on warning then exit
$ if p1 .eqs. "" then inq p1 "Input file"
$ if p1 .eqs. "" then exit
$ if f$search(p1) .eqs. ""
$ then
$ write sys$output p1," not found"
$ exit
$ endif
$ out_file = f$parse(p1,,,"name") + ".POST_COM"
$ write sys$output "Resulting file is ",f$dir(),out_file
$ close/nolog ch
$ close/nolog ch2
$ open/read ch 'p1'
$ open/write ch2 'out_file'
$ i=0
$ skip="NO"
$LOOP:
$ read/end=EOF ch line
$ write ch2 line
$ i=i+1
$ rec = "$L=''i'"
$! what are the lines that we don't want to mess up
$ line2=f$edit(line,"UPCASE,COLLAPSE")
$ if f$extract(0,3,line2) .eqs. "$!#" .or. - !metadata
f$extract(0,4,line2) .eqs. "$SQL" .or. - !interactive
f$extract(0,5,line2) .eqs. "$DECK" .or. - !(obvious?)
f$extract(0,7,line2) .eqs. "$CREATE" .and. - !idem $DECK
f$extract(7,1,line2) .nes. "/" then skip = "YES" !others are good
$!
$ if f$extract(0,8,line2) .eqs. "$CREATE=" then skip = "NO" !assignment
$!
$ if f$extract(0,3,line2) .eqs. "$!&" .or. - !metadata
f$extract(0,4,line2) .eqs. "$EOD" then skip = "NO" !end of $DECK
$!
$ if f$extract(0,2,line2) .nes. "$!"
$ then
$ line2=f$edit(line,"COLLAPSE,UNCOMMENT")
$ if f$extract(f$len(line2)-1,1,line2) .nes. "-" !don't mess it..
$ then !..if cont line
$ if skip .eqs. "NO" then write ch2 rec !write line nr
$ i=i+1 !inc line nr
$ endif
$ endif
$ goto LOOP
$EOF:
$ close ch
$ close ch2
$ v=f$v(v)
$ write sys$output "Done"
$ exit
Peter Barkas
Regular Advisor

Re: How to find the command line of a process

Wasn't there something called the Eigen utilities pack a long time ago? I don't know if this is still available commercially or if it has made it to the public domain?
Kelly Stewart_1
Frequent Advisor

Re: How to find the command line of a process

Eigen has a web site at http://www.eigencorporation.com/. But they have not ported their software to Integrity, and there have been no updates for years. The package includes a command buffer recall utility ("RCALL") that accepts an /ID qualifier and the /OUTPUT qualifier, so you could probably use it, if only...
Dean McGorrill
Valued Contributor

Re: How to find the command line of a process

Volker,
more nice stuff, I could use this

but where is prc, prc_l_curwrk defined? is prc a phd,pcb?


>def wrk=@(prc+prc_l_curwrk)<
Jim_McKinney
Honored Contributor

Re: How to find the command line of a process

> but where is prc, prc_l_curwrk defined?

SYS$SYSTEM:DCLDEF.STB


$ ANALYZE/SYSTEM
SDA> READ DCLDEF
SDA> SHOW SYMBOL/ALL PRC

Used in a program you'd just link with DCLDEF.STB included. If you have the VMS source code, take a look at the DCL directory.
Jon Pinkley
Honored Contributor

Re: How to find the command line of a process

While not addressing your specific question about the command lines, I will recommend Brian (VAXman) Schenkenberger's SYMBOL program as a useful "DCL Debugging and troubleshooting" tool. It will allow you to see all the DCL symbols in a process, including global (==) and all 32 levels of DCL local symbols. And it works for any process you have rights to view in the cluster.

In addition, you can set symbols in another process. And you can see the DCL procedures being executed at each level.

It isn't a debugger in the sense that you can trace or see the flow of execution, but being able to see the "call stack" of the DCL procedures is useful if you are attempting to determine what called or @ a command procedure, since DCL only keeps one open at at time (DCL was designed when memory was scarce).

Symbol 5.2 is a free, (no source) download from his site,

http://www.tmesis.com/

Go to the products page, Symbol is at the top. You will have to register and request a PAK for installation, which will be emailed to you.
it depends
Dean McGorrill
Valued Contributor

Re: How to find the command line of a process

tx jim, I'm prolly being a block head, but
I can't get it to work, not sure what
volker meant by 'prc', I tried the pcb,
this is the phd..

SDA> def wrk=@(8683A000+prc_l_curwrk)
SDA> exam WRK_G_BUFFER
%SDA-E-NOTINPHYS, FFFFFFFF.FFFFF288 : virtual data not in physical memory
SDA> exam wrk
%SDA-W-UNALIGNED, unaligned address 00000000.0026E001; converting to aligned add
ress
00000000.0026E000: 00000000 "...."
SDA> exam 0026E000
00000000.0026E000: 00000000.00000000 "........"

it looks like a nice way to see what command
was issued on a hung process.
Volker Halle
Honored Contributor

Re: How to find the command line of a process

Dean,

please read the article posted above and then use:

SDA> def wrk=@(prc+prc_l_curwrk)

instead of

SDA> DEFINE WRK=PRC+PRC_L_SAVFP

when trying to acces the DCL work area on recent versions of OpenVMS.

Volker.
Joseph Huber_1
Honored Contributor

Re: How to find the command line of a process

In addition, Hunters GETCMD program
( http://vms.process.com/scripts/fileserv/fileserv.com?GETCMD and on the Freeware CD) seems to have the necessary code to access own and other processes recall buffers.

http://www.mpp.mpg.de/~huber
Wim Van den Wyngaert
Honored Contributor

Re: How to find the command line of a process

Joseph,

That's the same as CLUE is giving. Thus only for interactive processes.

Wim
Wim