× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



Jay,

To the best of my knowledge (and I'm not in COBOL development or that much
of a COBOL coder so my knowledge is certainly not the final word here)
COBOL treats all binary data as signed.  One rather indirect way to display
the correct numeric value (and I'm sure there are better ones but this came
quickly to mind) would be to:

01.   ApiReturnLong   PIC S9(18) binary.
01.   ApiReturnMap redefines ApiReturnLong.
        05.  ApiFiller  PIC S9(9) binary.
        05.  ApiReturn PIC S9(9) binary.

Displaying ApiReturnLong (as in eval using debug) would then show
0000000003326352740.

Of course you would only need to do this if you really need to display the
numeric value.  To use the value in other APIs you would just use ApiReturn
as it does have the correct value (when interpreted by other APIs as
unsigned).

Bruce





                      "Jay Sulzmann"
                      <jsulzmann@HBS-INC        To:       
<cobol400-l@midrange.com>
                      .COM>                     cc:
                      Sent by:                  Subject:  Re: IP Address 
Conversion using an IBM API
                      cobol400-l-admin@m
                      idrange.com


                      05/24/2002 10:39
                      AM
                      Please respond to
                      cobol400-l






Bruce,

Wow - thanks.  It probably is a typo on my part.

Now that we know the COBOL is getting the correct result in a different
form, can you suggest an algorithm for putting it in the correct form?

Much appreciate -- Jay

----- Original Message -----
From: "Bruce Vining" <bvining@us.ibm.com>
To: <cobol400-l@midrange.com>
Sent: Friday, May 24, 2002 11:24 AM
Subject: Re: IP Address Conversion using an IBM API


>
> Jay,
>
> I am not able to reproduce your exact values.  You mention that in RPG
you
> get 3326352740 which would map to 198.68.29.100.  When I try your COBOL
> program using 198.68.29.100 I get -968614556 (which is close to your
> reported -989614556, but not quite the same).
>
> Now -968614556 is x'C6441D64', which when used as an unsigned integer is
> 3326352740 so you are getting the same returned data.  It's just being
> treated as signed in COBOL and unsigned in RPG.  So assuming one of the
> values in your note was a typo, you are getting the same results.
>
> Bruce



_______________________________________________
This is the COBOL Programming on the iSeries/AS400 (COBOL400-L) mailing
list
To post a message email: COBOL400-L@midrange.com
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/cgi-bin/listinfo/cobol400-l
or email: COBOL400-L-request@midrange.com
Before posting, please take a moment to review the archives
at http://archive.midrange.com/cobol400-l.








As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:

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

This mailing list archive is Copyright 1997-2024 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].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.