• The Four Hundred
  • Subscribe
  • Media Kit
  • Contributors
  • About Us
  • Contact
Menu
  • The Four Hundred
  • Subscribe
  • Media Kit
  • Contributors
  • About Us
  • Contact
  • Guru: How To Override Query Options

    May 21, 2018 Ted Holt

    QAQQINI is a physical file with which you can control certain behaviors of the DB2 for i query engine. For a list of the query options that you can change, visit the IBM Knowledge Center. Normally you don’t have to use it, as the engineers of IBM have done a great job designing an optimizer that does a great job.

    At times you may want to change a query attribute for a certain job. There is no need to build many QAQQINI files to handle all possibilities. Instead, you can temporarily override query attributes within a job. DB2 for i provides the OVERRIDE_QAQQINI stored procedure for this purpose.

    I can best illustrate with an example. Here’s some code that Scott Forstie of IBM shared with me. Imagine this as part of in an SQL PL stored procedure.

     call qsys2.override_qaqqini(1, '', '');
     call qsys2.override_qaqqini(2,
        'PREVENT_ADDITIONAL_CONFLICTING_LOCKS', '*YES');
     LOCK TABLE TOYSTORE.SALES IN EXCLUSIVE MODE ALLOW READ;
    ( . . . do something with the SALES table here . . . )
    
    call qsys2.override_qaqqini(3, '', '');
    -- Deallocate the lock
    call qsys2.qcmdexc('DLCOBJ OBJ((TOYSTORE/SALES *FILE *EXCLRD *FIRST))');
    

    What does this mean? OVERRIDE_QAQQINI has three parameters. The first tells which action to take.

    • Use option 1 to create a temporary override file in QTEMP. This is obviously the first step.
    • Use option 2 to specify a value for one of the query options. This example has only one call with option 2, but there’s no reason you can’t have more.
    • Use option 3 to delete the temporary file.

    The default value of PREVENT_ADDITIONAL_CONFLICTING_LOCKS is *NO, which means that the system may allow other jobs access to a file in spite of the LOCK TABLE command. In this example, overriding restricts the access that other jobs have to the SALES table.

    In many shops, it is sufficient to create QAQQINI with appropriate values in library QUSRSYS. Thanks to OVERRIDE_QAQQINI, that one file does it all.

    RELATED STORIES

    QAQQINI Query Options

    OVERRIDE_QAQQINI procedure

    Fair lock option – PREVENT_ADDITIONAL_CONFLICTING_LOCKS

    Share this:

    • Share on Reddit (Opens in new window) Reddit
    • Share on Facebook (Opens in new window) Facebook
    • Share on LinkedIn (Opens in new window) LinkedIn
    • Share on X (Opens in new window) X
    • Email a link to a friend (Opens in new window) Email

    Tags: Tags: DB2 for i, FHG, Four Hundred Guru, IBM i, QAQQINI

    Sponsored by
    ARCAD Software

    [IBM i Auditing Tool] Discover the Health of Your IBM i Applications in Minutes with ARCAD iCheck-up

    How well do you really know the health of your IBM i applications? Hidden complexity, unused code, and synchronization issues can make maintenance more challenging and slow down modernization efforts.

    What if you could identify these issues in just a few clicks, without installing anything on your IBM i system?

    Meet ARCAD iCheck-up, an auditing tool designed to give IBM i teams a clear, actionable overview of their applications in minutes.

    With iCheck-up, you can:

    • Assess code complexity: Identify complex source files and prioritize refactoring efforts.
    • Detect dead code: Uncover unused code that may be cluttering your applications.
    • Spot synchronization issues: Identify inconsistencies between source files and compiled objects.
    • Track code changes: Explore modification history and better understand your application’s evolution.
    • Generate a shareable report: Get a comprehensive, easy-to-read HTML report with key metrics and insights.

    Fast, simple, and secure. iCheck-up runs from Windows, requires no installation on your IBM i system, and leaves no files or code behind. Your generated report contains metrics only, keeping your source code confidential.

    Whether you’re maintaining existing applications, planning modernization, or looking to improve code quality, iCheck-up helps you make more informed decisions.

    Ready to gain deeper insights into your IBM i applications? Discover ARCAD iCheck-up and take the first step toward better code quality today!

    Share this:

    • Share on Reddit (Opens in new window) Reddit
    • Share on Facebook (Opens in new window) Facebook
    • Share on LinkedIn (Opens in new window) LinkedIn
    • Share on X (Opens in new window) X
    • Email a link to a friend (Opens in new window) Email

    Big Blue Gives IBM i Shops A Special 30th Birthday Bash Box Past And Future Collide At PowerUp 18

    Leave a ReplyCancel reply

TFH Volume: 28 Issue: 37

This Issue Sponsored By

  • Fresche Solutions
  • UCG TECHNOLOGIES
  • Software Concepts
  • MiTEC 2018
  • LUG

Table of Contents

  • Syncsort Acquires Townsend’s IBM i Encryption Software
  • Past And Future Collide At PowerUp 18
  • Guru: How To Override Query Options
  • Big Blue Gives IBM i Shops A Special 30th Birthday Bash Box
  • Inside IBM’s SAP HANA On Power Playbook

Content archive

  • The Four Hundred
  • Four Hundred Stuff
  • Four Hundred Guru

Recent Posts

  • Bob Code Assistant Gets Better Understanding Of IBM i Applications
  • IBM i In The Cloud And The Case For Reversing Replication
  • Guru: From Hiking Boots To Long-Term Memory
  • Inside IBM’s New PowerHA Cloud Offering, Full System Manager
  • IBM i PTF Guide, Volume 28, Number 39
  • Power Systems Turns In Another Great Quarter
  • Big Blue Is Right On Schedule With Fall 2026 IBM i Tech Refreshes
  • Guru: Environment Variables – Global Variables Wearing Hiking Boots
  • A New IBM i Entity Takes Shape: Power By Fortra
  • IBM i PTF Guide, Volume 28, Number 38

Subscribe

To get news from IT Jungle sent to your inbox every week, subscribe to our newsletter.

Pages

  • About Us
  • Contact
  • Contributors
  • Four Hundred Monitor
  • IBM i PTF Guide
  • Media Kit
  • Subscribe

Search

Copyright © 2025 IT Jungle