I was getting annoyed because the TCPIP NETSTAT command displays the output in line mode, and you cannot scroll back to look at it.
The documentation says you can use NETSTAT … STACK in a Rexx program, and use queued() to see how many lines were on the stack. This did not work for me. I always got 0 lines on the stack, until I exited ISPF when they all tried to execute and produced “IKJ56621I INVALID COMMAND NAME SYNTAX”.
A better (and more efficient way – you have to write less code) is create an Rexx program. I used USER.Z24C.CLIST(NS)
/* REXX */ ADDRESS ISPEXEC 'ISREDIT MACRO (a)' x = outtrap("var.") if a = "" then a = "HOME" address TSO "netstat "a x = outtrap("OFF") if var.0 = 0 then exit "ISREDIT AUTOSAVE OFF PROMPT" do y =1 to var.0 fn= var.y "ISREDIT LINE_AFTER .ZLAST = (fn)" end
If you use this command within an ISPF edit session, it will append the output to the bottom of the file.
Note: You pass parameters via ISREDIT MACRO(parms) rather than pars args parms.
You can always use DELETE ALL NX to clear the file before running the exec.
It uses AUTOSAVE OFF PROMPT, to make you explicitly save the output – or cancel from the session, and do not accidentally save it.
As the output is in an ISPF Editor session, you can write edit macros to process the content, and filter or reformat it.
I extended it so I say “ns h” and it issues the netstat home command etc.
'ISREDIT MACRO (a)' if a = "" then a = "HOME" else if a = "i" then a = "devlinks (intfname ifportcp6" else if a = "h" then a = "home" else if a = "r" then a = "route addrtype IPV6" else if a = "n" then a = "nd" address TSO "netstat "a
2 thoughts on “TSO NETSTAT STACK – doesn’t. Get fullscreen output instead.”
Hi Colin, I stumbled across the answer to the Stack problem. https://www.ibm.com/support/pages/node/331537 tells us that if NETSTAT is listed in the AUTHCMD section of IKJTSOxx PARMLIB, the STACK command will not operate as desired.
Great – thank you. I’ll ask TCPIP to update the documentation