|
Lakshmi, As Scott said, the problem is not on your end. Modifying your program will damage the ability to use this interface with any other Non-PC client. The problem is that the PC is not a Big-Endian machine and the transform does nothing because the system is already in network order. ****************************** Big-endian The adjectives big-endian and little-endian refer to which bytes are most significant in multi-byte data types and describe the order in which a sequence of bytes is stored in a computer's memory. In a big-endian system, the most significant value in the sequence is stored at the lowest storage address (i.e., first). In a little-endian system, the least significant value in the sequence is stored first. For example, consider the number 1025 (2 to the tenth power plus one) stored in a 4-byte integer: 00000000 00000000 00000100 00000001 Address Big-Endian representation of 1025 Little-Endian representation of 1025 00 00000000 00000000 01 00000100 00000001 02 00000001 00000100 03 00000000 00000000 Many mainframe computers, particularly IBM mainframes, use a big-endian architecture. Most modern computers, including PCs, use the little-endian system. Taken from: http://www.webopedia.com/TERM/b/big_endian.html John Brandt iStudio400.com -----Original Message----- From: srilaxmi@xxxxxxx [mailto:srilaxmi@xxxxxxx] Sent: Monday, February 09, 2004 9:59 PM To: RPG programming on the AS400 / iSeries Cc: RPG programming on the AS400 / iSeries; rpg400-l-bounces@xxxxxxxxxxxx Subject: Re: Bytes Swapping in iSeries Hi Scott, I understood what you are saying. My problem is the third party(PC) they do not want to do the bytes swapping, so my end (On AS/400) need to do the swapping and send.Is there any other way to do the bytes swapping on AS/400. Thanks Lakshmi Scott Klement <klemscot@klements. To: RPG programming on the AS400 / iSeries com> <rpg400-l@xxxxxxxxxxxx> Sent by: cc: rpg400-l-bounces@mi Subject: Re: Bytes Swapping in iSeries drange.com 10/02/2004 11:35 AM Please respond to RPG programming on the AS400 / iSeries I already explained this to you off-list, but I'll explain it again here: htons converts from host byte-order to network byte-order. ntohs converts from network to host. The byte order used by the iSeries is the SAME as the byte order used by the network -- therefore htons and ntohs are NO-OPs. They do nothing. It's the PC that uses a different byte order from the network. It's the PC program that needs to call htons, not your RPG program. On Tue, 10 Feb 2004 srilaxmi@xxxxxxx wrote: > > I have a ILERPG Socket program, that sends data in the form of data > structures to the third party API (written in delphi). The data is > transmitting fine, but reaching in different format. > > Example : > > Input: > Field A = 0 200 > 1st Byte 2nd Byte > > Where the Field A is declared as Unsigned 5 U 0 in RPG Pgm. > When it transmit over a socket, the bytes are swapping and becoming 200 0. > > Result: > Field A = 200 0 > 1st Byte 2nd Byte > > This is the problem I am getting. To do the bytes swapping, Can I use htons > () in RPG Pgm. If yes, please explain with examples. > > Thanks & Regards > Lakshmi _______________________________________________ This is the RPG programming on the AS400 / iSeries (RPG400-L) mailing list To post a message email: RPG400-L@xxxxxxxxxxxx To subscribe, unsubscribe, or change list options, visit: http://lists.midrange.com/mailman/listinfo/rpg400-l or email: RPG400-L-request@xxxxxxxxxxxx Before posting, please take a moment to review the archives at http://archive.midrange.com/rpg400-l. Confidentiality Caution ======================= Privileged/Confidential Information may be contained in this message. If you are not the addressee indicated in this message (or responsible for delivery of the message to such person), you may not copy or deliver this message to anyone. In such case, you should destroy this message and kindly notify the sender by reply email. Opinions, conclusions and other information in this message that is not of an official nature shall be deemed as neither given nor endorsed by SGX unless indicated by an authorised representative independent of this message. _______________________________________________ This is the RPG programming on the AS400 / iSeries (RPG400-L) mailing list To post a message email: RPG400-L@xxxxxxxxxxxx To subscribe, unsubscribe, or change list options, visit: http://lists.midrange.com/mailman/listinfo/rpg400-l or email: RPG400-L-request@xxxxxxxxxxxx Before posting, please take a moment to review the archives at http://archive.midrange.com/rpg400-l. --- Incoming mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.576 / Virus Database: 365 - Release Date: 1/30/04 --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.580 / Virus Database: 367 - Release Date: 2/6/04
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.