--%>

Problem on COBOL source code errors

There are many errors in the following COBOL source code. Identify the errors and rewrite the program so that it contains no errors:
IDENTIFICATION DIVISION   (Full stop required)
PROGRAM ID. ERRORS-EXAMPLE.
DATA DIVISION    (Full stop required)
77 ITEM-DESC PIC X20. [ X(20) required for Picture to define]
77 ITEM COST PIC 999V99. [ITEM-COST required for the Variable Name.]
77 VAT 999V99.  (PIC required for Variable definition)
77 TOTAL PIC 999V99.
PROCEDURE-DIVISION.
BILL-SEQ  (Paragraph names start in Column 8 and require Full stop )
MOVE 0 TO TOTAL.
    INPUT ITEM-DESC  (these 2 are Variables not Files, cannot be in INPUT mode)
    INPUT ITEM-COST.
INPUT-ITER.
    IF ITEM-COST = 0 GOTO INPUT-END  (INPUT-END  not declared)
        ADD ITEM-COST TO TOTAL (must come after ACCEPT Item-cost)
        ACCEPT ITEM-DESC
        ACCEPT ITEM-COST
        GO TO INPUT ITER. (need to use INPUT-ITER paragraph name. )
    VAT = 0.15 X TOTAL (Full stop required and COMPUTE Required for expression)
    ADD VAT TO TOTAL (Full stop required)
    DISPLAY OUTPUT TOTAL (OUTPUT can’t use for variables and Full stop required)
    STOP-RUN. (wrong syntax, it is STOP RUN not STOP-RUN)
BILL-END (STOP RUN is last statement, Bill-end comes before that)

E

Expert

Verified

IDENTIFICATION DIVISION.
PROGRAM-ID. ERRORS-EXAMPLE.

DATA DIVISION.
WORKING-STORAGE SECTION.
77 ITEM-DESC PIC X(20).
77 ITEM-COST PIC 999V99.
77 VAT PIC 999V99.
77 TOTAL PIC 999V99.

PROCEDURE DIVISION.
BILL-SEQ.
       MOVE 0 TO TOTAL.
       ACCEPT ITEM-DESC.
       ACCEPT ITEM-COST.
INPUT-ITER.
       IF ITEM-COST = 0
       GOTO INPUT-END.
       ADD ITEM-COST TO TOTAL.
      
       ACCEPT ITEM-DESC.
       ACCEPT ITEM-COST.

       GO TO INPUT-ITER.

INPUT-END.

       COMPUTE VAT = 0.15 * TOTAL.
       ADD VAT TO TOTA.
       DISPLAY “OUTPUT” TOTAL.

 
  BILL-END.
       STOP-RUN.

   Related Questions in Programming Languages

  • Q : Type promotion rule Q. Explain type

    Q. Explain type conversion rules for basic data types in java. Ans. Type promotion rule: Java automatically each bits or short operant to int when evaluating an expression. As usual as the automatic promotion

  • Q : What is Static method Static method :

    Static method: The static method (also termed as a class method) is one with static reserved word in its header. The static methods vary from all other methods in that they are not related with any specific instance of the class to which they fit in.

  • Q : Define the term CPU Scheduler Define

    Define the term CPU Scheduler?

  • Q : Tower of Hanoi Puzzle program using C#

    Tower of Hanoi Puzzle program using C# and Windows Presentation Foundation (WPF) template in Visual Studio 2012 or newer.

  • Q : What is Reader class Reader class : It

    Reader class: It is sub-class of the Reader abstract, stated in the java.io package. Reader classes translate input from the host-dependent character set encoding into the Unicode.

  • Q : Explain Cast Cast : Where Java does not

    Cast: Where Java does not allow the utilization of a source value of one type, it is essential to use a cast to force the compiler to admit the use for the target type. The care must be taken with casting values of primitive types, as this frequently

  • Q : Directory and filename Explain

    Explain directory and filename?

  • Q : Define the term Image map Define the

    Define the term Image map: This is an image, divided into logical regions, each of which has a hot spot.

  • Q : Overriding a base class method in

    Explain the way to overriding a base class method in Visual Studio .NET and in Visual Studio 2005.

  • Q : What is Syntax error Syntax error: It

    Syntax error: It is an error detected by the compiler throughout its parsing of a program. The syntax errors generally result from mis-ordering symbols in statements and expressions. Missing curly semicolons and brackets are general illustrations of s