Newsletters Subscriptions Media Kit About Us Contact Search Home

mgo
OS/400 Edition
Volume 3, Number 39 -- June 13, 2003

Retrieving the Host Name from an IP Address


Hey, Shannon:

I am writing the world's greatest AS/400 utility. It will do everything except lock the door and turn the lights off when it's time to go home at night! I have it all figured out, except for one thing: I need my RPG program to be able to retrieve the Internet Protocol (IP) address of all the other AS/400's that have already been defined on our AS/400 in the TCP/IP host table. Is there some easy method of determining the IP address of the systems defined in the AS/400 host table, using an RPG program?

--Roxie


That sounds like some humdinger of a utility, Roxie. If you can figure out a way for your program to automatically ask for a pay raise, let me know. I might be interested in buying it.

To retrieve the IP address of the systems defined in the AS/400 host table is actually pretty easy. IBM has conveniently created two physical files for you to CHAIN to in your RPG IV program. The first, QATOCHOST, contains the IP address and the user-defined host name of the remote systems. If you know the IP address, you can CHAIN directly to QATOCHOST by that address to retrieve the host name. If you know the host name, but need the IP address, CHAIN to logical file QATOCHLST1 by the host name and that will return the IP Address. If you need more information about that TCP/IP route, you can also CHAIN to a file named QATOCIFC by IP address. The QATOCIFC file contains such information as the type of AS/400 line (Ethernet or Token-Ring, for example) that this route has been defined for, as well the subnet mask, the size of the maximum transmission unit (MTU), and much more.

All files can be found in library QUSRSYS.

--Shannon


Sponsored By
ADVANCED SYSTEMS CONCEPTS

Quoted from an experienced programmer
new to the iSeries (AS/400):

"The best thing about working on the AS/400 is using ASC's SEQUEL product."

If you're tired of the limitations imposed by Query/400 or ODBC-based query and reporting tools, you need SEQUEL. Discover how thousands of sites around the world have improved access to iSeries data using SEQUEL's Windows- and Web-interfaces. It's the one tool you can rely on for virtually all your iSeries data access needs.
FREE trial available.

Read More about SEQUEL


THIS ISSUE
SPONSORED BY:

Advanced Systems Concepts
WorksRight Software


BACK ISSUES

TABLE OF
CONTENTS

Retrieving the Host Name from an IP Address

Variable-Length Character Data

Reader Feedback and Insights: Frightened by the Midrange Guru


Editors
Howard Arner
Joe Hertvik
Ted Holt
David Morris
Shannon O'Donnell

Managing Editor
Shannon Pastore

Publisher and
Advertising Director:

Jenny Thomas

Advertising Sales Representative
Kim Reed

Contact the Editors
Do you have a gripe, inside dope or an opinion?
Email the editors:
editors@itjungle.com

Copyright © 1996-2008 Guild Companies, Inc. All Rights Reserved.