Home > AS/400 Tips > iSeries administrator tips > RTCTCPSTS -- Retrieve TCP/IP status
iSeries 400 Tips:
EMAIL THIS
 TIPS & NEWSLETTERS TOPICS 

ISERIES ADMINISTRATOR TIPS

RTCTCPSTS -- Retrieve TCP/IP status


Vengoal Chang
05.26.2006
Rating: -3.50- (out of 5)


Digg This!    StumbleUpon Toolbar StumbleUpon    Bookmark with Delicious Del.icio.us   


In this tip, Search400.com member Vengoal Chang shares the RTVTCPSTS command source to help you retrieve the TCP/IP status.
 
/*  ===============================================================  */
/*  = Command....... RtvTcpSts                                    =  */
/*  = CPP........... RtvTcpSts RPGLE                              =  */
/*  = Description... Retrieve TCP/IP Status                       =  */
/*  =                                                             =  */
/*  = CrtCmd      Cmd( RtvTcpSts )                                =  */
/*  =             Pgm( RtvTcpSts  )                               =  */
/*  =             SrcFile( YourSourceFile ) Allow(*Ipgm *Bpgm)    =  */
/*  ===============================================================  */
/*  = TCPSTS return value :                                       =  */
/*  =    '0' -- TCP/IP not active                                 =  */
/*  =    '1' -- TCP/IP active                                     =  */
/*  ===============================================================  */
/*  = Date  : 2006/04/24                                          =  */
/*  = Author: Vengoal Chang                                       =  */
/*  ===============================================================  */
             CMD        PROMPT('Retrieve TCP/TP Status')
             PARM       KWD(TCPSTS) TYPE(*CHAR) LEN(1) RTNVAL(*YES) +
                          PROMPT('TCP/IP status')


RTVTCPSTS CPP source(member type CLLE):
/*  ===============================================================  */
/*  = Command RtvTcpSts CPP                                       =  */
/*  =   RtvTcpSts CLLE                                            =  */
/*  =   Paramater notes:                                          =  */
/*  =     TCPSTS  : 1 --> TCP/IP is active                        =  */
/*  =               0 --> TCP/IP is not active                    =  */
/*  ===============================================================  */
/*  = Date  : 2006/04/28                                          =  */
/*  = Author: Vengoal Chang                                       =  */
/*http://as400bks.rochester.ibm.com/iseries/v5r2/ic2924/index.htm?   */
/* info/apis/qtocrtvtcpa.htm                                         */
/*  ===============================================================  */ pgm (&TCPSTS)

   dcl &TcpSts *CHAR  1

   dcl &RcvVar *CHAR  140
   dcl &ApiErr *CHAR    8 X'0000000000000000'
   dcl &Format *CHAR    8 'TCPA0100'
   dcl &RcvVarLen *CHAR  4
   dcl &TcpStkSts *CHAR  4
   dcl &TcpStkStsn *dec 10 0

   dcl &MsgId  *CHAR    7
   dcl &MsgDta *CHAR  256
   dcl &MSGF   *CHAR   10
   dcl &MSGFLIB *CHAR  10
   dcl &MSGTXT  *CHAR 256

   MONMSG     MSGID(CPF0000 MCH0000) EXEC(GOTO error)

   chgvar %Bin(&RcvVarLen) 140
   callprc 'QtocRtvTCPA' ( +
                          &RcvVar    +
                          &RcvVarLen +
                          &Format    +
                          &ApiErr)

   ChgVar  &TcpStkSts     %SST(&RcvVar 9 4)
   ChgVar  &TcpStkStsn    %bin(&TcpStkSts)

   If (&TcpStkStsn *NE 1) +
      Chgvar &TcpSts '0'
   Else +
      Chgvar &TcpSts '1'

   Return

/*  ===============================================================  */
/*  = Error routine                                               =  */
/*  ===============================================================  */

Error:

  RcvMsg     MsgType( *Excp )                                         +
             MsgDta( &MsgDta )                                        +
             MsgID( &MsgID )                                          +
             MsgF( &MsgF )                                            +
             MsgFLib( &MsgFLib )
  MonMsg     ( CPF0000 MCH0000 )

SndMsg:

  SndPgmMsg  MsgID( &MsgID )                                          +
             MsgF( &MsgFLib/&MsgF )                                   +
             MsgDta( &MsgDta )                                        +
             MsgType( *Escape )
  MonMsg     ( CPF0000 MCH0000 )

/*  ===============================================================  */
/*  = End of program                                              =  */
/*  ===============================================================  */ endpgm

  
  

Note: In this tip it is VERY important to make sure the name of the API is entered exactly as shown, using upper and lower case in quotes:

 CALLPRC    PRC('QtocRtvTCPA') PARM((&RCVVAR) + 
              (&RCVVARLEN) (&FORMAT) (&APIERR))  

Rate this Tip
To rate tips, you must be a member of Search400.com.
Register now to start rating these tips. Log in if you are already a member.


Submit a Tip




Digg This!    StumbleUpon Toolbar StumbleUpon    Bookmark with Delicious Del.icio.us   



RELATED CONTENT
iSeries administrator tips
Analyze the health of your IBM i server with iScore
Researching high availability for your System i shop
Translating Linux for IBM i admins: Using GUI to make it easy
Translating Linux for IBM i admins: Working with jobs and networking
OpenOffice: What to know before making the transition from Microsoft Office
OpenOffice: An enterprise open source solution
Database performance comparisons on IBM i
Translating Linux for IBM i admins: User profile commands
Modern System i reports using Client Access
Tips for installing Lotus Domino server on a System i partition

RELATED RESOURCES
2020software.com, trial software downloads for accounting software, ERP software, CRM software and business software systems
Search Bitpipe.com for the latest white papers and business webcasts
Whatis.com, the online computer dictionary

DISCLAIMER: Our Tips Exchange is a forum for you to share technical advice and expertise with your peers and to learn from other enterprise IT professionals. TechTarget provides the infrastructure to facilitate this sharing of information. However, we cannot guarantee the accuracy or validity of the material submitted. You agree that your use of the Ask The Expert services and your reliance on any questions, answers, information or other materials received through this Web site is at your own risk.



iSeries Security - Security Tools, Physical Security and System Security
HomeNewsTopicsITKnowledge ExchangeTipsBlogsAsk the ExpertsMultimediaWhite PapersProducts
About Us  |  Contact Us  |  For Advertisers  |  For Business Partners  |  Site Index  |  RSS
SEARCH 
TechTarget provides technology professionals with the information they need to perform their jobs - from developing strategy, to making cost-effective purchase decisions and managing their organizations' technology projects - with its network of technology-specific websites, events and online magazines.

TechTarget Corporate Web Site  |  Media Kits  |  Site Map




All Rights Reserved, Copyright 1999 - 2009, TechTarget | Read our Privacy Policy
  TechTarget - The IT Media ROI Experts