Using cvendian for Byte Order Conversion
This chapter describes a utility to convert the byte order of an InterSystems database for migration between Big-endian and Little-endian platforms. It also provides an option to report on the byte order of a given database.
Introduction to cvendian
InterSystems provides a utility to convert the byte order of an InterSystems database from Big-endian (that is, most-significant byte first) to Little-endian (that is, least-significant byte first), and vice versa. It is called cvendian, for convert endian. This is useful when moving a database among platforms of the two types. It also provides an option to report on the byte order of a given database.
For information about the Endianness of supported platforms, see “Platform Endianness” in the online InterSystems Supported Platforms document for this release.
You cannot use this utility on a mounted database.
Location of Utility
The cvendian utility is the file install-dir\Bin\cvendian.exe.
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.
This 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 the cvendian utility to convert the databases.
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.
With the cvendian endian 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 IBM AIX® for Power System-64 from Windows Server 2016. This means you must convert from Little-endian (for Intel) to Big-endian (for POWER). 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.