[an error occurred while processing this directive]

HP OpenVMS Systems

Ask the Wizard
» 

HP OpenVMS Systems

OpenVMS information

» What's new on our site
» Upcoming events
» Configuration and buying assistance
» Send us your comments

HP OpenVMS systems

» OpenVMS software
» Supported Servers
» OpenVMS virtualization
» OpenVMS solutions and partners
» OpenVMS success stories
» OpenVMS service and support
» OpenVMS resources and information
» OpenVMS documentation
» Education and training

Quick Links

» Non-javascript page
» Ask the Wizard
» OpenVMS FAQ

Test Drive OpenVMS

» OpenVMS I64 test drive
» Java test drive

Other information resources available to you include:

» OpenVMS freeware
» ECO kits, software and hardware support, prior version support
» Alpha SRM, ARC, and AlphaBIOS firmware updates
» ENCOMPASS - HP user group
» OpenVMS software downloads, OpenVMS freeware CD-ROM
» OpenVMS firmware locations
» DECconnect passive adaptor charts
» Cables reference guide
» MicroVAX console commands
» OpenVMS student research

Select a topic below to see Questions Frequently Asked by partners

» Using the online documentation library(installing BNU from the asap SDK)
» Global sections(how to create and use.)
» xx$CREATE_BUFOBJ system service(usage)
» Ethernet address(methods of determination)
» Shareable images(cookbook approach to creating one)
» Sharing data/code at absolute addresses(a guide with examples)
» Determining the Alpha microprocessor
» Using GETSYI to get hardware status

Evolving business value

» Business Systems Evolution
» AlphaServer systems transition planning
» Alpha RetainTrust program

Related links

» HP Integrity servers
» HP Alpha systems
» HP storage
» HP software
» HP products and services
» HP solutions
» HP support
disaster proof
HP Integrity server animation
HP Integrity server animation
Content starts here

Ask the Wizard Questions

World and Group privilege for DCL lexicals

The Question is:

What privilege does one need to see a process by the way
of f$context() and f$pid()?  I can see it in the output of
"show system" as any user, but I can only see it by the
f$... way as the user who created the process.
Also, in 5.5-2h4 at least, I think there's a bug:
    if f$pid(...) .eqs. "" then ...
doesn't work, but
    var = f$pid(...)
    if var .eqs. "" then ...
does.
BTW, the process creator has almost all the privileges and
so I am not sure if the creator-ship mattered.


The Answer is:

   From DCL HELP (below) you require GROUP or WORLD privilege to have F$PID
   return a value for a process other than your own.

   SHOW SYSTEM is able to display the information because the image is
   installed with WORLD privilege.

>Also, in 5.5-2h4 at least, I think there's a bug:
>       if f$pid(...) .eqs. "" then ...
>   doesn't work, but
>       var = f$pid(...)
>       if var .eqs. "" then ...
>   does.

   Without an explanation of what you mean by "doesn't work" it's difficult
   to comment. However, my experiments show that the command:

   IF F$PID(context).EQS."" THEN

   does work as it should, but it's not very useful. Since the context
   variable is modified by the call, if the function were to return a
   non-null string, the value would be lost (since it was a temporary
   result used and discarded in evaluating the condition). Consider the
   following code:

   $ ctx=0
   $ ctx1=0
   $ loop: p=F$PID(ctx1)
   $ SHOW SYM p
   $ IF F$PID(ctx).EQS."" THEN EXIT
   $ GOTO loop

   Here I'm following 2 parallel F$PID streams using 2 contexts. The
   results will be the same for each stream. The output looks like:

     P = "20200122"
     P = "202000B9"
     P = "202000BE"
     P = "202000BF"
     P = "20200140"
     P = "202000C7"
     P = ""

   at which point the command procedure exitted, so the F$PID in the IF
   command must have worked correctly. If I had written:

   $ ctx=0
   $ loop: IF F$PID(ctx).EQS."" THEN EXIT
   $   SHOW PROCESS/PID='F$PID(ctx)'
   $ GOTO loop

   or similar, every second process in the list would be returned to the
   SHOW PROCESS command. If the "blank" case happened to fall on an even probe
   of F$PID, my SHOW PROCESS command would fail with a VALREQ error because
   F$PID would have returned a blank.

   So, this is not a bug. The commands are working as they should, it's
   just that your particular usage doesn't make a lot of sense.


   DCL HELP for F$PID

   $ HELP LEX F$PID CONTEXT

   Lexicals

     F$PID

       context-symbol

            Specifies a symbol that DCL uses to store a pointer into the
            system's list of processes. The F$PID function uses this pointer
            to return a PID.

            Specify the context symbol by using a symbol. The first time you
            use the F$PID function in a command procedure, you should use
            a symbol that is either undefined or equated to the null string
            (""), or a context symbol that has been created by the F$CONTEXT
            function.

            If the context symbol is undefined or equated to a null string,
            the F$PID function returns the first PID in the system's process
            list that it has the privilege to access. That is, if you have
            GROUP privilege and if the context symbol is null or undefined,
            the F$PID function returns the PID of the first process in your
            group. If you have WORLD privilege, the F$PID function returns the
            PID of the first process in the list. If you have neither GROUP
            nor WORLD privileges, the F$PID returns the first process that you
            own. Subsequent calls to F$PID return the rest of the processes on
            the system you are accessing.

            If the context symbol has been created by the F$CONTEXT function,
            the F$PID function returns the first process name in the system's
            process list that fits the criteria specified in the F$CONTEXT
            calls. Subsequent calls to F$PID return only the PIDs of those
            processses that meet the selection criteria set up by the
            F$CONTEXT function and that are accessible to your current
            privileges.