Fw: COBOL II and COMPS

2005-05-13 Thread Bill Klein
All of this is "fixed" in the 2002 COBOL Standard where *NEW* binary
data-types are introduces (with NO picture clause - just something
indicating "size" and whether or not they are signed).  An existing SHARE
requirement exists for IBM to implement these. (It even includes a one-byte
binary field - which has always required "odd" coding in COBOL).

If your site wants to create a (marketing) REQUEST to indicate a need/desire
for these, contact me off-list at:

   wmklein  ix.netcom.com

and I can give you a SHARE requirement number to add to your "MR" request.

"john gilmore" <[EMAIL PROTECTED]> wrote in message
news:<[EMAIL PROTECTED]>...
> Bill Klein writes:
> 
> >
> >On the other hand, the only time that a COMP-5 data item works
differently
> >from a BINARY or COMP (or COMP-4) item (on the mainframe) is *IF* you try
> >and use values greater than the PICTURE clause allows.  This is an "ugly"
> >thing to do and is NEVER recommended.
> >
> 
> My response is that I strongly recommend that just this be done, and here
we 
> have what is not so much an intellectual as a visceral, attitudinal 
> difference.
> 
> In PL/I, fror example, one writes
> 
> declare binary_counter binary fixed(31,0) ;  /* fullword counter */
> 
> declare packed_counter decimal fixed(7,0) ; /* seven-digit packed counter
*/
> 
> In the first declaration (31,0) denotes the number of binary digits and
the 
> number of binary digits following the binary point; and in the second 
> declaration (7,0) denotes the nu,mber of decimal digits and the number of 
> decimal digits following the decimal point.
> 
> COBOL does not make this distinction.  Picture specifications are decimal 
> and decimal only EVEN FOR BINARY DATA TYPES.  Unfortunately perhaps but 
> unsurprisingly, the powers of 2 and those of 10 are different; and a
decimal 
> picture specification cann therefore newver accurately represent the 
> precision of a binary data type:  It must significantly understate or,
much 
> worse, overstate, it.
> 

> COBOL is the only statement-level procedural language that has come to
terms 
> only very grudgingly and still oinly very partially with binary data types

> that the hardware, be it an Intel microprocessor or an IBM maniframe,
makes 
> available.
> 
> 

--
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to [EMAIL PROTECTED] with the message: GET IBM-MAIN INFO
Search the archives at http://bama.ua.edu/archives/ibm-main.html


Re: COBOL II and COMPS

2005-05-13 Thread john gilmore
Bill Klein writes:
On the other hand, the only time that a COMP-5 data item works differently
from a BINARY or COMP (or COMP-4) item (on the mainframe) is *IF* you try
and use values greater than the PICTURE clause allows.  This is an "ugly"
thing to do and is NEVER recommended.
My response is that I strongly recommend that just this be done, and here we 
have what is not so much an intellectual as a visceral, attitudinal 
difference.

In PL/I, fror example, one writes
declare binary_counter binary fixed(31,0) ;  /* fullword counter */
declare packed_counter decimal fixed(7,0) ; /* seven-digit packed counter */
In the first declaration (31,0) denotes the number of binary digits and the 
number of binary digits following the binary point; and in the second 
declaration (7,0) denotes the nu,mber of decimal digits and the number of 
decimal digits following the decimal point.

COBOL does not make this distinction.  Picture specifications are decimal 
and decimal only EVEN FOR BINARY DATA TYPES.  Unfortunately perhaps but 
unsurprisingly, the powers of 2 and those of 10 are different; and a decimal 
picture specification cann therefore newver accurately represent the 
precision of a binary data type:  It must significantly understate or, much 
worse, overstate, it.

In the tables
|---|
| hardware capacity  
   |
|---|
| b  |  unsigned |   
signed |
|---|
| 1 | 0 <= Y <= 255 |-128 <= 
y <= +127 |
| 2 |0 <= H <= 65,535 |   -32,768 <= h <= 
+32,767 |
| 4 |  0 <= F <= 4,294,967,295 | -2,147,483,648 <= f < = +2,147,483,647 |
|-|-|

|--|
|COBOL picture capacity  
|
|--|
| b  |  unsigned |   
   signed |
|--|
| 1  |  0 <= Y <= 99 |  -99 
<= y <= +99 |
| 2  | 0 <= H <= 9,999 | -9,999 <= h <= 
+9,999 |
| 4  |0 <= F <= 999,999,999 | -999,999,999 <= f < = +999,999,999 |
|--|

COBOL is the only statement-level procedural language that has come to terms 
only very grudgingly and still oinly very partially with binary data types 
that the hardware, be it an Intel microprocessor or an IBM maniframe, makes 
available.

John Gilmore
Ashland, MA 01721
U.S.A.
_
Don’t just search. Find. Check out the new MSN Search! 
http://search.msn.click-url.com/go/onm00200636ave/direct/01/

--
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to [EMAIL PROTECTED] with the message: GET IBM-MAIN INFO
Search the archives at http://bama.ua.edu/archives/ibm-main.html