Re: Converting .dat files to Paradox
Posted in 1993
In <1v0401INNlvf@emory.mathcs.emory.edu> alan@effluvia.den.mmc.com (Alan Popiel) writes: >->From: barrett@forge.gatech.edu (James Barrett) >->Subject: Converting .dat files to Paradox >->Date: Mon, 7 Jun 1993 17:17:12 GMT >->Reply-To: barrett@forge.gatech.edu (James Barrett) >->Organization: Georgia Tech College of Computing >-> >->I know *very* little about Informix, but have a need to convert a database >->from Informix to Paradox for Windows. Most of it is done, however the >->data type "money" is giving me some problems. Can anyone give me a >->description of the format this type is stored in, or point me to somewhere >->I can get this info? >-> >->I assume it is some sort of floating point number, but I haven't been able >->to figure out how exactly it is stored in the file. It's fixed point (sort of) not floating point. >Data type "MONEY" is essentially a DECIMAL(n,m), very much like a PACKED >DECIMAL in some languages. Default size if no "n" and "m" are specified is >MONEY(16,2). Width in bytes of a MONEY field is (n/2 + 1), rounded up. Similar to packed decimal in concept, but not in storage. When DECIMALTYPE numbers are stored in files, they are compressed or packed, as: First byte: top 1 bit is the sign of the number on = positive off = negative low 7 bits are the exponent in excess 64 format Remaining bytes: base 100 digits (in 100 complement format for negative numbers) The length in bytes of the packed DECIMALTYPE Number is 1 plus the number of base 100 digits. It can vary from 2 to 17 bytes. Zero is represented as 80,00,00,... (hex). I don't know what NULL looks like (00,00,00,... ???). Each byte holds 2 digits, located to the right or left of the decimal point. You cannot store a significant digit to the left of the decimal point in the same byte as a digit to the right of the decimal point. The decimal point is implied; it is not physically present in the data record. For a MONEY datatype (assuming you are not dealing with multi-currency) it is a fair bet that the scale factor is 2 (default). graeme -- Disclaimer: The author's opinions are his own, and not necessarily those of Pyramid Technology Ltd. or Pyramid Technology Inc. --------------------------------------------------------------------------- -m------- Graeme Sargent Voice: +44 (0)252 373035 ---mmm----- Senior Database Consultant Fax : +44 (0)252 373135 -----mmmmm--- Pyramid Technology Ltd. Telex: Tell who??? -------mmmmmmm- Farnborough, Hants GU14 7PL Email: graeme@pyra.co.uk --------------------------------------------------------------------------- We have the technology. The tricky bit is learning how to use it.