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: Establishing a virtual layer in the data model using SQL Views | |
-- Author: Scott Forstie | |
-- Date : Rocktober, 2021 | |
-- Features Used : This Gist uses QSYS2.SYSFILES, QSYS2.SYSCOLUMNS2, dynamic SQL, and SQL PL | |
-- Prereq: IBM i 7.3 or higher, with the Db2 PTF Group level from September 9, 2021 or later | |
-- | |
-- Function - The request was, I don't have a DBE.. I don't have SQL Views... how do I get started with | |
-- shifting users and applications away from directly consuming the physical files? | |
-- |
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
-- | |
-- 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 - robert.andrews@us.ibm.com | |
-- | |
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
-- =============================================== | |
-- Title: iSee how to track *ALLOBJ users | |
-- =============================================== | |
-- Date : November 5, 2020 | |
-- Author: Scott Forstie | |
-- Use : iSee video series with Tim Rowe | |
-- | |
-- ====================================================================================================== | |
-- |
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
-- | |
-- title: Generate PDF(s) from Spooled Files | |
-- This scalar function allows the SQL programmer to identify Spooled File(s) and generate pdfs for them in the IFS. | |
-- | |
-- minvrm: V7R2M0 | |
-- | |
CREATE or replace FUNCTION SYSTOOLS.Generate_PDF( | |
job_name varchar(28) for sbcs data, | |
file_name varchar(10) for sbcs data, | |
file_number integer, |
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
-- | |
-- Note: | |
-- Documentation for ACS's cldownload and other fantastic hidden gems can be found here: | |
-- ftp://ftp.software.ibm.com/as400/products/clientaccess/solutions/GettingStarted_en.html | |
-- | |
-- | |
-- Do I have the ACS jar on this IBM i? | |
-- | |
select create_timestamp, acs.* |
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
-- | |
-- Author: Scott Forstie | |
-- Date : July 14, 2020 | |
-- | |
-- Question: How can I use SQL to validate that a string only contains an approved list of characters? | |
-- Answer : The TRANSLATE() built-in function. | |
-- | |
-- TRANSLATE replaces the allowed characters with blanks. | |
-- Then, RTRIM throws all the blanks away. | |
-- Then, if the resulting LENGTH is zero, you can conclude that the string only contained allowed characters. |
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
-- | |
-- The fastest way to find every user profile | |
-- | |
select objname as user_profile | |
from table ( | |
qsys2.object_statistics('QSYS', '*USRPRF', '*ALLSIMPLE') | |
); | |
OlderNewer