Ask the Expert

Checking if a local port is used by another job on AS/400

Isn't there a api to check if a local port is used by another job on iSeries?
There is a command called NETSTAT which will show you who is using local ports. Unfortunately it can only be used interactively and can only create spooled output.

To execute the command do: NETSTAT OPTION(*CNN)

                      Work with TCP/IP Connection Status                       
System:   S02      
Type options, press Enter.                                                     

3=Enable debug 4=End 5=Display details 6=Disable debug
8=Display jobs
Remote Remote Local Opt Address Port Port Idle Time State * * ftp-con > 000:40:52 Listen * * telnet 000:01:52 Listen * * smtp 000:00:01 Listen * * tftp 018:13:58 *UDP * * sunrpc 518:42:58 Listen * * sunrpc 063:18:20 *UDP * * ntp 000:49:31 *UDP * * netbios > 018:13:58 Listen * * netbios > 000:00:11 *UDP * * netbios > 000:00:13 *UDP * * netbios > 000:02:14 Listen * * snmp 000:12:53 *UDP
 F3=Exit   F5=Refresh   F9=Command line   F11=Display byte counts   F12=Cancel
 F20=Work with IPv6 connections   F22=Display entire field   F24=More keys

From this screen you can use the F6 key to create spooled output…

This was first published in October 2008

There are Comments. Add yours.

TIP: Want to include a code block in your comment? Use <pre> or <code> tags around the desired text. Ex: <code>insert code</code>

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy
Sort by: OldestNewest

Forgot Password?

No problem! Submit your e-mail address below. We'll send you an email containing your password.

Your password has been sent to: