The function is really simple once you have the parameters for the API figured out. The name of the device is the only parameter passed into the function. The function then calls the QDCRDEVD and returns the IP address from the data received. I have added some really simple error handling so that the IP address will be "ERROR" if the QDCRDEVD API does not execute properly.
As I mentioned, this same process can be used to determine the IP address of virtually any network device. The function could be modified easily to return IP addresses for other devices. I only needed the workstation devices so I didn't bother with the rest.
There are a few limitations to the QDCRDEVD API that you should be aware of before using it. The first one is that the device name must use all uppercase letters (QPADEV0001, not qapdev0001). If you have lowercase letters, it will return an error. Also, the API will not work at all with a device connected via pass-through (STRPASTHR), and it will not work for PC jobs that are calling RPG and/or CL commands.
There is a plethora of other information available about the device(s) in the datastream returned from QDCRDEVD. If you are interested, go to the IBM Information Center and search for QDCRDEVD.
--Jeff Olen


Business users want new applications now. Market and regulatory pressures require faster application updates and delivery into production. Your IBM i developers may be approaching retirement, and you see no sure way to fill their positions with experienced developers. In addition, you may be caught between maintaining your existing applications and the uncertainty of moving to something new.
IT managers hoping to find new IBM i talent are discovering that the pool of experienced RPG programmers and operators or administrators with intimate knowledge of the operating system and the applications that run on it is small. This begs the question: How will you manage the platform that supports such a big part of your business? This guide offers strategies and software suggestions to help you plan IT staffing and resources and smooth the transition after your AS/400 talent retires. Read on to learn:
LATEST COMMENTS
MC Press Online