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 INCLUDE (SQL) to maintain reusable code segments. | |
-- and incorporate in scripts or SQL Procedures, Functions, and Triggers | |
-- Reference: http://ibm.biz/DB2fori_INCLUDE | |
-- | |
-- | |
-- description: Use the INCLUDE statement to pull | |
-- in and execute common pieces | |
-- of SQL |
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, Replace, Delete, or Disable trigger programs | |
-- without acquiring an exclusive lock over the file | |
-- ======= | |
-- | |
-- Resource: ibmsystemsmag.com/blogs/i-can/august-2017/manage-trigger-programs-in-productions | |
-- Prepare to break the rules | |
call qsys2.override_qaqqini(1, '', ''); | |
-- Rules broken |
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
-- | |
-- ======================================================== | |
-- iSee - GO SAVE Option 21 ( Save Entire system ) deetz | |
-- ======================================================== | |
-- | |
-- Author: Scott Forstie | |
-- Date : September, 2023 | |
-- Email : [email protected] | |
-- | |
-- Details for the previous GO SAVE Option 21 operations are found |
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
-- | |
-- description: Find active Telnet or Interactive 5250 sessions | |
-- | |
-- resource: ibm.biz/WellDefinedIBMiPorts | |
-- | |
select remote_address, remote_port, authorization_name as user_name, job_name | |
from qsys2.netstat_job_info n | |
where local_port in (23,992) and job_type = 'INTERACTIVE'; | |
-- |
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 | |
-- Email: [email protected] | |
create or replace variable coolstuff.decdate dec(6,0); | |
set coolstuff.decdate = '190718'; | |
-- July 18, 2019 (yes, really!) | |
values timestamp_format(varchar(coolstuff.decdate), 'YYMMDD'); | |
-- Wow | |
-- Yowza |
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 | |
-- Email : [email protected] | |
-- Date : July 28, 2019 | |
-- | |
-- Subtract '*IOSYSCFG from all users by producing the CHGUSRPRF command | |
-- necessary to get the job done | |
-- | |
with iosyscfg_users (user_name) as ( | |
select authorization_name | |
from qsys2.user_info |
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
-- This fails to return data....why? | |
SELECT cusip, issueDate, bidToCoverRatio | |
FROM JSON_TABLE( | |
SYSTOOLS.HTTPGETCLOB('https://www.treasurydirect.gov/TA_WS/securities/announced?format=json&type=FRN&pagesize=5', null), | |
'$.root[*]' | |
COLUMNS(cusip VARCHAR(10) PATH '$.cusip', | |
issueDate Timestamp PATH '$.issueDate', | |
bidToCoverRatio double PATH '$.bidToCoverRatio') | |
) AS X; | |
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
values current decfloat rounding mode; | |
set current decfloat rounding mode= round_half_even; | |
stop; | |
-- =============================================================================================================== | |
-- | |
-- QUANTIZE uses the decfloat rounding mode. | |
-- This is the default: ROUND_HALF_EVEN | |
-- | |
-- Round to nearest value; if values are equidistant, round so that the final digit is even. | |
-- If the discarded digits represent greater than half (0.5) of the value of a number in the next left position, |
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 procedure qgpl.values_into (out pout integer) | |
begin | |
declare values_into_stmt varchar(1000) ccsid 37; | |
set values_into_stmt = 'values 1+2+3 into ?'; | |
prepare values_into_query from values_into_stmt; | |
execute values_into_query using pout; | |
end; | |
call qgpl.values_into(?); | |
-- Note that 6 is returned... |