--%>

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 : What is Dotted decimal notation Dotted

    Dotted decimal notation: The notation employed to symbolize the 4-byte values of an IP address. Each and every byte is symbolized as a value between 0 to 255, for instance 129.12.0.1. The most noteworthy byte is written at first.

  • Q : Define Scope Scope : A language's scope

    Scope: A language's scope rules establish how broadly variables, methods and classes are visible in a class or program. The local variables contain a scope restricted to the block in which they are stated, for example. Private methods and variables co

  • Q : What is an Operator Operator : It is a

    Operator: It is a symbol, like -, = or ?: taking one, two or three operands and yielding an outcome. The operators are employed in both arithmetic and Boolean expressions.

  • Q : Explain Return statement Return

    Return statement: It is a statement employed to terminate the execution of the method. The method with void return type might only have return statements of the form as: return;

  • Q : What is an Arithmetic expression

    Expression: It is a combination of operands and operators which generates a resultant value. Expressions contain a resulting type that affects the context in which they might be employed.

  • Q : Define Double buffering Double

    Double buffering: A graphics method employed to smooth animation. The later version of an image is drawn `at the back the scenes' and then exhibited in its totality whenever the drawing is finished. The supposition is that it will be relatively fast t

  • Q : Explain the benefits of distributed

    Explain the benefits of distributed systems.

  • Q : State the term an XHTML Element State

    State the term an XHTML Element?

  • Q : Phenomenon of page fault Explain the

    Explain the phenomenon of page fault?

  • Q : How does XML maintain white-space in

    How does XML maintain white-space in any documents?