I wasn't familiar with PRTPVTAUT but I read the help text and it states that it will not only print a report of the current authorities to the object(s), but also it will print another report which lists the authority changes that have been made to that object since the prior run of the report, and a third report listing authorities that were deleted since the last run.
If it were me, I'd use QSYS2.OBJECT_PRIVILEGES to select the current authorities, wrap it up with an INSERT INTO, and add "current timestamp" as the first field. That way you could check what the authorities looked like at any particular time that your SQL had taken a "snapshot". You could compare the last 2 runs, or the current authority against last year, or whatever you wanted.
Something like the below (btw if this is audit related you could journal changes to the "OBJAUT" file and make sure nobody is messing with it):
--for the first time, to initially create the table to store your output
CREATE TABLE DATALIB.OBJAUT AS (
SELECT CURRENT TIMESTAMP AS OBJAUT_TIMESTAMP, A.*
FROM QSYS2.OBJECT_PRIVILEGES A
WHERE SYSTEM_OBJECT_SCHEMA = 'TARGETLIB'
AND SYSTEM_OBJECT_NAME = 'TARGETOBJ'
AND OBJECT_TYPE = '*CMD') WITH DATA;
--for each subsequent run (daily, weekly, whatever)
INSERT INTO DATALIB.OBJAUT (
SELECT CURRENT TIMESTAMP AS OBJAUT_TIMESTAMP, A.*
FROM QSYS2.OBJECT_PRIVILEGES A
WHERE SYSTEM_OBJECT_SCHEMA = 'TARGETLIB'
AND SYSTEM_OBJECT_NAME = 'TARGETOBJ'
AND OBJECT_TYPE = '*CMD');
------------------------------
Steven Riedmueller
Certified IBM i Admin
Speaker, Mentor, and Advocate
------------------------------
Original Message:
Sent: Thu December 21, 2023 05:42 PM
From: David Taylor
Subject: PRTPRVAUT To *OUTFILE
Thanks for the input. The more we look at the report, there must be more than just the current state. I am leaning toward using SQL to extract the data from the report to be able to work with the data over time.
------------------------------
David Taylor
Sr Application Developer
Range Resources
Fort Worth TX
Original Message:
Sent: Wed December 20, 2023 10:12 AM
From: David Taylor
Subject: PRTPRVAUT To *OUTFILE
I know someone else has solved this. Our security staff uses the report from PRTPRVAUT as part of their year-end wrap up. There is no option on the command that I have found to have the output to a database. Sure, I can write a program to parse the report to a data file, but where is the fun in that if this horse has been tamed already.
------------------------------
David Taylor
Sr Application Developer
Range Resources
Fort Worth TX
------------------------------