comp.lang.ada
 help / color / mirror / Atom feed
From: Richard D Riehle <LaoXhai@ix.netcom.com>
Subject: Re: Ada 95 LRM Error?
Date: 1999/01/28
Date: 1999-01-27T16:22:01-08:00	[thread overview]
Message-ID: <78oaj9$d9g@sjx-ixn5.ix.netcom.com> (raw)
In-Reply-To: 36AF6C22.896FC5B8@easystreet.com

In article <36AF6C22.896FC5B8@easystreet.com>,
	Al Christians <achrist@easystreet.com> 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





  parent reply	other threads:[~1999-01-28  0:00 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1999-01-27  0:00 Ada 95 LRM Error? Al Christians
1999-01-27  0:00 ` Martin C. Carlisle
1999-01-28  0:00   ` J. David Bryan
1999-01-28  0:00 ` Richard D Riehle [this message]
1999-01-27  0:00   ` Al Christians
1999-01-28  0:00     ` Richard D Riehle
1999-01-28  0:00       ` Interfaces.Cobol (Was LRM Error?) Al Christians
1999-01-29  0:00       ` Ada 95 LRM Error? robert_dewar
1999-01-31  0:00         ` Keith Thompson
1999-02-01  0:00           ` Types (was Ada 95 LRM Error?) Richard D Riehle
1999-02-02  0:00           ` Ada 95 LRM Error? robert_dewar
1999-01-28  0:00     ` robert_dewar
1999-01-28  0:00       ` Al Christians
1999-01-28  0:00 ` robert_dewar
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox