Skip to content

Instantly share code, notes, and snippets.

View MarinaSchwenk's full-sized avatar

Marina Schwenk MarinaSchwenk

  • Everbrite LLC
  • Greenfield WI
View GitHub Profile
@forstie
forstie / IFS_search_replace_and_create.sql
Last active July 22, 2021 16:15
I was asked how ifs_read and ifs_write could be combined to build a new IFS stream file, where certain character strings are replaced.
--
-- Subject: IFS stream file transformation
-- Author: Scott Forstie (thanks to Sue Romano for helping with this Gist)
-- Date : June 28, 2021
-- Features Used : This Gist uses ifs_read, ifs_write, regexp_replace, and the previously unknown fx designation for a unicode literal.
--
-- Function - Point is routine at an existing IFS steam file, which contains some character data that you want to globally replace.
-- The function extracts (reads) the contents, replaces the search string occurrences with the replacement string, and then
-- writes everything to the target IFS stream file.
--
@forstie
forstie / change command default.sql
Created June 4, 2021 16:22
Before an upgrade, rollswap, or just for good hygiene, its good to know which CL commands have had their command defaults changed. Here's an approach that works all the way back to IBM i 7.2.
--
-- Which CL commands have had their parameter defaults changed?
-- (On IBM i 7.3 and higher)
--
with libs (lib) as (
select objname
from table (
qsys2.OBJECT_STATISTICS('*ALLAVL', '*LIB')
)
)
@forstie
forstie / Spreadsheets and Emails with SQL & ACS.sql
Last active March 8, 2024 13:29
In this Gist, I show how you can leverage ACS's jar that is shipped on your IBM i to do your bidding. In this case, we can automate the creation and downloading of a spreadsheet to an IFS file where the contents of the spreadsheet is controlled with an SQL query. After the spreadsheet is created in the IFS, we use SQL once more to email the spre…
--
-- 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.*