Skip to content

Instantly share code, notes, and snippets.

View fplazavi's full-sized avatar
🏠
Working from home

Fernando Plaza fplazavi

🏠
Working from home
  • @cdinvest
  • Madrid
View GitHub Profile
@forstie
forstie / Protect the IFS root for *PUBLIC
Created February 8, 2021 19:48
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.
--
-- 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;
@forstie
forstie / printf to the Joblog using SQL.sql
Last active June 23, 2023 12:37
printf to the Joblog using SQL
--
-- description: printf to the Joblog, using SQL
--
cl:addlible qsysinc;
cl:crtsrcpf qtemp/qcsrc;
cl:addpfm file(qtemp/qcsrc) mbr(LPRINTF);
insert into qtemp.qcsrc values
(1,010101,'{'),
(2,010101,'extern int Qp0zLprintf (char *format, ...);'),
@forstie
forstie / Library sizes and more.sql
Created November 27, 2020 18:15
With Db2 PTF Group SF99703 level 22 and Db2 PTF Group SF99704 level 10 (aka TR9 and TR3 timed enhancements), the LIBRARY_INFO UDTF has optional input paramters to provide better performing queries for library specific questions.
-- category: IBM i Services
-- description: Librarian - Library Info
-- minvrm: V7R3M0
--
create or replace variable coolstuff.library_report_stmt varchar(10000) for sbcs data default
'create or replace table coolstuff.library_sizes
(library_name, schema_name,
-- qsys2.library_info() columns
@BirgittaHauser
BirgittaHauser / BLOBPDF.SQLRPGLE
Last active August 30, 2023 10:08
Access a PDF document (with RPG) and pass the PDF document as Parameter to another Program/Procedure
//*********************************************************************************************
// I recently get asked how to read a small PDF document into a BLOB and pass it as parameter
// to another function or procedure
// 1. When working with embedded SQL character host variables can only be used up to 32k
// Larger data (up to 16 MB - RPG restriction)
// can be read into a LOB-Variable defined with the SQLTYPE keyword
// 2. Unfortunately the SQLTYPE Keyword cannot be used in a Prototype or Procedure Interface
// 3. But the SQL precompiler generates for the LOB variable a data structure with an
// UNS(4) Subfield _LEN and
// CHAR(xxx) Subfield _DATA
@forstie
forstie / QBATCH job study.sql
Created May 30, 2021 17:10
I was asked to show how SQL could be used to analyze QBATCH subsystem job history. Super grouping to the rescue.
--
-- 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