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
-- | |
-- @document sql-snippets-2025 | |
-- | |
-- | |
-- @desc Select/Delete Spooled Files in Output queue | |
-- | |
-- @parms delete-older-than A timestamp value that defines the starting point | |
-- for deleting spooled files. Any spooled file older than this | |
-- timestamp is eligible for deletion. The default is |
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
<?php | |
$sql="SELECT | |
CAST(1 as smallint) as smallint, | |
CAST(2 as INTEGER) as INTEGER, | |
CAST(3 as BIGINT) as BIGINT, | |
CAST(4. as real) as real, | |
CAST(5.1 as FLOAT) as FLOAT, | |
CAST(6.1 as DOUBLE) as DOUBLE, | |
CAST(7.1 as DECIMAL) as DECIMAL, | |
CAST(8.1 as NUMERIC) as NUMERIC, |
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
<? | |
//only output the error if we're in the development environment | |
$APPLICATION_ENV="dev"; | |
//set error handler to the callback function defined later | |
set_error_handler("myErrorHandler"); | |
//connect to db | |
$db2Connection = db2_connect( '', '' , '',array('i5_lib' => 'QSYS')); | |
if (!$db2Connection) |
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
-- | |
-- Who am i? | |
-- | |
SELECT s.host_name, e.host_name, 'IBM i ' CONCAT os_version CONCAT '.' CONCAT os_release AS ibmi_level | |
, serial_number, machine_type, machine_model | |
, (SELECT Processor_Group FROM Qsys2.License_Info FETCH FIRST ROW ONLY) AS P_Group | |
, ipl_mode, ipl_type, attention_light | |
, total_cpus, e.configured_cpus | |
, configured_memory, total_memory | |
, (SELECT MAX(PTF_IDENTIFIER) FROM QSYS2.PTF_INFO WHERE PTF_TECHNOLOGY_REFRESH_PTF = 'YES' AND PTF_LOADED_STATUS ='PERMANENTLY APPLIED') AS TR_PTF |
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
-- | |
-- @document sql-snippets-2024 | |
-- | |
-- | |
-- @desc Invoke IBMi CL command from SQL. | |
-- While this example shows a single invocation of ADDLIBLE to | |
-- illustrate use, library list and enviroment setup would | |
-- normally be handled by using QCMDEXC to call an IBMi program, | |
-- passing an environment paramaeter so that multiple libraries |