Today, I will present the final pieces of the puzzle that is the User Query Attribute command suite. In previous issues of this newsletter, I have provided the following User Query Attribute commands:
- Add User Query Attributes (ADDUSRQRYA)
- Change User Query Attributes (CHGUSRQRYA)
- Remove User Query Attributes (RMVUSRQRYA)
- Work with User Query Attributes (WRKUSRQRYA)
Using the above commands, you can store, change, remove, and work with query attributes for specific user profiles. As you might recall, the user query attributes include a “Query interactive time limit” and a “Query options file library,” as well as an option to temporarily allow interactive queries to be run, irrespective of the estimated run time. Now it is time to put the user query attributes themselves to work.
To do so, I’ve created the Set User Query Attributes (SETUSRQRYA) command. The SETUSRQRYA command runs the Change Query Attribute (CHGQRYA) command for the current job specifying the two aforementioned query attributes if the current job is an interactive job, and the “Query option file library” if the current job is a batch job.
The CHGQRYA command requires *JOBCTL special authority to run, and for this reason the SETUSRQRYA command processing program (CPP) adopts user profile QSECOFR authority. If you prefer another user profile to provide the necessary *JOBCTL special authority, you can just change the CPP ownership.
The obvious challenge related to running the SETUSRQRYA command is to ensure that it is run at job initiation time in order for the query attributes to be applied before any query or SQL activity can be performed in the current job. For interactive jobs, one option is to use the user profile’s initial program. Using a subsystem routing entry program is another option. Routing entry programs are run as the first routing step in the job initiation process.