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-28T17:48:15-06:00	[thread overview]
Message-ID: <78qsvv$pim@dfw-ixnews10.ix.netcom.com> (raw)
In-Reply-To: 36AFC42A.57696F4D@easystreet.com

In article <36AFC42A.57696F4D@easystreet.com>,
	Al Christians <achrist@easystreet.com> wrote:

>Richard D Riehle wrote about Interfaces.Cobol:
>> 
>>  As it is, the package is defined so it conforms to the conventions of
>>  typical COBOL programming.
>> 
>
>But if I put non-numeric data into a Numeric, it will flunk the
>Valid() test, right?
>
>Since you speak of 'typical COBOL programming', can you enlighten me a 
>little about why this interface looks the way it does?  
>
 "Well, now, then, there ..."

 COBOL is not a strongly-typed language.  There are, of course, data
 types in the form of PICTURE characters, but a COBOL programmer has
 great latitude in performing operations that mix alphanumeric numbers
 and ordinary alphanumeric characters.

           05 Some-Number     PICTURE  S99V99 USAGE DISPLAY.
           05 Some-String     PICTURE  9(6).

 We may freely MOVE  (actually MOVE means "copy") the numeric data
 to the string data without regard to the typing.  On the other hand,
 we will get a compile time error if we try to do arithmetic on the
 string.  The rules for this kind of thing in COBOL are actually rather
 complex;  what is truncated, what is left justified or right justified,
 all kinds of interesting permutations.  

 If the data type corresponds to COBOL, USAGE DISPLAY, the example shown
 in the example will work.  This does not mean it is good style.  It
 isn't good Ada style, but this package is intended to assist in the
 interface between Ada and COBOL so a certain amount of flexibility
 is necessary.   

 As for the function, Interfaces.Cobol.Decimal_Conversions.Valid,
 invocation depends on the decimal type used for instantiation as
 well as the actual implementation of type Display_Format.  One 
 reason why this is unusual is COBOL's flexibility in where the
 sign is located in USAGE DISPLAY format. It could be a trailing or
 leading sign.  

 The people who worked on this package had their work cut out for them.
 They seem to have done it well, given the huge differences between the
 COBOL language and Ada.  

 On the positive side, COBOL was designed quite well in the time it was
 conceived.  Consider that it has been one of the most successful
 programming languages ever used.  It would be wonderful if Ada could
 be even a tenth as successful as COBOL.  

 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 ` robert_dewar
1999-01-28  0:00 ` Richard D Riehle
1999-01-27  0:00   ` Al Christians
1999-01-28  0:00     ` robert_dewar
1999-01-28  0:00       ` Al Christians
1999-01-28  0:00     ` Richard D Riehle [this message]
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
replies disabled

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