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

Hi, Evan:

From: Evan Harris <spanner@ihug.co.nz>
To: <MIDRANGE-L@midrange.com>
Sent: July 19, 1999 5:04 AM
Subject: Re: Retrieve IP Address using Telnet exit point


> What I orignally was trying to ask was exactly what you guys were
telling
> me to do. That is, once I have the four digit hex code, convert it to a
> numeric value.

Technically, you mean, 4-CHARACTER code, not four-DIGIT, right?  Is this
part of your problem, you're describing it as numeric?

> What I have been unable to see is exactly how to effect the translation
of
> the binary data returned form the API into a readable decimal value. It
> seems somewhere I have just missed some essential code to do the
> appropriate moves to accomplish this.

The following code will work for you, assuming that your 4-CHAR code is
called CODE.  Perhaps I should have called the field, IPHEX or some
such... but you are free to make your own name changes.

> >RPG code  (I-specs not aligned)
> >   I         DS
> >   I                1   4 HEXCOD
> >   I                1   40BINARY
> >
> >   C                     MOVE CODE      HEXCOD
> >   C                     DIV  256       BINARY
> >   C                     MVR            DIGIT4  30
> >   C                     DIV  256       BINARY
> >   C                     MVR            DIGIT3  30
> >   C           BINARY    DIV 256        DIGIT1  30
> >   C                     MVR            DIGIT2  30
> >
> >(where CODE is your 4-byte hex code from the API.)

I feel that you may be that you've identified IPHEX or CODE or whatever,
as a numeric field, and therein lies the problem.  If you've defined it as
a binary numeric, the following should work for you.  (Note this is a
minor revision of the above; you don't need the DS with this solution:

C* Note that IPHEX is a BINARY NUMERIC field, with length 9 (or 4 in
I-specs)
C           IPHEX     DIV  256       WORK    90
C                     MVR            DIGIT4  30
C                     DIV  256       WORK
C                     MVR            DIGIT3  30
C           WORK      DIV 256        DIGIT1  30
C                     MVR            DIGIT2  30

> I did toy with the idea of examining each bit of the hex code along the
> lines of Leif's suggestion, but thought there must be a smarter way to
do
> this, however if there isn't I can code that quite happily.

Actually, that's each nibble, rather than each bit, but I'm not going to
byte you for that one.  :^)

HTH
--
Dennis Lovelady                    Fayetteville, GA
mail: dennis@lovelady.com          dennis.e.lovelady@ac.com
URL:  http://www.lovelady.com  **NEW**
ICQ:  5734860
--
"Genius is one per cent inspiration and ninety-nine per cent
perspiration."
        - Thomas Edison


+---
| 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 ...

Follow-Ups:
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 here. If you have questions about this, please contact [javascript protected email address].