Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Hello I need some help with this COBOL program. It keeps giving me an error in my code. I need to write a program to

Hello I need some help with this COBOL program. It keeps giving me an error in my code. I need to write a program to accept a salary field and to calculate and display income tax as 20 percent of the salary. Here is the code I have.

IDENTIFICATION DIVISION.

PROGRAM-ID. DuongSA1.

ENVIRONMENT DIVISION.

INPUT-OUTPUT SECTION.

FILE-CONTROL.

SELECT IN3 ASSIGN TO DISK

ORGANIZATION IS LINE SEQUENTIAL.

SELECT OUT3 ASSIGN TO DISK

ORGANIZATION IS LINE SEQUENTIAL.

DATA DIVISION.

FILE SECTION.

FD IN3

LABEL RECORDS ARE STANDARD

VALUE OF FILE-ID IS "IN3.TXT".

01 IN3-REC.

05 EMPNO-IN PIC 9(3).

05 EMPNAME-IN PIC X(10).

05 BASIC-IN PIC 9999V99.

FD OUT3

LABEL RECORDS ARE STANDARD

VALUE OF FILE-ID IS "OUT3.TXT".

01 OUTREC PIC X(80).

WORKING-STORAGE SECTION.

77 ARE-THERE-MORE-REC PIC XXX VALUE 'YES'.

77 DA PIC 9(4)V99.

77 HRA PIC 9(4)V99.

77 MA PIC 9(4)V99.

77 PT PIC 9(4)V99.

77 PF PIC 9(4)V99.

77 IT PIC 9(4)V99.

* 77 GS PIC 9(5)V99.

* 77 DID PIC 9(5)V99.

01 OUT3-REC.

05 EMPNO-OUT PIC 9(3).

05 FILLER PIC X(5).

05 EMPNAME-OUT PIC X(10).

05 FILLER PIC X(5).

05 BASIC-OUT PIC 9(4).99.

05 FILLER PIC X(5).

05 GS-OUT PIC 9(5)V99.

05 FILLER PIC X(5).

05 DID-OUT PIC 9(5)V99.

05 FILLER PIC X(5).

05 NET-SAL PIC 9(5).99.

01 H1.

05 STAR PIC X(80) VALUE ALL '*'.

01 H2.

05 EMPNO PIC X(5) VALUE "EMPNO".

05 FILLER PIC X(5).

05 EMPNAME PIC X(10) VALUE "EMP NAME".

05 FILLER PIC X(5).

05 BASIC PIC X(5) VALUE "BASIC".

05 FILLER PIC X(2).

05 GS PIC X(15) VALUE "GROSS SALARY".

05 FILLER PIC X(2).

05 DID PIC X(10) VALUE "DIDUCTION".

05 FILLER PIC X(5).

05 NET PIC X(15) VALUE "NET SALARY".

PROCEDURE DIVISION.

MAIN-PARA.

OPEN INPUT IN3

OUTPUT OUT3.

WRITE OUTREC FROM H1.

WRITE OUTREC FROM H2.

WRITE OUTREC FROM H1.

READ IN3

AT END MOVE 'NO' TO ARE-THERE-MORE-REC.

PERFORM PARA-1 UNTIL ARE-THERE-MORE-REC = 'NO'.

CLOSE IN3.

CLOSE OUT3.

STOP RUN.

PARA-1. MOVE EMPNO-IN TO EMPNO-OUT.

MOVE EMPNAME-IN TO EMPNAME-OUT.

MOVE 80 TO PT COMPUTE PF = ( BASIC-IN ) * ( 12 / 100 )

COMPUTE IT = ( BASIC-IN ) * ( 20 / 100).

ADD BASIC-IN DA HRA MA GIVING GS-OUT.

* MOVE GS TO GS-OUT.

ADD PF PT IT GIVING DID-OUT.

* MOVE DID TO DID-OUT.

SUBTRACT DID-OUT FROM GS-OUT GIVING NET-SAL.

WRITE OUTREC FROM OUT3-REC.

READ IN3 AT END MOVE 'NO' TO ARE-THERE-MORE-REC.

It gives me the error Invalid indicator 'R' at column 7 at line 75. I have tried to edit the code, but the error will not go away. There is also a syntax error on line 29.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Information Modeling And Relational Databases

Authors: Terry Halpin, Tony Morgan

2nd Edition

0123735688, 978-0123735683

More Books

Students also viewed these Databases questions