This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- Subject: DBE in a box | |
-- Author: Scott Forstie | |
-- Date : August, 2023 | |
-- Features Used : This Gist uses SQL PL, qsys2.SYSTEM_STATUS_INFO_basic, systools.lprintf, qsys2.sysixadv, qsys2.sysindexes, QSYS2.SYSINDEXSTAT, SYSTOOLS.ACT_ON_INDEX_ADVICE, QSYS2.RESET_TABLE_INDEX_STATISTICS and SYSTOOLS.REMOVE_INDEXES | |
-- | |
-- Note: | |
-- 1) Indexes are not free, and care should be taken when deciding whether an index is worth creating | |
-- 2) Indexes are not free, and care should be taken to understand whether adequate system resources are available before creating additional indexes | |
-- 3) Indexes are not free, and care should be taken to establish a well trained Database Engineer (DBE) responsible for your IBM i partitions | |
-- |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- Subject: Using initAuto to find uninitialized variable problems in ILE code | |
-- Author: Scott Forstie | |
-- Date : June, 2023 | |
-- Features Used : This Gist uses SQL PL, INCLUDE, Change Program (CHGPGM) CL command, qsys2.joblog_info, qsys2.program_info, qsys2.qcmdexc, and QSYS2.BOUND_MODULE_INFO | |
-- | |
-- A) Programmers use declared variables and structures to facilitate program logic. | |
-- B) Programmers should always initialize or assign declared variables and structures to contain known and expected values. | |
-- C) Programmers sometime miss step B. | |
-- | |
-- This Gist shows how the IBM i Optimizing Translator can help. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- Subject: PTF Cover Letters | |
-- Author: Scott Forstie | |
-- Date : April, 2023 | |
-- Features Used : This Gist uses qsys2.ptf_info, SQL Alias, ltrim, rtrim(), dynamic SQL, SQL PL, PIPE | |
-- | |
-- Note: | |
-- 1) Whether PTF Cover Letters exist on your IBM i is up to whomever ordered the PTFs | |
-- Use the Copy PTF Cover Letter (CPYPTFCVR) command to bring in PTF cover letters | |
-- https://www.ibm.com/docs/en/i/7.5?topic=ssw_ibm_i_75/cl/cpyptfcvr.html | |
-- 2) The file QGPL/QAPZCOVER *FILE contains one member for each PTF Cover Letter |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- | |
-- Subject: The request... return SQL services detail using JSON. | |
-- Author: Scott Forstie | |
-- Date : April, 2023 | |
-- Features Used : This Gist uses qsys2.syscolumns2, listagg(), rtrim(), dynamic SQL, SQL PL, PIPE | |
-- | |
-- Note: | |
-- When someone asks you to return Db2 for i data "as JSON", they probably want you | |
-- to publish a JSON document, which contains good key names and of course, the data. | |
-- |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- | |
-- Subject: Query Supervisor - Holding a job | |
-- Author: Scott Forstie | |
-- Date : April, 2023 | |
-- Features Used : This Gist uses qsys2.query_supervisor, qsys2.EXIT_PROGRAM_INFO, aliases, qsys2.qcmdexc, qsys2.ADD_QUERY_THRESHOLD, qsys2.REMOVE_QUERY_THRESHOLD, qsys2.joblog_info, and QSYS2.ACTIVE_JOB_INFO | |
-- | |
-- Notes: | |
-- =============================================== | |
-- 1) Query Supervisor (QS) exists in IBM i 7.3 and higher | |
-- (SF99703 Level 24, SF99704 Level 13, SF99950 <any>) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- | |
-- Subject: Decimal column checker upper | |
-- Author: Scott Forstie | |
-- Date : March, 2023 | |
-- Features Used : This Gist uses qsys2.syscolumns2, qsys2.object_statistics, RPAD, COALESCE, and SQL PL | |
-- | |
-- Notes: | |
-- =============================================== | |
-- 1) This example can help find those columns which rely upon ever increasing values | |
-- 2) The examples could be revised to study other numeric columns, or ever descending values |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- | |
-- Subject: Undocumented IBM i Services UDTFs | |
-- Author: Scott Forstie | |
-- Date : March, 2023 | |
-- Features Used : This Gist uses undocumented UDTFs for IBM i (SQL) Services | |
-- | |
-- Notes: | |
-- =============================================== | |
-- 1) IBM i (SQL) Services frequently have SQL Views, which are documented here: | |
-- https://www.ibm.com/docs/en/i/7.5?topic=optimization-i-services |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- | |
-- Subject: Audit Journal Management | |
-- Author: Scott Forstie | |
-- Date : March, 2023 | |
-- Features Used : This Gist uses qsys2.security_info, qsys2.journal_info, qsys2.object_statistics, qsys2.qcmdexc, CTEs, sysibmadm.env_sys_info, and SYSTOOLS.split | |
-- | |
-- Notes: | |
-- =============================================== | |
-- 1) There are many configuration options to consider using when establishing the Audit Journal, this Gist uses SQL to examine some of the most important choices. | |
-- 2) Its important to have a retention strategy for audit journal - journal receivers |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- | |
-- Subject: Bringing ORDER to a VIEW | |
-- Author: Scott Forstie | |
-- Date : February, 2023 | |
-- Features Used : This Gist uses UDTFs, SQL DDL, PIPE, SQL PL, SQL global variables | |
-- | |
-- Notes: | |
-- =============================================== | |
-- The SQL Standard dictates that the ORDER BY clause cannot be | |
-- includes in the CREATE VIEW defintion. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- | |
-- Subject: Are we running with *PGMs or *SRVPGMs that reside within QRPLOBJ? | |
-- Author: Scott Forstie | |
-- Date : February, 2023 | |
-- Features Used : This Gist uses qsys2.stack_info, CTEs, PIPE, SQL PL | |
-- | |
-- Notes: | |
-- =============================================== | |
-- 1) Programs and Serice Programs get moved to QRPLOBJ when they are (re)created with replace(*YES). | |
-- 2) It is not safe to delete *PGMs or *SRVPGMs from QRPLOBJ, if you base your decision upon locks. |