|
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 "Jay Sulzmann" <jsulzmann@HBS-INC To: <cobol400-l@midrange.com> .COM> cc: Sent by: Subject: IP Address Conversion using an IBM API cobol400-l-admin@m idrange.com 05/24/2002 07:36 AM Please respond to cobol400-l This is a multi-part message in MIME format. -- [ Picked text/plain from multipart/alternative ] I am trying to use IBM's API, "inet_addr" to convert an IP address. The code I'm using is, 0161.00 CALL PROCEDURE "inet_addr" 0162.00 USING 0163.00 by value address of PmIpAddr 0164.00 GIVING 0165.00 ApiReturn 0166.00 END-CALL. ApiReturn is pic s9(9) binary. We know that the IP Address is valid. The call populates the variable by -989614556. This is an error. The answer we're supposed to be getting is 3326352740. An RPG test program gives us that. In RPG, we define the ApiReturn value as "10U 0" (unsigned binary - no decimal places). I tried changing ApiReturn to pic 9(9) binary. It still ends up with -989614556. (1) Does anyone have actual experience doing this? If so, do I need to be doing something different or in addition to what I'm already doing? (2) If my pic clause is not correct, what is the correct pic clause for "unsigned binary"? (3) Any other suggestions? TIA Jay Sulzmann Senior Programmer/Analyst IBM Certified AS/400 RPG-IV Developer Hainey Business Systems 8 E. Canal St Dover, PA 17315 Phone: (800) 932-3380 x231 Fax: (717) 292-9474 Web: http://www.hbs-inc.com ________________________________ Providing E-Commerce, EDI, AS/400 Development and related services nationwide. ================================ -- _______________________________________________ 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 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.