Last active
January 25, 2024 22:34
-
-
Save forstie/80001ef9cbfad0112eb8a61fe3da4ac9 to your computer and use it in GitHub Desktop.
Use SQL's NETSTAT and ACTIVE_JOB_INFO services to identify and explore active 5250 sessions.
This file contains 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'; | |
-- | |
-- description: Find Interactive jobs | |
-- | |
select * from table(qsys2.active_job_info( | |
subsystem_list_filter => 'QINTER', | |
detailed_info => 'ALL')) b where job_type = 'INT'; | |
-- | |
-- description: Join them together (secret sauce) | |
-- | |
with active5250(remote_address, remote_port, user_name, job_name) as ( | |
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' | |
) | |
select remote_address, remote_port, user_name, a.job_name, | |
sql_statement_status, sql_statement_text, b.* from active5250 a inner join | |
table(qsys2.active_job_info(subsystem_list_filter => 'QINTER', | |
detailed_info => 'ALL')) b | |
on a.job_name = b.job_name where job_type = 'INT'; | |
Really nice @ V7R2 ... errors out at V7R1. No big deal. Copyu and pasted in ACS SQL and looks great!
Yes, the => named parameter invocation of a UDTF is support that was added with IBM i 7.2.
So I saw …. Always appreciate the quick response …. Am a big fan. Keep up the outstanding work.
Very Respectfully,
Michael Mayer
IBM i Support / System Admin.
IT Operations.
The Florida Bar
651 E. Jefferson St
Tallahassee, Florida 32399-2300
mmayer@floridabar.org<mailto:mmayer@floridabar.org>
https://www.floridabar.org<https://www.floridabar.org/>
Office: 850.561.5761
Cell: 518.641.8906
[cid:image001.png@01D58E6C.15B82720]
Please note: Florida has very broad public records laws. Many written communications to or from The Florida Bar regarding Bar business may be considered public records, which must be made available to anyone upon request. Your e-mail communications may therefore be subject to public disclosure.
From: Scott Forstie <notifications@github.com>
Sent: Tuesday, October 29, 2019 3:16 PM
To: forstie <forstie@noreply.github.com>
Cc: Mayer, Michael <MMayer@floridabar.org>; Comment <comment@noreply.github.com>
Subject: Re: forstie/Revieve details for active 5250 sessions.sql
Yes, the => named parameter invocation of a UDTF is support that was added with IBM i 7.2.
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub<https://gist.github.com/80001ef9cbfad0112eb8a61fe3da4ac9?email_source=notifications&email_token=ANT736RMV7VHSK4CQPEA4A3QRCDYZA5CNFSM4H4KRHUKYY3PNVWWK3TUL52HS4DFVNDWS43UINXW23LFNZ2KUY3PNVWWK3TUL5UWJTQAF3KQW#gistcomment-3069195>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/ANT736VWCFEPGL7EKAGOJHLQRCDYZANCNFSM4H4KRHUA>.
…________________________________
Please note: Florida has very broad public records laws. Many written communications to or from The Florida Bar regarding Bar business may be considered public records, which must be made available to anyone upon request. Your e-mail communications may therefore be subject to public disclosure.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Great point... updated.
Thanks Christian