|
Prev: Decimal versus binary arithmetic was Re: J4 - presentation/discussionon "Future of the COBOL Standard"
Next: Mainframe Tech Blog
From: John Reagan on 3 Apr 2008 11:20 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. -- John Reagan OpenVMS Pascal/Macro-32/COBOL Project Leader Hewlett-Packard Company |