To set the query time limit for the current job or user session using query options file QAQQINI, specify QRYOPTLIB parameter on the Change Query Attributes (CHGQRYA) command to a user library where the QAQQINI file exists with the parameter set to QUERY_TIME_LIMIT, and the value set to a valid query time limit.
To set the query time limit for 45 seconds you can use the following Change Query Attributes (CHGQRYA) command:
CHGQRYA JOB(*) QRYTIMLMT(45)
This sets the query time limit at 45 seconds. If the user runs a query with an estimated runtime equal to or less than 45 seconds, the query runs without interruption. The time limit remains in effect for the duration of the job or user session, or until the time limit is changed by the Change Query Attributes (CHGQRYA) command.
Assume that the query optimizer estimated the runtime for a query as 135 seconds. A message is sent to the user that stated that the estimated runtime of 135 seconds exceeds the query time limit of 45 seconds.
To set or change the query time limit for a job other than your current job, the Change Query Attributes (CHGQRYA) command is run using the JOB parameter. To set the query time limit to 45 seconds for job 123456/USERNAME/JOBNAME use the following Change Query Attributes (CHGQRYA) command:
CHGQRYA JOB(123456/USERNAME/JOBNAME) QRYTIMLMT(45)
This sets the query time limit at 45 seconds for job 123456/USERNAME/JOBNAME. If job 123456/USERNAME/JOBNAME tries to run a query with an estimated runtime equal to or less than 45 seconds the query runs without interruption. If the estimated runtime for the query is greater than 45 seconds, for example 50 seconds, a message is sent to the user stating that the estimated runtime of 50 seconds exceeds the query time limit of 45 seconds. The time limit remains in effect for the duration of job 123456/USERNAME/JOBNAME, or until the time limit for job 123456/USERNAME/JOBNAME is changed by the Change Query Attributes (CHGQRYA) command.
To set or change the query time limit to the QQRYTIMLMT system value, use the following Change Query Attributes (CHGQRYA) command:
CHGQRYA QRYTIMLMT(*SYSVAL)
The QQRYTIMLMT system value is used for duration of the job or user session, or until the time limit is changed by the Change Query Attributes (CHGQRYA) command. This is the default behavior for the Change Query Attributes (CHGQRYA) command.