Using cvendian for Byte Order Conversion
This page describes how to use cvendian to convert or report on the byte order of an InterSystems database. You can use this utility for migration between Big-endian and Little-endian platforms.
Introduction to cvendian
The cvendian utility converts (or reports on) the byte order of an InterSystems database. This utility is the file install-dir\Bin\cvendian.exe.
You cannot use this utility on a mounted database.
Also, the utility does not work for backup and journal files. You must restore databases on a platform of the same endian, move the restored databases to the different endian platform, and then use cvendian to convert the databases.
The utility uses simple buffered I/O to read and write the target file. For best performance, ensure that operating system (OS) file-system caching is not disabled.
Conversion Process
You can run cvendian on either the system that has the files to be converted or the system that will be using the converted files.
For example, to convert a database from a Little-endian to a Big-endian system, you can perform the conversion on the Little-endian system and then transfer the database to the Big-endian system, or you can transfer the file first, and then convert it.
To convert a database, the process is:
-
Make a copy of your database files, because the utility replaces the source files with the converted files.
-
Run cvendian using the syntax described in the Utility Syntax section.
-
If the database file is encrypted, enter the encryption key and user/password when prompted. The utility does not provide command-line options for passing in these values.
Utility Syntax
With the cvendian utility, you can specify the desired byte order, or you can report the current byte order without conversion. Use the following syntax:
cvendian [-option] file
The option argument is one of the following:
-
-big — convert the database to Big-endian
-
-little — convert the database to Little-endian
-
-report — report the byte order of the database
You can shorten the options to their initial letter. If this is a conversion request (-big or -little), and the database already has the specified byte order, the utility displays a warning message and stops processing.
If you do not provide the option argument, the utility converts the database from the existing byte order to the other byte order. It is recommended, however, that you use the option argument.
The file argument is the file to convert, and can include a complete pathname.
The utility performs the following actions:
-
Auto-detects the byte order of the database
-
Displays endian information and other information
-
Performs the conversion
-
Displays a message indicating success or failure
For example, suppose you are converting a database for use on AIX from Windows. This means you must convert from Little-endian to Big-endian. The output from running cvendian on the Windows system before moving the file to the AIX system looks similar to this:
C:\IrisSys\Bin>cvendian -big c:\temp\powerdb\iris.dat
This database is little-endian.
This database has a block size of 8192 bytes.
This database has 1 volume and 1 map.
The last block in the primary volume is 18176.
Original manager directory is c:\temp\powerdb\
No extension volumes.
Done converting c:\temp\powerdb\iris.dat to big-endian
C:\IrisSys\Bin>
You can now move the converted database file to the AIX system.