From: Jeff Campbell on
Clark F Morris wrote:
> On Wed, 02 Apr 2008 02:45:10 GMT, "William M. Klein"
> <wmklein(a)nospam.netcom.com> wrote:
>
>> Clark,
>> Can you try this (slight) variation - and compile
>>
>> 01 numerator value 1 Comp-5 pic 9(9).
>> 01 denominator value 5 Comp-5 pic 9(9).
>> 01 quotient Comp-5 pic 9(9)v9(4).
>>
>> compute quotient = numerator / denominator
>> display quotient
>>
>> My guess is that they would still be doing it in decimal, but this would "force"
>> the compiler into knowing the fields were to be truncated/handeld in "true"
>> binary rather than based on the PIC.
> Frank is the person who did the compilation since I don't have access
> to a z series computer (or a COBOL compiler). It would be interesting
> to see the code generation for a computer that is basically binary
> (Intel, HP, AIX boxes, etc.).

DECDIV Source Listing 3-APR-2008 06:13:52 -
Compaq COBOL V2.8-1286 Page 1

Source Listing 3-APR-2008 06:13:19 -
SYS$SYSDEVICE:[USERS.FROG.COBOL]DECDIV .COB;4

1 IDENTIFICATION DIVISION.
2 PROGRAM-ID. decdiv.
3 ENVIRONMENT DIVISION.
4 DATA DIVISION.
5 WORKING-STORAGE SECTION.
6 01 numerator pic 9(9) comp-5 value 10.
7 01 denominator pic 9(9) comp-5 value 5.
8 01 quotient pic 9(9)v9(4) comp-5.
....................................................1
%COBOL-F-NOSCALE, (1) Operand must be an integer

9
10 PROCEDURE DIVISION.
11 p0.
12 compute quotient = numerator / denominator
13 display quotient
14
15 stop run.
16
17 end program decdiv.

Won't compile on my Alpha PWS600au running OpenVMS 7.3-1.

Jeff



----== Posted via Pronews.Com - Unlimited-Unrestricted-Secure Usenet News==----
http://www.pronews.com The #1 Newsgroup Service in the World! >100,000 Newsgroups
---= - Total Privacy via Encryption =---
From: Jeff Campbell on
Clark F Morris wrote:
> On Thu, 03 Apr 2008 11:20:29 -0400, John Reagan <john.reagan(a)hp.com>
> wrote:
>
>> Jeff Campbell wrote:
>>
>>> DECDIV Source Listing 3-APR-2008 06:13:52 -
>>> Compaq COBOL V2.8-1286 Page 1
>>>
>>> Source Listing 3-APR-2008 06:13:19 -
>>> SYS$SYSDEVICE:[USERS.FROG.COBOL]DECDIV .COB;4
>>>
>>> 1 IDENTIFICATION DIVISION.
>>> 2 PROGRAM-ID. decdiv.
>>> 3 ENVIRONMENT DIVISION.
>>> 4 DATA DIVISION.
>>> 5 WORKING-STORAGE SECTION.
>>> 6 01 numerator pic 9(9) comp-5
>>> value 10.
>>> 7 01 denominator pic 9(9) comp-5
>>> value 5.
>>> 8 01 quotient pic 9(9)v9(4) comp-5.
>>> ....................................................1
>>> %COBOL-F-NOSCALE, (1) Operand must be an integer
>>>
>>> 9
>>> 10 PROCEDURE DIVISION.
>>> 11 p0.
>>> 12 compute quotient = numerator / denominator
>>> 13 display quotient
>>> 14
>>> 15 stop run.
>>> 16
>>> 17 end program decdiv.
>>>
>>> Won't compile on my Alpha PWS600au running OpenVMS 7.3-1.
>>>
>>> Jeff
>> Feels like a bug in the compiler to me (I'll add it to our list).
>> COMP-5 is mostly a synonym for COMP, but the compiler didn't honor that
>> for this case. If you change it to COMP you'll get an 8-byte binary
>> integer for quotient.
>
> I would be interested in the generated code for that operation. I
> want to see if my belief that the code has to be complex is correct.
>
> Clark Morris

Clark,

I've put the listing file on my web site at:

<http://n8wxs.com/web/txts/decdiv.txt>

Jeff





----== Posted via Pronews.Com - Unlimited-Unrestricted-Secure Usenet News==----
http://www.pronews.com The #1 Newsgroup Service in the World! >100,000 Newsgroups
---= - Total Privacy via Encryption =---