Operating System - OpenVMS
1820979 Members
4339 Online
109630 Solutions
New Discussion юеВ

Re: How to identify a process running in group table.

 
SOLVED
Go to solution
Ragavendran_1
Occasional Advisor

How to identify a process running in group table.

Hi All,

I have one question in checkinig the status of the logical.

When i am executing a program(C) i need to check whether a particular logical is defined with a value by any other system on the same network.

Program A at terminal TNA17:
logical created STATION_TNA17_CMD value "XX"

Program B at terminal TNA18:
logical created STATION_TNA17_CMD Value "SERVER"

My program C:
- need to identify whether any logical STATION_XXXX_CMD is assign with value "XX"

i think my above question is clear, please let me know if you need more information.

Thanks in Advance,

Regards,
Ragav
15 REPLIES 15
Wim Van den Wyngaert
Honored Contributor

Re: How to identify a process running in group table.

Not clear to me.

"running in a group table" : process do not run in group tables.

tna8 has a tna17 logical ?

"other system on the same network" : do you mean a VMS server or a PC (and all pc's have the same server ?).

Wim
Wim
Joseph Huber_1
Honored Contributor
Solution

Re: How to identify a process running in group table.

Trying to interpret:
Several processes running on several networked VMS systems in the same UIC group define a group logical name of the form STATION_*_CMD, and Your process wants to scan all of them to find the ones with a certain value.
Can be done in DCL observing following remarks:

(1) group logicals are not visible across nodes , so You have to execute the program/procedure on each node by some remote command execution (I think we had that theme discussed lately here), and gather their results.

(2) The lexical function f$trnlnm does not handle wild-cards like STATION_*_CMD as the target; only "SHOW LOGICAL/GROUP STATION_*_CMD" does it, so somehow the output of that command has to be analyzed to get the result.

(3) If the * in logical names are not random, but restricted to real TNAn device names, then SHOW LOGICAL output scanning can be avoided, and a loop doing a TNA device scan followed by a f$trnlnm() for this particular STATION_TNAx_CMD can be done.
http://www.mpp.mpg.de/~huber
Jan van den Ende
Honored Contributor

Re: How to identify a process running in group table.

Ragav,

first question: Are those stations in (the same) cluster? That would make things A LOT easier!

Second question: Are you able to influence the way the LNMS are getting defined?

Third; is the "XX" in your question literally two X's or does it represent any 2-character string?

The answers will be decisive for the road to a solution.

Proost.

Have one on me.

jpe
Don't rust yours pelled jacker to fine doll missed aches.
Ragavendran_1
Occasional Advisor

Re: How to identify a process running in group table.

Joseph,

Your understanding is exactly what i wanna know.

My system architecture is like one alpha server will have a max of 8 nodes connected to it and when any one of the nodes starts a process called XX.COM, then a logical STATION_TNA17_CMD logical will be created with the current running process
identifier "XX" (XX here is mean is a 2 character).

When i execute a COM file in any one of the 8 node, then i should check for the rest of the node's process by means of the logical STATION_XXXX_CMD with "XX" or "YYYY" or "ZZZZ". Basically this logical is defined in the GORUP table.

Remark (1): yes i agree and am trying to create a com procedure.
Remark (2): Yes i tried using the wild card as you mention and not work out for me.
Remark (3): Sorry, i am not sure whether my live systems have the terminal name like TNAn, i gave as an example.
this is a random across my server (my program should work in different alpha server, which may have diffrent terminal names)


JPE,

First Question : Yes since all the nodes are connected to the same Alpha server.
Second Question: am not getting what you are asking me to try.
Third Question : XX is a 2character string. not only 2 character it depends on processes.


Wim,

Sorry for my bad explanation and the topic name. That misleads my questions.
I think now you can understand my requirement.


i have found a small solution but suggest me if it is fine:

$ sh log/group station*
$ status = $status
$ if (.not. status)
$ then
$ "No process is running"
$ else
$ "Found one process"
$ endif

the above code can find any logicalis present or not in the group table...

My question is: is there any way to identify the list of logicals and its value by writing a COM file.

Thanks,

Regards
Ragav.
Joseph Huber_1
Honored Contributor

Re: How to identify a process running in group table.

If the logicals are define as STATION_term_CMD, then a loop like this will find them:

$ node=f$getsyi("NODENAME")
$ loop:
$ device=F$DEVICE("_''node'$*","TERM")
$ if device.eqs."" then exit
$ unit=device - f$getdvi(device,"HOST_NAME") - "_" -"$" - ":"
$ lnam = "STATION_"+unit+"_CMD"
$ write sys$output lnam," has value ",f$trnlnm(lnam,"LNM$GROUP")
$ goto loop

This works on clustered systems, where terminal devices have the name _node$ddcu:
I can't test on standalone systems, maybe You have to change the wild-card device name in the f$device call.
http://www.mpp.mpg.de/~huber
Joseph Huber_1
Honored Contributor

Re: How to identify a process running in group table.

Ragan, in addition could You tell us a bit more what You try to accomplish:
My above procedure does formally get those logicals.
But You are talking about identifying processes ?
A logical does not tell its creator. If part of the logical is the creators terminal name, then the process can be found using the terminals "owner" process.
But a much more straight forward way would be to set the process name to something like STATION_CMD_CLIENT_term or STATION_CMD_SERVER_term or STATION_CMD_XX_term or similar.

Then a cluster-wide process scan can find all those processes, without executing remote procedures.
http://www.mpp.mpg.de/~huber
Jan van den Ende
Honored Contributor

Re: How to identify a process running in group table.

Ragav,

so all stations and the server are part of ONE cluster. Nice.

Your program A
>>>
logical created STATION_TNA17_CMD value "XX"
<<<

Do you have control over program A?

if YES, then
create the logical name not in GROUP table, but in LNM$SYSCLUSTER_TABLE
(oops, forgot to ask your VMS version. This DOES require at least VMS 7.2)

if NO; then after Program A runs, add one line of DCL code:

$ DEFINE /table=lnm$syscluster_table STATION_TNA17_CMD 'f$trnlnm("STATION_TNA17_CMD")'
-- Effectively: duplicate the GROUP logical name in the cluster table.

-- for easy retrival, I would add an extra set of logicals in that table:

$ DEFINE /table=lnm$syscluster_table STATION_'f$getsyi("nodename")'_CMD 'XXXX'_'XX'
( XXXX is the relevant TNA; XX is the 2 chars)

Now you have ONE logical to query to get each node's relevant TNA (or whatever) and its assigned value of XX.

(P.S. if you are on a lower version of VMS, the seriously consider upgrading. If that is impossible, things were more complex back then, but I have done them before.)

hth

Proost.

Have one on me.

jpe
Don't rust yours pelled jacker to fine doll missed aches.
Jon Pinkley
Honored Contributor

Re: How to identify a process running in group table.

Ragav,

Please provide the result of executing the following command, just so we can be sure we are discussing the same thing when we use the term "cluster".

$ write sys$output f$getsyi("CLUSTER_NODES")

Also, please tell us a bit more what You try to accomplish, as Joseph asked.

My guess is that there is a more appropriate solution than logical names. I am thinking the lock manager would be a better fit (given that you are trying to determine if another process already is using something).

Jon
it depends
Ragavendran_1
Occasional Advisor

Re: How to identify a process running in group table.

Joseph,

Am not worried about the process which is running. I need to get all the logicals and its corresponding values.
I dont know the how the node name would be, i basically specify the IP address of the node.

The output i got from the command is 0 (zero)
$ write sys$output f$getsyi("CLUSTER_NODES")

jpe,

The solution am looking for is to check all the logicals created in GROUP table not in creating a logicals.

Thanks
Regards,
ragav
Joseph Huber_1
Honored Contributor

Re: How to identify a process running in group table.

So the systems are standalone, not members of a VMS-cluster. This means the program gathering the logical names must run on each of the nodes participating, and gathered together as I have written previously.

Node names:
A procedure executing ON the node gets it via f$getsyi("NODENAME") (or the underlying sys$getsyi() RTL call).
Somehow Your application must have a list of the nodes in question, even if they have no name (DNS entry), it can be a list of IP addresses, but why can't You give them names in a local hosts file ? And at best give them names identical to the VMS node names.
http://www.mpp.mpg.de/~huber
Jon Pinkley
Honored Contributor

Re: How to identify a process running in group table.

RE:"The solution am looking for is to check all the logicals created in GROUP table not in creating a logicals."

The Group table on the "central" node, or the group tables on all the up to 8 systems that are connecting to the central computer.

Why can't you answer what you are trying to accomplish? Why does program C need to identify whether any logical STATION_XXXX_CMD is assign with value "XX"

Answering the question you are asking probably won't solve the real problem.

Jon
it depends
Jan van den Ende
Honored Contributor

Re: How to identify a process running in group table.

Ragav,

so, no cluster - forget about that table.

>>>
There are as many group tables as there are groups from which users have logged in since boot time. And potentially that can become a LARGE number (octal 37776, or decimal 16382)
Do you KNOW in WHICH group table to look for the logical?
Like Jon asked, tell us "what problem are you trying to solve", NOT what do you think may be the solution, but can not get implemented.

Proost.

Have one on me.

jpe
Don't rust yours pelled jacker to fine doll missed aches.
Jan van den Ende
Honored Contributor

Re: How to identify a process running in group table.


>>>
The solution am looking for is to check all the logicals created in GROUP table not in creating a logicals.
<<<

The idea is to add a "helper" logical which in one pass can tell you the info you are trying to find.

Proost.

Have one on me.

jpe
Don't rust yours pelled jacker to fine doll missed aches.
Joseph Huber_1
Honored Contributor

Re: How to identify a process running in group table.

With a variation of my procedure posted earlier, does it what You want ?

MPIW10_HUB>cat showstation.com
$ node=f$edit(f$getsyi("NODENAME"),"TRIM")
$ loop:
$ device=F$DEVICE("_''node'$*","TERM")
$ if device.eqs."" then exit
$ unit=device - f$getdvi(device,"HOST_NAME") - "_" -"$" - ":"
$ lnam = "STATION_"+unit+"_CMD"
$ value=f$trnlnm(lnam,"LNM$GROUP")
$ if value.nes."" then -
$ write sys$output node,":",lnam,":",value
$ goto loop

MPIW10_HUB>cat showstation_all.com
$ rsh mpiw10 @[.scratch]showstation
$ rsh mpiw12 @[.scratch]showstation

MPIW10_HUB>@showstation_all
MPIW10:STATION_FTA74_CMD:SERVER
MPIW12:STATION_FTA1_CMD:XX

where MPIW10,MPIW12 are the nodes where the logicals are defined,
and the assumption my userids are in the desired UIC group on all of the nodes.
(otherwise add the target UIC group as a parameter to the showstation command procedure, and replace table=LNM$GROUP by table=LNM$GROUP_'p1' ).
http://www.mpp.mpg.de/~huber
Ragavendran_1
Occasional Advisor

Re: How to identify a process running in group table.

Joseph,

Thanks for your valuable reply, i have followed your logic and got my solution.

In my system we have logical to identify the no. of terminals and the terminal names.

Terminal_cnt 8
terminal1 TXA1
terminal2 TXA2
.
.
terminal8 TXA8

so using this i got the device name like

$ NUM = 1
$ CHK_PROC:
$ TERM_CNT = F$TRNLNM( "TERMINAL_COUNT")
$ IF (TERM_CNT .LE 0) THEN GOTO END
$ DEV = F$TRNLNM( "TERMINAL''NUM'")
$ IF(DEV .EQS. "")THEN GOTO PROC_END
$ IF( .NOT. F$GETDVI(DEV,"EXISTS"))THEN GOTO PROC_END
$ DEV = F$GETDVI( DEV,"TT_PHYDEVNAM")
$ IF( DEV .EQS. "")THEN GOTO PROC_END
$ STA = "STATION"+(DEV - ":")+"_CMD"
$ CMD = F$TRNLNM( "''STA'",GRP_TBL)
$ IF (CMD .EQS "XX") THEN
$ -- DO MY JOB --
$ ENDIF
$ PROC_END:
$ NUM = NUM + 1
$ IF (NUM .LE. TERM_CNT) THEN GOTO CHK_PROC
$ END:
$ EXIT

WOO HOO.. I am bit new to Open VMS and DCL.
I never thought any forum available for this technology.. Great!! You Guys really doing great job.. Keep sending your valuable responses.

Regards,
Ragav.