Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!usc!apple!voder!pyramid!mikel From: mikel@pyramid.pyramid.com (Mike Lipsie) Newsgroups: comp.lang.fortran Subject: Re: "PACKED COMP-3" format Message-ID: <120309@pyramid.pyramid.com> Date: 18 Jul 90 16:03:06 GMT References: <557@synopsys.COM> Reply-To: mikel@pyramid.pyramid.com (Mike Lipsie) Organization: Pyramid Technology Corp., Mountain View, CA Lines: 47 In article khb@chiba.Eng.Sun.COM (Keith Bierman - SPD Advanced Languages) writes: > >In article <557@synopsys.COM> stevej@synopsys.synopsys.com (Steven Jukoff) writes: >> Does anyone know how to define or describe the data format >> of the COBOL "PACKED COMP-3" format? > >In Micro Focus COBOL it simply means BCD (2 digits to a packed byte) >Trivial to convert to integer. The mileage may vary with other >vendors. The "USAGE IS COMP-x" clause often means floating point, >which scares the panties right off most good honest COBOL programmers. Now to embarass myself in public by admitting I [used to] know COBOL. :-) COMP is short for COMPUTATIONAL. COMPUTATIONAL[-x] is used for "performance" and indicates that you want to use one of the machines internal (hardware) representations. COMPUTATIONAL is integer (and 16, 32, or 64 bit was chosen on the basis of the number of digits required.) COMPUTATIONAL-1 and -2 are single and double precision floating point (respectively.) COMPUTATIONAL-3 is packed decimal. It is trivial to convert to integer if you have an integer form with enough digits. Also, since there is a decimal point, you must remember where it is and scale accordingly. The internal form of packed decimal was two decimal digits per byte _except_ the next to last nibble which was the sign and usually C, D, E, or F depending on plus or minus and read vs. computed. I got all this from the IBM 7044 COBOL but it was the same on the 360 series (at least for the F-level and above compilers.) Now that you have gotten far more COBOL than you ever wanted, we return you to your normal requests for a Fortran to C converter. :-) ----------- Mike Lipsie mikel@pyramid.com Pyramid Technology Corp, Mountain View, CA +1 415 335-8657 -- ----------- Mike Lipsie mikel@pyramid.com Pyramid Technology Corp, Mountain View, CA +1 415 965 7200 ext. 4980