From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.3 required=5.0 tests=BAYES_00,INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,7e021fc0e7fc15a1 X-Google-Attributes: gid103376,public From: Richard D Riehle Subject: Re: Ada 95 LRM Error? Date: 1999/01/28 Message-ID: <78oaj9$d9g@sjx-ixn5.ix.netcom.com>#1/1 X-Deja-AN: 437735132 References: <36AF6C22.896FC5B8@easystreet.com> Organization: Netcom X-NETCOM-Date: Wed Jan 27 4:22:01 PM PST 1999 Newsgroups: comp.lang.ada Date: 1999-01-27T16:22:01-08:00 List-Id: In article <36AF6C22.896FC5B8@easystreet.com>, Al Christians wrote: >I'm looking at the Ada 95 Reference Manual, B.4.106. It shows >a field: > > Name : COBOL.Numeric(1..20); > >Later on, in B.4.109, this gets assigned: > > Name => "Johnson, John ", > >This looks pretty obviously like an error, and I think it probably >should be Alphanumeric instead of Numeric. However, Numeric is what >it is, both in my printed version of the LRM and the online LRM >that comes with the brand-new edition of AdaGide. > >Is 20 even going to work for a Numeric size on typical platforms? That's >more than 64 bits. > >Am I wrong or is this in need of fixing? How would that happen? A look at the data types involved might be helpful. In the package Interfaces.COBOL there are several data types that seem to have the same set of values. Line 13: type COBOL_Character is implementation-defined character type; Line 16: type Alphanumeric is array (Positive range <>) of COBOL_Character := implementation-defined; Line 20: type Numeric is array (Positive range <>) of COBOL_Character := implementation-defined; Line 56: type Alphanumeric corresponds to COBOL's alphanumeric data category. Line 59: type Numeric corresponds to COBOL's numeric data category with display usage. The key words in line 59 are "display usage" which imply that the underlying representation will be one byte per number. Therefore, it is possible that the indicated statements will work in some environments, even though it would have been more appropriate to use alphanumeric. An alphanumeric COBOL number, such as '6', 05 X PICTURE 9. can be assigned directly to a numeric data item, 05 Y PICTURE X. in COBOL if both are USAGE DISPLAY. The Corresponding Ada types would also allow this if the assignment were between slices of the same component type. If there is an error, it may be that the Numeric data type was not more strictly defined to ensure that such assignments require a function call such as, function To_Alphanumeric(N : Numeric) return Alphanumeric; function To_Numeric (A : Alphanumeric) return Numeric; As it is, the package is defined so it conforms to the conventions of typical COBOL programming. Richard Riehle richard@adaworks.com http://www.adaworks.com