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: QBATCH Job Analysis | |
-- Author: Scott Forstie | |
-- Date : May 30, 2021 | |
-- Note : This Gist leverages different built-in functions and grouping support to explore job history | |
-- | |
-- ================================================================================================ | |
-- | |
-- description: 20 Jobs that ran (started and ended) the longest in QBATCH over the last 24 hours |
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
create table toystore.employee_deetz ( | |
Company_Id bigint, | |
Employee_Id bigint, | |
FirstName varchar(100) for sbcs data, | |
SurName varchar(100) for sbcs data, | |
Employed_Start_Date date, | |
Employed_End_Date date); | |
insert into toystore.employee_deetz values | |
(101, 10001, 'Scott', 'Forstie', '07/11/1989', NULL); |
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
-- | |
-- If you're not ready to use IFS_OBJECT_PRIVILEGES, this might help you... | |
-- Note: A special thanks to Sue Romano for her help with this Gist | |
-- | |
-- https://www.ibm.com/docs/en/i/7.4?topic=services-ifs-object-privileges-table-function | |
cl:PRTPVTAUT OBJTYPE(*STMF) DIR('/') SCHSUBDIR(*YES); | |
-- | |
-- create an alias over the most recent execution of PRTPRVAUT |
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
-- | |
-- Collection Services data file: QAPMJOBL (JOB PERFORMANCE DATA) | |
-- | |
-- Resource: | |
-- https://www.ibm.com/docs/en/i/7.4?topic=data-collection-services-files-qapmjobs-qapmjobl | |
-- | |
-- | |
-- Raw | |
-- |
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
-- Assumption... the connection is setup to use COMMIT(*CHG) | |
-- ========================================================================= | |
-- | |
-- By default, SQL Data Definition Language (DDL) cannot use WITH NC | |
-- | |
-- ========================================================================= | |
CREATE TABLE QTEMP.T035 (FLD1 CHARACTER (9) CCSID 37 NOT NULL DEFAULT '', | |
FLD2 CHARACTER (30) CCSID 37 NOT NULL DEFAULT '', |
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
-- | |
-- I was asked how to incorporate row level auditing detail into tables. | |
-- While Temporal tables with Generated columns is a powerful combination, | |
-- the following example demonstrates a different approach. | |
-- | |
-- One fun aspect about the solution is the use of INCLUDE SQL on the triggers... | |
-- | |
-------------------------------------------------------------------------------------------------- | |
-------------------------------------------------------------------------------------------------- |
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
-- | |
-- When an IFS directory includes W (write), you are exposed to malware attacks | |
-- Use this to review and overcome this topic for the all important ROOT directory | |
-- | |
-- For help on this or related security topics, contact Robert and team... | |
-- http://ibm.biz/IBMiSecurity | |
-- Robert Andrews - [email protected] | |
-- | |
stop; |
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
-- | |
-- Use NAMING(*SYS) - system naming mode to leverage the power of the library list | |
-- | |
cl: crtlib lib1; | |
cl: crtlib lib3; | |
cl: crtlib lib2; | |
cl:CRTDUPOBJ OBJ(QSQPTABL) FROMLIB(QSYS2) OBJTYPE(*FILE) TOLIB(LIB1) DATA(*YES); | |
cl:CRTDUPOBJ OBJ(QSQPTABL) FROMLIB(QSYS2) OBJTYPE(*FILE) TOLIB(LIB2) DATA(*YES); | |
cl:CRTDUPOBJ OBJ(QSQPTABL) FROMLIB(QSYS2) OBJTYPE(*FILE) TOLIB(LIB3) DATA(*YES); | |
cl: addlible lib1; |
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
-- To be able to audit holding of a job queue, you need to: | |
-- 1) Enable object auditing | |
-- 2) Configure object auditing for specific job queues | |
cl: CHGSYSVAL SYSVAL(QAUDCTL) VALUE('*AUDLVL *OBJAUD *NOQTEMP'); | |
cl: CHGOBJAUD OBJ(QGPL/KIDDIEJOBQ) OBJTYPE(*JOBQ) OBJAUD(*CHANGE); | |
stop; | |
-- | |
-- T-ZC audit journal entry: | |
-- https://www.ibm.com/support/knowledgecenter/ssw_ibm_i_74/rzarl/rzarlf77.htm |