CS-03: FILE STRUCTURE & PROGRAMMING IN COBOL
DEC 1996

Prepared by: Little Bit Heaven

Time: 2 Hours  

Maximum Marks: 60

NOTE : There are 5 questions in this paper. Question number 1 is compulsory and carries 40 marks. Attempt any three from the rest.

1. (a) What is a Label Record? Explain the meaning of the clause:
LABEL RECORDS ARE STANDARD
(i) Write the Data Division and Procedure Division entries to print and underline the heading
"This is term End Exam" from the 41st column. Use the ADVANCING option.
 (ii) Find the error/errors in the following Procedure Division segment of a COBOL program. 
Write the corrected code.
PERFORM PARA-A VARYING A
FORM 1 BY 1 UNTIL A>20
PERFORM PART-B 8 TIMES
PERFORM PART-C UNTIL CTR = 8
PART-A
ADD C TO B
ADD 1 TO A
PART-B
IF A=B GOTO PARA-D
ADD A TO B
PARA-C
ADD A TO B
ADD 1 TO CTR
IF CTR = 8 STOP RUN.
PARA-D
ADD 5 TO B
STOP RUN.
(b) XYZ Company has 5 warehouses for keeping its stock. Each of these warehouse stores 20
products and of these products can be supplied by the 5 suppliers. Write the data division entry for this multidimensional table.
Write the procedure division entries for finding the number of products in Warehouse 3 that have been supplied by "ABC Company".
(c) Can you write recursive programs on COBOL? Give reasons. What are the COBOL verbs 
used for implementing Iteration
(d) Compare the contrast Indexed sequential file organization and Relative file organization.
(e) How can one-sort records in a file using COBOL? Explain with the help of an example.
2. Write a COBOL program for updating a stock master file (sequential) using a traction file. 
The stock file records consists of :
Item number   5 Numeric digits
Item name     25 Alphabets
Quantity          9 Numeric digits

The transaction file consists of
Item number  5 Numeric digits
Quantity        9 Numeric digits
3. A chemical company has two plants. Each of the plants has its own unsorted employee 
payroll master file having the format:
Employee number 5 Numeric digits
Employee name 25 Characters
Address 50 Characters
Pay 6 Decimal digits
The company found that many of its employees are on the payroll of both the plants. Write a program in COBOL to create a single master file for the company. There should not be any duplicate records in the single master file.
4. (a) Identify the error/errors in the following COBOL statements. Give reasons.
(i)  ADD AMTI TO AM2 GIVING TOTAL.
(ii)  DIVIDE AMT BY 6 REMAINDER REM.
(iii)  COMPUTE (A + E) = A * B / * C+D
(iv) ACCEPT (5,15) SUM WITH PROMPT
(v)IF A = 3 OR IF A = 4
PERFORM PARA-A
ENDIF
(b) Write a program in COBOL (only Data Division and Procedure Division) to output patient 
name and diagnosis as per the following conditions:
 (i)  If a patient has lung infection and high fever, the diagnosis is PNEUMONIA
(ii)  Any other combination of two or more symptoms (which do not include lung function, high fever pair), the diagnosis is COLD.
(iii) If at most one symptom is present the patient is OK.
The patient record has the following format
Name 20 characters
Lung Infection 1 digit 1 specifying present of symptoms.
0 specifying absence of symptoms
Temperature 1 digit 1 implies high
0 implies normal
Sore throat 1 digit 1 means present
0 means absent
5. Explain the following by taking one example each :
  1. INVALID KEY clause
  2. INSPECT statement
  3. MOVE CORRESPONDING statement
  4. ON SIZE ERROR clause
  5. SEARCH ALL statement
  6. SET statement
  7. USAGE clause
  8. REDEFINES clause
  9. PICTURE clause
  10. SYNCHRONIZED clause

Hosted by www.Geocities.ws

1