Divide By Zero Error In Cobol
Contents |
zero in ILE/COBOL... From: "Mark S. Waterbury"
Divide By Zero Error Encountered In Stored Procedure
13:06:28 -0400 List-archive:
Compute statement error - Divide by Zero AcuCobol Compute statement error - Divide by Zero Extend and http://community.microfocus.com/microfocus/cobol/extend_and_acucobol/w/knowledge_base/19864.acucobol-compute-statement-error-divide-by-zero.aspx ACUCOBOL Helps developers modernize COBOL applications, includes the ACUCOBOL-GT development system and COBOL Virtual Machine to deploy applications across all major Windows, UNIX and Linux platforms. https://rosettacode.org/wiki/Detect_division_by_zero Join group Get this RSS feed Home Forum Blog Wiki Files Members Options Share this Page Details Created by admin When: 16 Feb 2013 3:39 Revisions: by zero 1 Comments: 0 Extend and ACUCOBOL Knowledge Base Subscribe Article History AcuCobol Compute statement error - Divide by Zero Created On:25 July 2012 Problem: The calculation is coded as follows: COMPUTE BEN-ER-PER-COMMUTED ROUNDED = (BEN-ER-CASH-LSUM-COMMUTED / COMM-FACT) / BEN-ER-FULL-ANNUAL * 100 The values loaded into COMM-FACT and BEN-ER-FULL-ANNUAL are zero. If the value divide by zero inserted into BEN-ER-CASH-LSUM-COMMUTED is 63, the result is 300.00 It would seem as though where a value is loaded into the last integer digit the result is returned with a value other than zero. Resolution: In normal circumstances you cannot divide by zero and the SIZE ERROR option should be used. However, AcuCobol has the following configuration file setting A_CHECKDIV. This variable allows you to specify an alternate runtime response to a divide by zero condition when the statement does not include a SIZE ERROR clause. In COBOL, a division by zero produces a size error condition. The SIZE ERROR clause allows the programmer to specify actions to take when this condition occurs.If there is no SIZE ERROR clause, by default in ACUCOBOL-GT the results are undefined. You can use the A_CHECKDIV configuration variable to specify alternate handling. Incident #2582581 Old KB# 36150 Terms Of Use Privacy Statement Download Policy Microfocus.com Borland.com Support Line Corporate B
to:navigation, search Detect division by zero You are encouraged to solve this task according to the task description, using any language you may know. Task Write a function to detect a divide by zero error without checking if the denominator is zero. Contents 1 8th 2 ABAP 3 Ada 4 Aime 5 ALGOL 68 6 AutoHotkey 7 BASIC 7.1 Applesoft BASIC 7.2 BBC BASIC 7.3 Liberty BASIC 7.4 Locomotive Basic 7.5 PureBasic 7.6 Run BASIC 7.7 TI-89 BASIC 8 Batch File 9 C 9.1 Library: POSIX 10 C++ 11 C# 12 Ceylon 13 Clojure 14 COBOL 15 Common Lisp 16 D 17 Déjà Vu 18 Delphi 19 E 20 ECL 21 Eiffel 22 Ela 23 Elixir 24 Emacs Lisp 25 Erlang 26 ERRE 27 F# 28 Factor 29 Fancy 30 Forth 31 Fortran 32 FutureBasic 33 Go 34 Groovy 35 Haskell 36 HicEst 37 I 38 IDL 39 Icon and Unicon 40 J 41 Java 42 JavaScript 43 jq 44 Julia 45 LabVIEW 46 Lasso 47 Lingo 48 Lua 49 M4 50 Maple 51 Mathematica / Wolfram Language 52 MATLAB 53 Maxima 54 MAXScript 55 MUMPS 56 mIRC Scripting Language 57 NetLogo 58 NetRexx 59 Nim 60 OCaml 61 Oforth 62 Octave 63 ooRexx 64 Oz 65 PARI/GP 66 Pascal 67 Perl 68 Perl 6 68.1 Using Multi Method Dispatch 69 PHP 70 PicoLisp 71 PL/I 72 PL/SQL 73 PowerShell 74 Pure 75 Python 76 R 77 Racket 78 REBOL 79 REXX 80 Ring 81 Ruby 82 Scala 83 Seed7 84 Sidef 85 Slate 86 Smalltalk 87 SNOBOL4 88 Standard ML 89 Tcl 90 TXR 91 Ursa 92 VBScript 93 XPL0 94 Yorick 95 zkl 8th[edit] Division by zero results in the value "Inf": 1 0 n:/ Inf? . cr Output:true ABAP[edit] report zdiv_zerodata x type i.try. x = 1 / 0.catch CX_SY_ZERODIVIDE. write 'Divide by zero.'.endtry. Ada[edit] -- Divide By Zero Detectionwith Ada.Text_Io; use Ada.Text_Io;with Ada.Float_Text_Io; use Ada.Float_Text_Io;with Ada.Integer_Text_Io; use Ada.Integer_Text_Io;procedure Divide_By_Zero is Fnum: Float:= 1.0; Fdenom: Float:= 0.0; Fresult: Float; Inum: Integer:= 1; Idenom: Integer:= 0; Iresult: Integer;begin begin Put("Integer divide by zero: "); Iresult:= Inum / Idenom; Put(Item => Iresult); exception when Constraint_Error => Put("Division by zero detected."); end; New_Line; Put("Floating point divide by zero: "); Fresult:= Fnum / Fdenom; if Fresult > Float'Last then Put("Division by zero detected (infinite value)."); else Put(Item => Fresult, Aft => 9, Exp => 0); end if; New_Line;end Divide_By_Zero; Output: Integer divide by zero: Division by zero detected. Floating point divide by zero: Division by zero detected (infinite value). Aime[edit] integerdivide(integer n, integer d){ return n / d;}integercan_divide(integer n, integer d){ return!trap(divide, n, d);}inte