PDA

View Full Version : Getting Workstation's IP Address...



Guest.Visitor
06-18-2002, 01:32 AM
Take a look at the QDCRDEVD API.

Guest.Visitor
06-18-2002, 12:29 PM
Sergey - Try the code below. Bill

Guest.Visitor
06-19-2002, 06:08 AM
Bill I have now been able to get all the details I require by looking at the IBM document on QDCRDEVD API. The information is found further down the file. Here is a copy on my solution The only problem is instead of creating a dataarea for each user I would like the details written to a file within CL is this possible ?

uersip.txt (http://www.mcpressonline.com/images/fbfiles/files/5bfaa4bb_uersip.txt)

Guest.Visitor
06-19-2002, 06:39 AM
George, This may not apply in your case, but you should know that if a device is passed through to another AS/400 (STRPASTHR), then the IP address retrieved for the device will be hex zeros. Or if a device is TELNET'ed to another AS/400, then the IP address retrieved will be for the original AS/400, not the device. Chris

m_baramova@hotmail.com
06-20-2002, 05:19 AM
Hi, If you want to keep this info in PF, try with this: PF DDS A R IPADRFR A US 10A TEXT('USER') A WS 10A TEXT('WS') A IP 15A TEXT('IP') A AI 15A TEXT('AI') RPG to call from CL F* This is IPADRPG pgm FIPADRF O E DISK A C *ENTRY LIST C PARM US 10 USER C PARM WS 10 WORK STATION C PARM IP 15 IP ADDRESS C PARM AI 15 AS/400 C WRITEIPADRFR C SETON LR Changes in your CL program to call RPG: CALL PGM(QDCRDEVD) PARM(&RECEIVER &LENGTH + DEVD0600 &DEVD &ERRLENGTH) CHGVAR VAR(&IP) VALUE(%SST(&RECEIVER 878 15)) CHGVAR VAR(&ID) VALUE(%SST(&RECEIVER 893 10)) CHGVAR VAR(&NA) VALUE(%SST(&RECEIVER 903 10)) CHGVAR VAR(&AI) VALUE(%SST(&RECEIVER 958 15)) DMPCLPGM /* NEW-Instead of *DTAARA */ CALL PGM(MYLIB/IPADRPG) PARM(&NA &ID &IP &AI) /* NEW-Instead of *DTAARA */ GOTO CMDLBL(LOOP) You can find very interesting tips related to this on: http://search400.techtarget.com/ and SEARCH by QDCRDEVD or in current site: http://www.mcpressonline.com and SEARCH by QDCRDEVD

Guest.Visitor
06-20-2002, 05:31 AM
George - I don't think you can do this directly in CL, as you can't declare more than one file. There may be more efficient ways, but I would call an RPG program to write to (or update)the PF, sending it the four parameters . The RPG program would have a RETURN, and after all records are read, send it something like all nines in one of the parms and have it turn on *inlr rather than write when it receives that. Bill

Guest.Visitor
06-20-2002, 07:47 AM
Bill, Another method to shutdown a program that expects parms is to pass no parms to it. If (%Parms=*Zeros) Eval *InLr=*On Return EndIf Chris

Guest.Visitor
06-20-2002, 07:55 AM
Bill have have been able to get all the details I require using the following code The 2 queries give me the required detials in the correct format Thanks for you help George

Guest.Visitor
06-20-2002, 10:15 AM
Chris - Great idea - hadn't thought of using %parms. Thanks. Bill

Guest.Visitor
06-21-2002, 01:56 AM
Thanks to Bill and m.baramova , I now have a complete solution with the use of data areas. And it works great........ George

Guest.Visitor
06-21-2002, 01:57 AM
I know there used to be a discussion about this in the old forum, which I cannot find. :-( Anyway, does anyone know of any solutions on how to retrieve an IP address associated with a workstation's name? Funny thing is that I had some good solutions that I posted on that discussion in the old forum, then, as I moved around, I lost my copies and now I that I need them, the old forums are gone too...