Adopting authority on IBM i, iSeries and AS400 can be a very dangerous thing, but if its implemented properly its really quite cool. #discuss 😉
Adopting Authority on IBM i
Question: Is there an easy way of finding all programs in all user libraries that use adopted authority? The DSPPGM command doesn’t allow for *ALL and worse, doesn’t output to a file.
Answer 1. Yes and no. The DSPPGMADP can show programs that adopt a specific user profile, as in compiled *OWNER and can put it to a file. Otherwise, its into the APIs for you. Check on QCLRPGMI, retreive program information. The PGMI0100 format has the information that you are looking for. Of course, it isn’t a file, but because it uses a receiver variable, you could code this in a CL program.
Answer 2. You can’t do it by library, but you can do it by user profile. The PRTADPOBJ command allows you to single out a particular user, or specify *ALL users. Unfortunately, the PRTADPOBJ *ALL option prints all of the IBM user profiles as well as the all of your users.
But with a little CL like the one below, you can do the PRTADPOBJ on only the user profiles that you care about. You just have to create the file called USRPRFS in advance and populate it with the names of the profiles that you want to run the report on….
PGM Dclf USRPRFS ReadLoop: RCVF MONMSG CPF0864 EXEC( RETURN ) PRTADPOBJ USRPRF( &USRPRF ) GOTO ReadLoop ENDPGM