LinuxQuestions.org
Latest LQ Deal: Complete CCNA, CCNP & Red Hat Certification Training Bundle
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 08-08-2011, 02:10 PM   #1
pandunr
LQ Newbie
 
Registered: May 2011
Posts: 12

Rep: Reputation: Disabled
Conversion of big endian data from Unix to little endian data


Currently we have migrated data from Unix linux. The data in Unix is in Big endian byte structure. Where are as Linux (suse linux) byte structure us little endian. This byte order mismatch is creating problem when data is read again in microfocus cobol.

Is there any way to set byte order in Linux is big endian?

Is there any utility to convert data in big endian byte structure to little endian byte order.
 
Old 08-08-2011, 05:10 PM   #2
bvm2607
LQ Newbie
 
Registered: Sep 2008
Posts: 6

Rep: Reputation: 2
dd conv=swab if=<inputfile> of=<outputfile>
 
Old 08-12-2011, 07:00 AM   #3
pandunr
LQ Newbie
 
Registered: May 2011
Posts: 12

Original Poster
Rep: Reputation: Disabled
dd conv=swab if=<inputfile> of=<outputfile>

When we use dd conv=swab if=<inputfile> of=<outputfile> it is swapping only 2 bytes. We need swapp 8 bytes at times. We used cbs=8 in option, we also tried with ibs & obs option but complete data isn't swapped.
Am I missing some option. Please help.
 
Old 08-12-2011, 05:00 PM   #4
jefro
Moderator
 
Registered: Mar 2008
Posts: 17,195

Rep: Reputation: 2562Reputation: 2562Reputation: 2562Reputation: 2562Reputation: 2562Reputation: 2562Reputation: 2562Reputation: 2562Reputation: 2562Reputation: 2562Reputation: 2562
I think I read you need a much more complex way to first test the data then change it according to some features of the data. I have seen some python scrips and java scripts to do that. As I recall there are some caveats to the data based on type and size that needs to be checked.

I could be wrong too.


One site I think I read you can transfer via some network for example and the host and client should then work on the data correctly on each end to match the processor type.

Last edited by jefro; 08-12-2011 at 05:01 PM.
 
Old 08-12-2011, 09:23 PM   #5
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 15,999

Rep: Reputation: 2219Reputation: 2219Reputation: 2219Reputation: 2219Reputation: 2219Reputation: 2219Reputation: 2219Reputation: 2219Reputation: 2219Reputation: 2219Reputation: 2219
Quote:
Originally Posted by pandunr View Post
Currently we have migrated data from Unix linux. The data in Unix is in Big endian byte structure. Where are as Linux (suse linux) byte structure us little endian. This byte order mismatch is creating problem when data is read again in microfocus cobol.
Note that the machine architecture determines endian-ness, not the Operating System/distro. This is not really a Unix vs Linux issue strictly speaking.
Quote:
Is there any way to set byte order in Linux is big endian?
Only by running it on big-endian hardware probably
Quote:
Is there any utility to convert data in big endian byte structure to little endian byte order.
Nope, you'll have to write your own. And you'll need to know the map of the data as it was constructed. Whether it was text or binary or integer (and what size integer) or maybe even packed decimal. These fields will almost certainly all be different sizes, and will need to be handled separately.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] A question about big-endian little-endian and how it affects things joeBuffer Programming 12 08-20-2009 02:02 PM
small-endian to big-endian conversion of data to store in a structure NancyT Programming 2 11-26-2008 11:06 AM
problem in understanding little endian/big endian machine program indian Programming 6 04-19-2006 03:50 PM
What is all this big endian-little endian stuff about? vdemuth Linux - Newbie 1 04-28-2004 03:16 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 09:44 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration