Operating System - OpenVMS
1752749 Members
4918 Online
108789 Solutions
New Discussion юеВ

Re: Fortran - $GETJPI/JPI$_RIGHTSLIST and SYS$IDTOASC

 
SOLVED
Go to solution
HDS
Frequent Advisor

Fortran - $GETJPI/JPI$_RIGHTSLIST and SYS$IDTOASC

Hello.

I am looking to use SYS$GETJPI's JPI$_RIGHTSLIST to obtain an array of rights identifiers held by the executing process, and then to display the ascii values of those identifiers using SYS$IDTOASC.

Unfortunately, I have been unable to get this to work in Fortran 77 or 90.

Would it be possible to get a Fortran code snippet that perform these two tasks? Any assistance will be greatly appreciated.

Many thanks.
7 REPLIES 7
Hoff
Honored Contributor
Solution

Re: Fortran - $GETJPI/JPI$_RIGHTSLIST and SYS$IDTOASC

Wander up to http://www.itrc.hp.com, and select the Search Assistant tool, and then enter the following in the James search box:

Fortran Examples sys$mumble

tailored for whichever system service(s) you are working with.

As it turns out, the first hit over there right now for "Fortran Examples sys$getjpiw" is this one:

http://h18000.www1.hp.com/support/asktima/appl_tools/00949F69-3F3075A0-1C0069.html

Which appears to be what you are looking for.

Stephen Hoffman
HoffmanLabs LLC
HDS
Frequent Advisor

Re: Fortran - $GETJPI/JPI$_RIGHTSLIST and SYS$IDTOASC

Thank you so very much !

-H-
Jim_McKinney
Honored Contributor

Re: Fortran - $GETJPI/JPI$_RIGHTSLIST and SYS$IDTOASC

Jon Pinkley
Honored Contributor

Re: Fortran - $GETJPI/JPI$_RIGHTSLIST and SYS$IDTOASC

If anyone needs the functionality provided by the example Jim referenced, it is much more efficient to convert the ASCII id passed to the function to its binary value with one call to $ASCTOID, and then compare that binary value to each binary id value in the array, instead of converting each binary value in the array to its ASCII form with $IDTOASC and then comparing the ASCII values. $IDTOASC and $ASCTOID are potentially expensive operations requiring I/O to the RIGHTSLIST file.

This is especially true it your process has many identifiers in its rightslist.

Even more efficient is a call to $CHECK_PRIVILEGE, which provides streamlined access to the executive routine EXE$SEARCH_RIGHTS_ARRAY, but even if you don't request auditing, the $CHECK_PRIVILEGE system service requires AUDIT privilege. When I complained to Compaq about that, I was told that not requiring AUDIT privilege would be a security violation, and when I pointed out that the same information was available via $GETJPI, they were not able to explain why it would be a security problem.
it depends
Hoff
Honored Contributor

Re: Fortran - $GETJPI/JPI$_RIGHTSLIST and SYS$IDTOASC

$CHECK_ACCESS and $CHKPRO, or simply trying the sequence (and you have to capture the errors that can arise in any case,), are my usual choices.

And as for requiring AUDIT, there's more to the $CHECK_PRIVILEGE call than there is to the $GETJPI call, and rolling your own bit test. What you might be doing and the user-visible portion can appear to be identical, but the back-end processing can and does differ. (You can't toss out audits without privilege, when last I looked. And the former tosses out audits. The latter approach does not, not unless you add those yourself.)
Jon Pinkley
Honored Contributor

Re: Fortran - $GETJPI/JPI$_RIGHTSLIST and SYS$IDTOASC

I thought these function modifiers used to be documented, but I see they are not in the current docs (at least since in the online docs since 7.3) NSA$M_NOSUCCAUD and NSA$M_NOFAILAUD

Here is the program I though should have been able to run without audit privilege.

(this is FORTRAN) (also attachec as text file)

options /extend_source
implicit none

include '($ssdef)/nolist' ! for system service status
include '($nsadef)/nolist' ! for NSA$M_IDENTIFIER

C Declare called functions

integer sys$asctoid
integer sys$check_privilege

integer id
integer status

status = sys$asctoid('INTERACTIVE',id,)

if (.not. status) call exit(status)

status = sys$check_privilege(,id,,%val(NSA$M_IDENTIFIER.or.NSA$M_NOSUCCAUD.or.NSA$M_NOFAILAUD),,,,)

call exit(status)
end
it depends
HDS
Frequent Advisor

Re: Fortran - $GETJPI/JPI$_RIGHTSLIST and SYS$IDTOASC

I wish to thank all of you for these informative responses.

-H-