How to check if a TCP port is already in use or reserved to a different job/STC

book

Article ID: 130242

calendar_today

Updated On:

Products

CA Dynamic Capacity Intelligence

Issue/Introduction

When customizing a CA Dynamic Capacity Intelligence (DCI) control region JCL, a TCP port number must be provided. There are some TCP commands that can help determine if a port is already in use.

IP ports cannot be shared between different regions. Moreover, a port can be reserved to a specific region.  

Environment

DCI 1.5 and above on z/OS

Resolution

NETSTAT CONN (PORT nnnn command shows if the port is already in use; for example:
NETSTAT CONN (PORT 21                                                 
MVS TCP/IP NETSTAT CS V2R3       TCPIP Name: TCPIP         
User Id  Conn     State                                               
-------  ----     -----                                               
FTP      00244E1D Establsh                                            
  Local Socket:   ::ffff:nn.nnn.nn.nn..21                             
  Foreign Socket: ::ffff:mm.mmm.mm.mm..pppp                          


NETSTAT PORTL (PORT nnnn command shows if the port is reserved to a specific jobname, for example:
NETSTAT PORTL (PORT 21                               
MVS TCP/IP NETSTAT CS V2R3       TCPIP Name: TCPIP   
Port# Prot User     Flags    Range       SAF Name    
----- ---- ----     -----    -----       --------    
21    TCP  FTP      DA


The above commands can be run in batch:
//NETSTAT EXEC PGM=IKJEFT01 
//SYSPRINT DD SYSOUT=*      
//SYSTSPRT DD SYSOUT=*      
//SYSTERM DD DUMMY          
//SYSTSIN DD *              
NETSTAT CONN (PORT 21       
NETSTAT PORTL (PORT 21      
/* 

Additional Information

If the DCI Control region is started with a TCP port that is "reserved" to a different region, then the following message is returned:
DCI0999E: ERROR BIND     : (0000000D/FFFFFFFF)

See KB000122167 for additional details.