Wednesday, November 25, 2026

Using a SQL Table Function to display server authority for just one user

Have you have upgraded your connections between systems from using the default SNA communication protocol to IP?

In a previous post I wrote about using the Add Server Authority Entry command, ADDSVRAUTE, to map user profiles on the local system to one on the remote for DDM files.

If you are using SQL to communicate between partitions, with the three-part name, your systems will use the Relational Database Directory Entries, RDBE, for the configuration between system, and that should be using IP connections too.

How can I tell who has server authority entries?

I could use the Display Server Authority Entries command, DSPSVRAUTE, but that can only be run for one user profile at a time and the output is limited to display or print:

                   Display Server Auth Entries (DSPSVRAUTE)

Type choices, press Enter.

User profile . . . . . . . . > SIMON       Name, *CURRENT
Output . . . . . . . . . . . > *           *, *PRINT

A better way would be to use the DRDA_AUTHENTICATION_ENTRY_INFO View. If I wanted the information for just one user I could get the information from the View, if there was a Table Function, I could get it quicker.

Fortunately there is one, USER_DRDA_AUTHENTICATION_ENTRIES, which will return all of the server authority entries for one user. This is found in the library SYSTOOLS. It has one parameter, the user profile on the local system:

01  SELECT * 
02    FROM TABLE(SYSTOOLS.USER_DRDA_AUTHENTICATION_ENTRIES(
03                 USER_NAME => 'SIMON')
04              )

Line 3: As there is only one parameter when I use this Table Function I do not give the parameter name, USER_NAME, just the value:

01  SELECT * 
02    FROM TABLE(SYSTOOLS.USER_DRDA_AUTHENTICATION_ENTRIES('SIMON'))

The results are:

AUTHORIZATION   AUTHORIZATION   SERVER    AUTHORIZATION   PASSWORD
_SOURCE         _NAME           _NAME     _NAME           _STORED
-------------   -------------   -------   -------------   ----------
USER            SIMON           SYSTEM1   PRODSIMON       YES
USER            SIMON           SYSTEM2   SIMONPROD       NO
USER            SIMON           SYSTEM3   SIMON           YES
USER            SIMON           SYSTEM4   SIMON           YES

The only column of the results I feel needs explanation is the first, AUTHORIZATION_SOURCE, it contains one of three values:

  • USER:  From the user profile
  • GROUP:  From a group profile that the user belongs to
  • SUPPLEMENTAL GROUP:  From the user profile's supplemental groups

If I wanted to check if a user on the local system had an entry for a remote I could RPG program like this:

01  **free
02  dcl-s UserProfile char(10) ;
03  dcl-s Server char(10) ;
04  dcl-s Found ind ;

05  UserProfile = 'PRODSIMON' ;
06  Server = 'SYSTEM1' ;
07  Found = *off ;

08  exec sql SELECT '1' INTO :Found
09             FROM TABLE(SYSTOOLS.USER_DRDA_AUTHENTICATION_ENTRIES(:UserProfile))
10            WHERE SERVER_NAME = :Server
11            LIMIT 1 ;

12  dsply ('Was this found? ' + Found) ;

13  *inlr = *on ;

Lines 2 – 4: Declaring the variables I am going to use in this program. I am going to need the user's profile, the name of the remote system, and an indicator work variable that will be used to show if the information was found.

Lines 5 – 7: Populate the variables with values that will be used in the SQL statement.

Lines 8: If a row for the user profile and server is found the indicator Found will be changed to *ON.

Line 9: USER_DRDA_AUTHENTICATION_ENTRIES is called passing to it the user profile in the variable of the same name.

Line 10: Only select results for the server in SERVER.

Line 11: Only the first result for the matching user and system is will be returned.

Line 12: Then the result is displayed.

After creating the program, I called it, and was presented with the following:

 DSPLY  Was this found? 1

The value of "1" indicates that an entry for this user profile was found.

 

You can learn more about the USER_DRDA_AUTHENTICATION_ENTRIES SQL Table Function from the IBM website here.

 

This article was written for IBM i 7.6, and should work for some earlier releases too.

No comments:

Post a Comment

To prevent "comment spam" all comments are moderated.
Learn about this website's comments policy here.

Some people have reported that they cannot post a comment using certain computers and browsers. If this is you feel free to use the Contact Form to send me the comment and I will post it for you, please include the title of the post so I know which one to post the comment to.