Display workstation's associated IP address

This utility displays the IP address associated with a display device used for a Telnet session. This can be useful when the device name, such as QPADEV0001, gives no clue as to the location of the connection.


             CMD        PROMPT('Display Device IP Address')          
             PARM       KWD(DEVICE) TYPE(*CHAR) LEN(10) DFT(*ALL) +  
                          MIN(0) CHOICE('Name, generic*, *ALL') +    
                          PROMPT('Device Name')  


/*Description: Display Ip Address of requested Device.         */ 
/*Author:      Chris Schletty                                  */ 
/*Date:        02Jul99                                         */ 
/*                                                             */ 
/*             Using the QDCRDEVD API, this program displays   */ 
/*             the IP address of the device specified in       */ 
/*             the input parameter.                            */ 
/*                                                             */ 
/*Mods:                                                        */ 
/*                                                             */ 
/*15Sep00 C.Schletty Display Job Information.                  */ 
/*22Dec99 C.Schletty Allow *ALL/Generic*.                      */ 
/*                   Place results in message file.            */ 
/*                                                             */ 
             PGM        PARM(&DEV)                                
             DCL        VAR(&APIOUT) TYPE(*CHAR) LEN(1000)        
             DCL        VAR(&DEV) TYPE(*CHAR) LEN(10)             
             DCL        VAR(&IPADR) TYPE(*CHAR) LEN(15)           
             DCL        VAR(&JOBTYPE) TYPE(*CHAR) LEN(1) /* Job + 
                          Type: 0=Batch  1=Interactive */              
             DCL        VAR(&JOBNAME) TYPE(*CHAR) LEN(10)              
             DCL        VAR(&JOBUSER) TYPE(*CHAR) LEN(10)              
             DCL        VAR(&JOBNBR) TYPE(*CHAR) LEN(6)                
             DCLF       FILE(QADSPOBJ)                                 
/* Default error handling. */                                          
             MONMSG     MSGID(CPF0000)                                 
/* Create message file in QTEMP for report. */                         
             CRTMSGQ    MSGQ(QTEMP/DEVD)                               
/* Build QTEMP file with device information. */                        
             DSPOBJD    OBJ(QSYS/&DEV) OBJTYPE(*DEVD) +                
                          OUTPUT(*OUTFILE) OUTFILE(QTEMP/DEVD)         
             MONMSG     MSGID(CPF0000) EXEC(DO) /* No luck.  Send +    
                          error message. */                            
               SNDPGMMSG  MSG('Unable to obtain information for +      
                          device' *BCAT &DEV)                          
             OVRDBF     FILE(QADSPOBJ) TOFILE(QTEMP/DEVD)              
 READNEXT:   RCVF       /* Get next record. */                         
             MONMSG     MSGID(CPF0000) EXEC(GOTO CMDLBL(END)) /* +     
                          Exit at end of file. */                      
             IF         COND(&ODOBAT *NE 'DSPVRT') THEN(GOTO +         
                          CMDLBL(READNEXT)) /* Ignore all but +        
                          virtual display devices. */                  
             CALL       PGM(QDCRDEVD) PARM(&APIOUT X'0000039A' +       
                          'DEVD0600' &ODOBNM X'0000') /* Call API +    
                          requesting DEVD0600 format which is used +   
                          to describe *DSP devices. */                 
             CHGVAR &IPADR %SST(&APIOUT 878 15)                        
             IF         COND(&IPADR < ' ') THEN(GOTO +                 
                          CMDLBL(READNEXT)) /* Bypass message if no +  
                          IP Address found. */                         
             CHGVAR     VAR(&JOBNAME) VALUE(%SST(&APIOUT 893 10))      
             CHGVAR     VAR(&JOBUSER) VALUE(%SST(&APIOUT 903 10))      
             CHGVAR     VAR(&JOBNBR ) VALUE(%SST(&APIOUT 913  6))      
                         *TCAT ':' *BCAT &IPADR *CAT '  Job:' *BCAT + 
                         &JOBNBR *TCAT '/' *TCAT &JOBUSER *TCAT +     
                         '/' *TCAT &JOBNAME) TOMSGQ(QTEMP/DEVD)       
            GOTO       CMDLBL(READNEXT) /* Next record. */            
END:        DSPMSG     MSGQ(QTEMP/DEVD) START(*FIRST)                 


The Best Web Links: tips, tutorials and more.

Ask your systems management questions--or help out your peers by answering them--in our live discussion forums.

Ask the Experts yourself: Our systems management gurus are waiting to answer your technical questions.

This was first published in September 2001

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:

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.