• Subject: Re: Retrieve IP Address using Telnet exit point
  • From: "Dennis Lovelady" <dennis@xxxxxxxxxxxx>
  • Date: Mon, 19 Jul 1999 17:19:41 -0400

Hi, Buck:

From: Buck Calabro <mcalabro@commsoft.net>
Sent: July 19, 1999 4:07 PM


> Dennis,
> This is an elegant solution!  I love it!!  Just one nit.

Thanks.  :^)

> Someone on the list pointed out to me a flaw in similar code that I had.
> RPG/400's binary data type can't hold the full number: x'FFFFFFFF' =
> 4,294,967,295, which won't fit in a BIN4 field, because BIN4 truncates
at
> 999,999,999 (nine digits).  If the data structure were implemented in
RPGIV,
> it would not encounter this restriction.

Oh, that's a problem.  But now that you mention it, there's a worse one:
If the first nibble is more than 127, it'll be viewed as a negative, and
won't work.  Hmmm.... here's a slightly less elegant RPGIV fix, though:

I            DS
I                          1   40BINARY
I                          3   4 HEXCOD

C* IPHEX is a character field containing the
C* IP address
C                     Z-ADD*ZERO     BINARY          Initialize
C                     MOVE IPHEX     HEXCOD
C           BINARY    DIV  256       NIBBL3  30
C                     MVR            NIBBL4  30
C                     MOVELIPHEX     HEXCOD
C           BINARY    DIV  256       NIBBL1  30
C                     MVR            NIBBL2  30
C* Address is NIBBL1.NIBBL2.NIBBL3.NIBBL4

HTH
--
Dennis Lovelady                    Fayetteville, GA
mail: dennis@lovelady.com          dennis.e.lovelady@ac.com
URL:  http://www.lovelady.com  **NEW**
ICQ:  5734860
--
"We are told that talent creates its own opportunities. But it sometimes
seems that intense desire creates not only its own opportunities, but its
own talents."
        - Eric Hoffer


+---
| This is the Midrange System Mailing List!
| To submit a new message, send your mail to MIDRANGE-L@midrange.com.
| To subscribe to this list send email to MIDRANGE-L-SUB@midrange.com.
| To unsubscribe from this list send email to MIDRANGE-L-UNSUB@midrange.com.
| Questions should be directed to the list owner/operator: david@midrange.com
+---


This thread ...

Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2019 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].