Q
Problem solve Get help with specific problems with your technologies, process and projects.

Easiest way to identify the TCP addresses of telnet users

Would you please tell me what is the easiest way to identify the TCP addresses of my telnet users? The main problem for me is to find the link: telnet job - TCP address.

There is an API (QDCRDEVD) that gives us access to the IP address for a particular TELNET session.

I wrote a simple program you could use to extract this information and display it to a user.

   PGM 
                 DCL        &ERRORSW *LGL                     /* Std err */
                 DCL        &MSGID *CHAR LEN(7)               /* Std err */
                 DCL        &MSGDTA *CHAR LEN(100)            /* Std err */
                 DCL        &MSGF *CHAR LEN(10)               /* Std err */
                 DCL        &MSGFLIB *CHAR LEN(10)            /* Std err */
                 DCL        VAR(&DEVD) TYPE(*CHAR) LEN(10)   
                 DCL        VAR(&IP) TYPE(*CHAR) LEN(15)     
                 DCL        VAR(&RECEIVER) TYPE(*CHAR) LEN(892)
                 DCL        VAR(&LENGTH) TYPE(*CHAR) LEN(4)    
                 DCL        VAR(&ERRLENGTH) TYPE(*CHAR) LEN(4) 
                 MONMSG     MSGID(CPF0000) EXEC(GOTO CMDLBL(STDERR1))

                 RTVJOBA    JOB(&DEVD)                     
                 CHGVAR     VAR(%BIN(&LENGTH)) VALUE(892)  
                 CHGVAR     VAR(%BIN(&ERRLENGTH)) VALUE(0) 
                 CALL       PGM(QDCRDEVD) PARM(&RECEIVER &LENGTH + 
                              DEVD0600 &DEVD &ERRLENGTH)           
                 CHGVAR     VAR(&IP) VALUE(%SST(&RECEIVER 878 15)) 
                 SNDPGMMSG  MSG(&IP)               
     END:        RETURN

     STDERR1:               /* Standard error handling routine */
                 IF         &ERRORSW SNDPGMMSG MSGID(CPF9999) +
                              MSGF(QCPFMSG) MSGTYPE(*ESCAPE) /* Func chk */
                 CHGVAR     &ERRORSW '1' /* Set to fail ir error occurs */
     STDERR2:    RCVMSG     MSGTYPE(*DIAG) MSGDTA(&MSGDTA) MSGID(&MSGID) +
                              MSGF(&MSGF) MSGFLIB(&MSGFLIB)
                 IF         (&MSGID *EQ '       ') GOTO STDERR3
                 SNDPGMMSG  MSGID(&MSGID) MSGF(&MSGFLIB/&MSGF) +
                              MSGDTA(&MSGDTA) MSGTYPE(*DIAG)
                 GOTO       STDERR2 /* Loop back for addl diagnostics */
     STDERR3:    RCVMSG     MSGTYPE(*EXCP) MSGDTA(&MSGDTA) MSGID(&MSGID) +
                              MSGF(&MSGF) MSGFLIB(&MSGFLIB)
                 SNDPGMMSG  MSGID(&MSGID) MSGF(&MSGFLIB/&MSGF) +
                              MSGDTA(&MSGDTA) MSGTYPE(*ESCAPE)
                 ENDPGM 

==================================
MORE INFORMATION ON THIS TOPIC
==================================

The Best Web Links: tips, tutorials and more.

Ask your OS/400 questions--or help out your peers by answering them--in our live OS/400 discussion forums.


This was last published in October 2001

Dig Deeper on Past Releases

Have a question for an expert?

Please add a title for your question

Get answers from a TechTarget expert on whatever's puzzling you.

You will be able to add details on the next page.

Start the conversation

Send me notifications when other members comment.

Please create a username to comment.

-ADS BY GOOGLE

SearchDataCenter

Close