Xref: utzoo comp.databases:5550 comp.lang.c:27822 comp.sys.ibm.pc.programmer:927 sci.math.num-analysis:740 Path: utzoo!utgpu!news-server.csri.toronto.edu!mailrus!cs.utexas.edu!asuvax!noao!arizona!naucse!wew From: wew@naucse.UUCP (Bill Wilson) Newsgroups: comp.databases,comp.lang.c,comp.sys.ibm.pc.programmer,sci.math.num-analysis Subject: Re: BCD Encoding? Message-ID: <2032@naucse.UUCP> Date: 12 Apr 90 20:53:43 GMT References: <522@dbase.A-T.COM> Organization: Northern Arizona University, Flagstaff, AZ Lines: 62 From article <522@dbase.A-T.COM>, by awd@dbase.A-T.COM (Alastair Dallas): > The information is proprietary, but 1) even _I_ would vote to release it, > I think (and I'm pretty conservative); and 2) Ashton-Tate is planning to > release file format information in some form to some group of people > (developers under non-disclosure, everyone, or something inbetween) soon. > I will make it my business to find out more about our policy and respond > to the net. > Well guess what? I figured it out by myself. Here it is in case anyone else needs to do it. You will need a hex dumper to get it perfect. dBASE IV now has two numeric data types: fixed (BCD) and float. There are two forms to the fixed numbers in memory variable files: integer and fixed decimal. The integer uses a traight nibble=number encoding that follows the standards that I have been made aware of through helpful people on the net. The second form is more complex in some ways and just as simple in others. The following is a description of the format: Field N Bytes Description 1 11 Variable name 2 1 Variable type 3 1 Var sub type 4 19 not sure what this area is for... 5 1 variable size/info 6 1 sign 7 10 BCD number Field number five indicates the size of the variable. It is based on the number 34h. If the size is greater than 34h, subtract 34h from the number and that is the number of whole digits from the beginning of the BCD number. If the number is less than 34h then the differnce is the number of extra zeros to put after the implied decimal point and before the BCD number. For example, if you have the hex bytes: 36 0d 20 50 36h-34h=2 which means you take the first two nibbles as the whole portion and the rest as the decimal portion. So the number would be 20.50 Simple Huh? If the number was negative the 0d would be 8d. The first nibble indicates the sign. The following is a list of the variable type codes as listed in field two: c3 - string ce - float (IEEE format) cc - logical c4 - date c6 - BCD numeric (fixed) Some articles were published in Data Based Advisor (V5 N4, N5) that helped in decoding the memory variable files. If anyone else figures anything else out on these files, please let me know. -- Let sleeping dragons lie........ | The RoleMancer ---------------------------------------------------------------- Bill Wilson (Bitnet: ucc2wew@nauvm | wilson@nauvax) Northern AZ Univ Flagstaff, AZ 86011