0% found this document useful (0 votes)
79 views16 pages

COBOL Test3 Scheme Solutions

This document contains the question paper for the subject BDP With COBOL. It has questions divided into three parts - Part A containing 2 questions, Part B containing 3 questions and Part C containing 3 questions. Candidates have to answer 5 questions choosing at least one from Part A, two from Part B and two from Part C. The document also contains the model answer for two questions from Part A explaining indexed sequential files and subroutines in COBOL.

Uploaded by

arunn1588
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
79 views16 pages

COBOL Test3 Scheme Solutions

This document contains the question paper for the subject BDP With COBOL. It has questions divided into three parts - Part A containing 2 questions, Part B containing 3 questions and Part C containing 3 questions. Candidates have to answer 5 questions choosing at least one from Part A, two from Part B and two from Part C. The document also contains the model answer for two questions from Part A explaining indexed sequential files and subroutines in COBOL.

Uploaded by

arunn1588
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
You are on page 1/ 16

DEPARTMENT OF MCA, PESIT, BANGALORE – 85

II– SEMESTER- MCA III – TEST- May.- 2010


Subject: BDP With COBOL Sub.Code: 07MCA21
Time: 90 Minutes Section-A/B Max.Marks: 50
Scheme
Note: 1. Answer FIVE questions choosing atleast ONE from PART-A, TWO from PART-B and TWO
from PART-C.
2. All questions carry equal marks.

PART-A Marks

Q.1. what are Indexed Sequential Files? Explain the file-control paragraph for Indexed
files. (5+5)
Q.2. with suitable program example, Explain the concept of subroutine in COBOL. (5+5)

PART-B

Q.3. Explain briefly the various report groups used by a report writer in COBOL. Give an example
(5+5 )
Q.4. Explain the SORT verb and MERGE verb with respect to Sequential files. (5+5)
Q.5. Explain procedure division statements for relative file. (6+4)

PART-C

Q.6. Write a program to create an indexed organized file with


Reg_No PIC X(9)
Name PIC X(15)
DOB PIC 9(6)
With Reg_NO as record key and perform (i) Add a new Record (ii) Delete a Record
(2+3+5)
Q.7. Write a COBOL program to create a Sequential file containing the following fields
Customer Name X(20)
City X(10)
Account Number 9(6)
Balance 9(6)V9(3)
Read the file and count the number of customers having Balance > Rs 50,000
(2+3+5)
Q.8.Write a COBOL program to generate a Sales Report.
(2+3+5)

***********
DEPARTMENT OF MCA, PESIT, BANGALORE – 85

II– SEMESTER- MCA III – TEST- May.- 2010


Subject: BDP With COBOL Sub.Code: 07MCA21
Time: 90 Minutes Section-A/B Max.Marks: 50
Solution
Note: 1. Answer FIVE questions choosing atleast ONE from PART-A, TWO from PART-B and TWO
from PART-C.
2. All questions carry equal marks.

PART-A

Q.1. what are Indexed Sequential Files? Explain the file-control paragraph for Indexed
files. (10)
Ans:-
Indexed sequential files are the files in which records are stored in the key sequence order (usually in
ascending order).in addition , some index tables are also created and maintained with the file.
Thus in order to have access to a recod, first , the group to which a record belongs is identified with the help
of the index tables.

FILE – CONTROL paragraph for Indexed files

The general format for the SELECT clause for an indexed file is as follows :-

SELECT file-name ASSIGN to implementor-name


AREA
; RESERVE integer-1 AREAS

, ORGANIZATION is INDEXED
SEQUENTIAL
; ACCESS MODE IS RANDOM
DYNAMIC
; RECORD KEY IS data-name-1

[ ; ALTERNATE RECORD KEY IS data-name-2


[WITH DUPLICATES] ]…..
[ ; FILE STATUS IS data-name-3 ]

Description :-

The ORGANIZATION clause indicates that the file is an indexed file.


The RECORD KEY clause species the record key data item on the basis of which the file is
sequenced.
Thee data-name-1 must be an alphanumeric field within the record description for the file.in case
there are multiple record descriptions, the key field from any of the description can be specified. The
field which is specified in the RECORD KEY clause (data-name-1) is also known as the primary
key. while the file is sorted and stored on the basis of the primary key,
The records of an Indexed file can be accessed either by specifying the primary key or
ALTERNATIVE KEY.
If the file has to have records with duplicate alternate key, the WITH DUPLICATES phrase should
be specified.

Q.2. with suitable program example, Explain the concept of subroutine in COBOL. (10)
Ans:-
Subroutine is a program which is Compiled, debugged and stored in library to be called when needed
and will perform particular task.

Structure of COBOL Subroutine

 A distinguishing feature that makes a COBOL subroutine different from a main program is
the PROCEDURE DIVISION header. The procedure division header must have USING
phrase.
 The genral format is as follows :-
PROCEDURE DIVISION [ USING data-name-1 [ , data-name-2 ] …]
 Description :-
 operands data-name -1, data name-2 …etc of USING phrase are those data
names which are to be connected with the corresponding data names in the
program calling this subroutine.
 The operands of USING phrase must be either 01-level or 77-level data items.
these must be defined in a section of the DATA DIVISION known as the
LINKAGE SECTION.
 The linkage section appears in the called program (subroutine) and describes
records or non-contiguous data items in respect of which connection should be
established with the calling program (main program or another sub-routine).
 Format of Linkage section :-
LINKAGE SECTION.

77 –level-data-description-entry
Record-description-entry ……

 Description :-
 The data description entries are simmiller to those of working-storage
section except that the VALUE clause is not allowed to be specied for any
entry in the Linkage section.
 In the case of a main program , the logical end of a program is indicated by
a STOP RUN statement .Normally, upon the execution of a subroutine it is
required that the control must be returned to the calling program. For this
purpose the EXIT PROGRAM statement is available in COBOL.
Format is :-
EXIT PROGRAM .
Example :-

IDENTIFICATION DIVISION.
PROGRAM-ID.B.
ENVIRONMENT DIVISION.
DATA DIVISION.
WORKING-STORAGE SECTION.
01 A PIC S99.
01 B PIC S99.
01 C PIC S99.
01 X1 PIC S999V99.
01 X2 PIC -999V99.
01 X PIC -999V99.
PROCEDURE DIVISION.
MAIN-PARA.
DISPLAY "ENTER THE A VALUE".
ACCEPT A.
DISPLAY "ENTER THE B VALUE".
ACCEPT B.
DISPLAY "ENTER THE C VALUE".
ACCEPT C.
CALL "SUB" USING A B C X1 X2.
DISPLAY "THE X1 VALUE IS " X1.
DISPLAY "THE X2 VALUE IS " X2.
STOP RUN.

SUBROUTINE

IDENTIFICATION DIVISION.
PROGRAM-ID.SUB.
ENVIRONMENT DIVISION.
DATA DIVISION.
WORKING-STORAGE SECTION.
01 X PIC S999V99.
01 Y PIC S999V99.
LINKAGE SECTION.
01 A PIC S99.
01 B PIC S99.
01 C PIC S99.
01 X1 PIC -999V99.
01 X2 PIC -999V99.

PROCEDURE DIVISION USING A B C X1 X2.


COMPUTE X = B + (((B * B) - 4 * A * C)** 1/2).
COMPUTE X1 = X / (2 * A).
COMPUTE Y = B - (((B * B) - 4 * A * C)** 1/2).
COMPUTE X2 = Y / (2 * A).
DISPLAY "THE X1 IS" X1.
DISPLAY "THE X2 IS "X2.
EXIT PROGRAM.
PART-B

Q.3. Explain briefly the various report groups used by a report writer in COBOL. Give an example (10 )
Ans:-
The various report groups used by a report are.
1. REPORT HEADING:-
This group represents the title of the report and is printed only once in
the very beginning.
Ex:-
01 TYPE IS RH.
02 LINE NUMBER IS 4.
03 COLUMN NUMBER IS 18 PIC X(11) VALUE "MOBILE-TECH".
02 LINE NUMBER IS PLUS 1.
03 COLUMN NUMBER IS 21 PIC X(5) VALUE "INDIA".

2. REPORT FOOTING:-
This group is also printed only once and at the very end of the report. This
group usually includes a collection of totals.

3. PAGE HEADING:-
This group is printed on the top of each logical page. This group can include
The page number, usual column headings and brought-forward totals from the pervious page.

Ex:-
01 TYPE IS PH.
02 LINE NUMBER IS 4.
03 COLUMN NUMBER IS 1 PIC X(4) VALUE "YEAR".
03 COLUMN NUMBER IS 10 PIC X(5) VALUE "NOKIA".
03 COLUMN NUMBER IS 20 PIC X(8) VALUE "MOTROLLA".
03 COLUMN NUMBER IS 30 PIC X(7) VALUE "SAMSUNG".
03 COLUMN NUMBER IS 40 PIC X(8) VALUE "RELIANCE".

4. PAGE FOOTING:-
This group is printed at the bottom of each page. The group can include
carry-forward totals.

5. CONTROL FOOTING:-
An important function of the report-writer feature is that it takes care
of control breaks in the input file from which report is being generated. Whenever there is
any change in a specified key field, The control break occurs and at that point the control-
footing group is printed. The group can include sub-totals of some fields.

Ex:-

01 TOTAL-LINE TYPE IS CONTROL FOOTING FINAL.


02 LINE NUMBER IS PLUS 2.
03 COLUMN NUMBER IS 2 PIC X(5) VALUE "TOTAL".
03 COLUMN NUMBER IS 10 PIC Z(6) SUM NOKIA.
03 COLUMN NUMBER IS 20 PIC Z(6) SUM MOTROLLA.
03 COLUMN NUMBER IS 30 PIC Z(6) SUM SAMSUNG.
03 COLUMN NUMBER IS 40 PIC Z(6) SUM RELIANCE.

6. CONTROL HEADING:-
This group is also printed on a control break but only before the
next detail group is printed.

For ex:- if a control break occurs on the sales number, then we might like to get the name
of the next salesman printed.

7. DETAIL:-
This group constitutes main group of the report. The records of the input file
can be listed in this group. A record may be printed in one or more lines.

Except for the detail group all other groups are optional. We can use only once the
REPORT HEADING , REPORT FOOTING, PAGE HEADING, PAGE FOOTING groups
for a report. There can be as many as CONTROL FOOTING, CONTROL FOOTING
groups as there are control fields. But, several detail groups can be specified for a report.

Ex:-
01 DETAIL-FILE TYPE IS DETAIL.
02 LINE NUMBER IS PLUS 1.
03 COLUMN NUMBER IS 1 PIC 9(4) SOURCE IS YY.
03 COLUMN NUMBER IS 10 PIC 9(5) SOURCE IS NOKIA.
03 COLUMN NUMBER IS 20 PIC 9(5) SOURCE IS MOTROLLA.
03 COLUMN NUMBER IS 30 PIC 9(5) SOURCE IS SAMSUNG.
03 COLUMN NUMBER IS 40 PIC 9(5) SOURCE IS RELIANCE.

Q.4. Explain the SORT verb and MERGE verb with respect to Sequential files.
Ans :-
SORTING : -
The process of sequencing the records in some desired manner is known as sorting.
Sorting is done upon some key data item in the record.
 For eg, payroll file where each record contains all the necessary information of an employee, such as
name, id , deptno, basicpay etc.
 The format of the simple SORT verb is,

SORT file-name-1 ON ASCENDING KEY data-name-1 [ , data-name-2 ]….


DESCENDING
ASCENDING
ON DESCENDING KEY data-name-3 [ , data-name-4]….. …….

USING file-name-2 GIVING file-name-3.

Description :-
SORT verb requires naming of 3 files namely , unsorted input-file, sorted output-file and work file.
File-name-1 is the name of the work file, where as the name of the input and output files are to be specified
in file-name-2 and file-name-3 respectively.
File-name-2 and file-name-3 are described in the usual manner by means of an FD entry.
The work-file is to be defined by a sort description entry (SD entry).
 The format of the SD entry is,
SD file-name
[; RECORD CONTAINS [integer-1 TO] integer-2 CHARACTERS]
[; DATA { RECORD IS } data-name-1 [ , data-name-2]……]

Example :-
Assume that have Student-file with the following description in the DATA division.
FD STD-FILE.
01 STD-REC.
02 STD-ID PIC 999.
02 STD-NAME PIC X(20).
02 SEM PIC 999.

Suppose we wish to sort this Student-file on STD-NAME in ascending sequence. To sort this file we require
one work file and output file be SORT-FILE and OUT_FILE respectively.
The DATA DIVISION entries for these two files are as follows :
SD SORT-FILE.
01 SORT-REC.
02 FILLER PIC X(3).
02 SSTD-NAME PIC X(20).
02 FILLER PIC X(3).
FD OUT-FILE.
01 OUTPUT-REC PIC X(26).

The following statement will sort the input file and will create the sorted output file.

SORT SORT-FILE ON ASCENDING KEY STD-NAME


USING STD-FILE GIVING OUTPUT-FILE.

MERGING :-
 The process combing two or more files into one according some key field in the records is known as
Merging.
 The merging of files can be done in COBOL with the help of the MERGE verb. It is possible to
merge two or more files with one MERGE statement.
 The format of the simple MERGE verb is as follows :
MERGE file-name-1

ON ASCENDING KEY data-name-1 [ , data-name-2 ]….


DESCENDING

ASCENDING
ON DESCENDING KEY data-name-3 [ , data-name-4 ]….. …….

USING file-name-2, file-name-3 [ , file-name-4 ] ……


GIVING file-name-5
.
 Description :-
 The input files to be merged through MERGE statement are specified in the USING
phrase.
 These files must be sequential files and must be sorted on the merge keys.
 File-name-1 is the name of the work file and file-name-2 ,file-name-3 are the input
sequential files and file-name-5 will be output merged file.

 Example :-
 Suppose two separate files of employees are to be combined into one
Both input files and the resulting output file contain 80 characters with an
Emp-No in the first nine positions

 File definitions and MERGE instruction follow

DATA DIVISION.
FILE SECTION.

FD EMP-FILE-1.
01 EMP-REC-1 PIC X(80).

FD EMP-FILE-2.
01 EMP-REC-2 PIC X(80).

SD MERGE-FILE.
01 MERGE-REC.
05 MRG-EMP-NO PIC X(9).
05 REST-OF-REC PIC X(71).
FD OUT-EMP-FILE.
01 OUT-EMP-REC PIC X(80).

PROCEDURE DIVISION.
MAIN-MODULE.
MERGE MERGE-FILE ON ASCENDING KEY MRG-EMP-NO
USING EMP-FILE-1, EMP-FILE-2 GIVING OUT-EMP-FILE
STOP RUN.

Q.5. Explain procedure division statements for relative file.


Ans:-
A relative file is a magnetic-disk file organized in such a way that each record is identified by
a relative record number.

PROCEDURE DIVISION Statements for relative files.


 The statements OPEN, CLOSE, READ, WRITE, REWRITE which are available for
sequential files are all available for the relative files.
 As regards the OPEN and CLOSE statements, there is no difference between a relative file
and sequential disk file.
READ Statement:

The general format for the READ statement are as shown below.

Format 1 :
READ file-name RECORD [ INTO identifier ]
[ ; AT END imperative-statement ]
This format is for sequential files.

Format 2 :
READ file-name RECORD [ INTO identifier ]
[ ; INVALID KEY imperative-statement ]
This format is used when access mode is either random or dynamic.
Format 3 :
READ file-name [ NEXT ] RECORD [ INTO identifier ]
[ ; AT END imperative-statement ]

This format is used when access mode is dynamic.

The following statements will read the fiftieth record from the file.

MOVE 50 TO REL-KEY.
READ REL-FILE RECORD INVALID-KEY GO TO PARA-INVALID

THE INVALID KEY PHRASE IS EXECUTED WHEN THE READING IS


UNSUCCESSFULL

The next record is identified by the following rules:


1.When the READ NEXT statement is the first statement to be executed after the OPEN statement
on the file, the next record is the first record of the file.
2. When the execution of the READ NEXT statement follows the execution of another READ
statement on the same file ( FORMAT 2 or FORMAT 3 above), the next record is the record
following the one previously read.
3. When the execution of the READ NEXT statement follows the execution of the START
statement the next record is the record to which the file is logically positioned by the START
statement.

WRITE STATEMENT :

WRITE record-name [ FROM identifier ]


[ ; INVALID KEY imperative-statement ]

WRITE record-name [ FROM identifier ]


[ ; INVALID KEY imperative statement ]

MOVE 50 TO REL-KEY.
WRITE REL-OUTPUT INVALID KEY GO TO PARA-INVALID.

The record is written at the fiftieth record position on the file.


The imperative statement of the INVALID KEY phrase is executed in the following cases :
1. When an attempt is made to write beyond the externally-defined boundaries of the file.
2. When an attempt is made to write in the record position which already contains a valid
record.

PART-C
Q.6. Write a program to create an indexed organized file with
Reg_No PIC X(9)
Name PIC X(15)
DOB PIC 9(6)
With Reg_No as record key and perform (i) Add a new record (ii) Delete a Record
Ans : -

IDENTIFICATION DIVISION.
PROGRAM-ID. INDEX1.

ENVIRONMENT DIVISION.
INPUT-OUTPUT SECTION.
FILE-CONTROL.
SELECT MASTFILE ASSIGN TO DISK
ORGANIZATION IS INDEXED
ACCESS MODE IS RANDOM
RECORD KEY IS REG-NO.

DATA DIVISION.
FILE SECTION.
FD MASTFILE
LABEL RECORDS ARE STANDARD
VALUE OF FILE-ID IS "MAST.DAT"
DATA RECORD IS MASTREC.
01 MASTREC.
02 REG-NO PIC X(9).
02 NAME PIC X(15).
02 DOB PIC 9(6).

WORKING-STORAGE SECTION.
77 ANS PIC X VALUE "Y".
77 CHOICE PIC 9.

PROCEDURE DIVISION.

MAIN-PARA.
PERFORM MENU-PARA UNTIL CHOICE = 3.
STOP RUN.

MENU-PARA.

DISPLAY "--------MENU--------".
DISPLAY "1.ADD A NEW RECORD".
DISPLAY "2.DELETE A RECORD".
DISPLAY "3.EXIT".
DISPLAY "SELECT YOUR CHOICE:".
ACCEPT CHOICE.
IF CHOICE = 1
GO TO PERFORM1-PARA.
IF CHOICE = 2
GO TO DELETE-PARA.

PERFORM1-PARA.
OPEN OUTPUT MASTFILE.
CREATE-PARA.
DISPLAY "ENTER THE STUDENT ROLL NO :".
ACCEPT REG-NO.
DISPLAY "ENTER THE STUDENT NAME:".
ACCEPT NAME.
DISPLAY "ENTER THE DATE OF BIRTH:".
ACCEPT DOB.

WRITE MASTREC INVALID KEY DISPLAY "REG-NO ALREADY EXIST"


GO TO MENU-PARA.
DISPLAY "RECORD SUCCESFULLY INSERTED".
close MASTFILE.
GO TO MENU-PARA.

DELETE-PARA.
OPEN I-O MASTFILE.
DISPLAY "ENTER THE REG-NO TO BE DELETED:".
ACCEPT REG-NO.
DELETE MASTFILE INVALID KEY DISPLAY "RECORD NOT FOUND" GO TO MENU-PARA .
DISPLAY "RECORD SUCCESFULLY DELETED".
CLOSE MASTFILE.
GO TO MENU-PARA.

Q.7. Write a COBOL program to create a Sequential file containing the following fields
Customer Name X(20)
City X(10)
Account Number 9(6)
Balance 9(6)V9(3)
Read the file and count the number of customer having Balance > Rs 50,000
Ans : -
IDENTIFICATION DIVISION.
PROGRAM-ID. P8.
ENVIRONMENT DIVISION.
INPUT-OUTPUT SECTION.
FILE-CONTROL.
SELECT CUST-FILE ASSIGN TO DISK
ORGANIZATION IS LINE SEQUENTIAL.
DATA DIVISION.
FILE SECTION.
FD CUST-FILE
LABEL RECORDS ARE STANDARD
VALUE OF FILE-ID IS "CUS.DAT".
01 CUS-REC.
02 CUS-NAME PIC X(10).
02 CITY PIC X(10).
02 ACC-NO PIC 9(2).
02 BALANCE PIC 9(7).
WORKING-STORAGE SECTION.
77 CH1 PIC X.
77 CNT PIC 99 VALUE 0.
01 ECNT PIC ZZZ.
PROCEDURE DIVISION.
MAIN-PARA.
OPEN OUTPUT CUST-FILE.
PERFORM ACC-PARA UNTIL CH1 = "N" OR "n".
CLOSE CUST-FILE.
OPEN INPUT CUST-FILE
DISPLAY "CUST-NAME * CITY * ACC-NO * BALANCE".
DISPLAY "---------------------------------------------".
READ CUST-FILE AT END MOVE "Y" TO CH1.
PERFORM DISP-PARA UNTIL CH1 = "Y".
DISPLAY "----------------------------------------------".
DISPLAY "NUMBER OF CUSTOMERS HAVING BALANCE > 50,000 ARE :" CNT.
CLOSE CUST-FILE.
STOP RUN.

PER-PARA.
IF BALANCE > 50000
THEN
ADD 1 TO CNT.

ACC-PARA.
DISPLAY (1,15) "ENTER CUSTOMER DETAILS".
DISPLAY " ".
DISPLAY "ENTER CUSTOMER NAME:".
ACCEPT CUS-NAME.
DISPLAY "ENTER NAME OF THE CITY :".
ACCEPT CITY.
DISPLAY "ENTER ACCOUNT NUMBER:".
ACCEPT ACC-NO.
MOVE ACC-NO TO ECNT.
DISPLAY "ENTER BALANCE AMOUNT :".
ACCEPT BALANCE.
PERFORM PER-PARA.
WRITE CUS-REC.
DISPLAY "DO U WISH TO ADD MORE RECORDS(Y/N):".
ACCEPT CH1.
DISP-PARA.
DISPLAY CUS-REC.
DISPLAY SPACE.
READ CUST-FILE AT END MOVE "Y" TO CH1.

Q.8. Write a COBOL program to generate a Sales Report.


Ans : -
IDENTIFICATION DIVISION.
PROGRAM-ID.15.

ENVIRONMENT DIVISION.
INPUT-OUTPUT SECTION.

FILE-CONTROL.
SELECT SALES-FILE ASSIGN TO DISK
ORGANIZATION IS LINE SEQUENTIAL.
SELECT REP-FILE ASSIGN TO "REP1.DAT".

DATA DIVISION.
FILE SECTION.
FD SALES-FILE
LABEL RECORDS ARE STANDARD
VALUE OF FILE-ID IS "SALES.DAT".
01 SALES-RECORD.
02 YY PIC 9999.
02 NOKIA PIC 9(5).
02 MOTROLLA PIC 9(5).
02 SAMSUNG PIC 9(5).
02 RELIANCE PIC 9(5).
02 TOTAL PIC Z(5).

FD REP-FILE
REPORT IS SALES-REPORT.

WORKING-STORAGE SECTION.
01 FLAG PIC X VALUE "N".
REPORT SECTION.
RD SALES-REPORT CONTROLS ARE FINAL
PAGE LIMIT IS 40 LINES
HEADING 4
FIRST DETAIL 10.

01 TYPE IS RH.
02 LINE NUMBER IS 4.
03 COLUMN NUMBER IS 18 PIC X(11) VALUE "MOBILE-TECH".
02 LINE NUMBER IS PLUS 1.
03 COLUMN NUMBER IS 21 PIC X(5) VALUE "INDIA".

01 TYPE IS PH.
02 LINE NUMBER IS 4.
03 COLUMN NUMBER IS 1 PIC X(4) VALUE "YEAR".
03 COLUMN NUMBER IS 10 PIC X(5) VALUE "NOKIA".
03 COLUMN NUMBER IS 20 PIC X(8) VALUE "MOTROLLA".
03 COLUMN NUMBER IS 30 PIC X(7) VALUE "SAMSUNG".
03 COLUMN NUMBER IS 40 PIC X(8) VALUE "RELIANCE".

01 DETAIL-FILE TYPE IS DETAIL.


02 LINE NUMBER IS PLUS 1.
03 COLUMN NUMBER IS 1 PIC 9(4) SOURCE IS YY.
03 COLUMN NUMBER IS 10 PIC 9(5) SOURCE IS NOKIA.
03 COLUMN NUMBER IS 20 PIC 9(5) SOURCE IS MOTROLLA.
03 COLUMN NUMBER IS 30 PIC 9(5) SOURCE IS SAMSUNG.
03 COLUMN NUMBER IS 40 PIC 9(5) SOURCE IS RELIANCE.

01 TOTAL-LINE TYPE IS CONTROL FOOTING FINAL.


02 LINE NUMBER IS PLUS 2.
03 COLUMN NUMBER IS 2 PIC X(5) VALUE "TOTAL".
03 COLUMN NUMBER IS 10 PIC Z(6) SUM NOKIA.
03 COLUMN NUMBER IS 20 PIC Z(6) SUM MOTROLLA.
03 COLUMN NUMBER IS 30 PIC Z(6) SUM SAMSUNG.
03 COLUMN NUMBER IS 40 PIC Z(6) SUM RELIANCE.

PROCEDURE DIVISION.
PARA-1.
OPEN INPUT SALES-FILE.
OPEN OUTPUT REP-FILE.
INITIATE SALES-REPORT.
READ-PARA.
READ SALES-FILE AT END GO TO LAST-PARA.
GENERATE DETAIL-FILE GO TO READ-PARA.
LAST-PARA.
TERMINATE SALES-REPORT.
CLOSE SALES-FILE REP-FILE.

**** THE END ****

You might also like