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

Prepared by: Little Bit Heaven

Time : 2 Hours

Max. 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). Input-Output to a COBOL program is normally performed using a file. Why? What is the significance or OPEN and CLOSE statements in COBOL ? What are the actions performed on execution of READ and WRITE statements respectively ?  
(b). What is the reset of level 77 and level 88 entries ? Give two examples of situations where you would like to use these entries.  
(c). What is the purpose of synchronised clause in COBOL? In what situations would you like to use this clause ? What is a slack byte in this context ?  
(d).  How can you represent a two dimensional matrix in COBOL ? How is sorting of elements of one dimensional array performed in COBOL ?  
(e). What are the situations which can be used in COBOL to solve problem having iterations ? Is recursion allowed in COBOL ? Give reason.  
(f). How can a string find and replace operation be implemented in COBOL ?  
(g). Two sorted transactions files are to be merged on a specific key. Write the various procedure division and data division entries which are required to do this operation.  
(h). Compare and contrast the direct and sequential file organisation.  
2.  What is meant by Indexed file organisation ? What are the advantages/disadvantages of this organisation over sequential and relative file organisation ? What are the environment division and procedure division entries for indexed files ? Give examples of these entries.  
(a). What are the errors in the following statements/segments of COBOL ?  

(i). DIVIDE 13 INTO J GIVING K L ROUNDED
(ii). FILE SECTION  
FD CARD  
77 CARD-REC 
   
03 NAME PICTURE IS X(20). 
   
03 EARN PICTURE IS 9(5)V99.  
(iii). ADD A, B GIVING C ROUNDED ON SIZE 
                       
ERROR MOVE ZERO TO C.  
(iv). MULTIPLY A BY 300.2 GIVING B ROUNDED 
                      
ON SIZE ERROR MOVE O TO B.  
(v).  IF X IS GREATER THAN OR EQUAL TO 30 
           
DISPLAY "X IS GREATER THAN OR EQUAL TO 30".

(b). A translation file has the following structure :          
Account number 8 alphanumeric characters
Translation code  2 numeric digits  
Write a program (only procedure division and data division) in COBOL which sorts these entries on account number in two files. The first file contains the entries for which translation code is less than 50. The second file contains the entries for which the transalatio code in the input was more than 50, but at the time of writing into the file has to be converted to zero
4. (a). Write the data division and procedure division of a COBOL program which calculates the yearly depreciation as per the following formula
The input record to the program consists of item number, cost of item, scrap value and life in years. Please note that program should print "ERROR" if depreciation value is less than equal to zero.  
(b).  In a COBOL program the following table has been described in the working storage section :  
01 PERSON-TABLE  
02 PERSON-INFO OCCURS 500 TIMES  
03 PERSON-NO PIC 9(4).  
03 P_NAME 
    
04 FIRST PIC X(25) 
    
04 SECOND PIC X(20)  
03 INCOME PIC 9(5).
(i).  What will be the size of the table in number of bytes? What will be the modified size of the table if we modify it to include information like sex of person ?  
(ii).  Write procedure statement to find the person whose last name is "MISHRA" and INCOME > 30,000.  
(c). Rewrite the COBOL statements givenin pura P1 using PERFORM with VARYING AFTER option.  

SET 1 to 1.  
P1. IF NOT > 11 PERFORM P2 THRU P3 
     
SET 1 UP BY 2 GO TO P1.  
P2  SET J TO 25.  
P3  IF NOT J < 1 PERFORM END PARA 
     
SET J DOWN BY 4 GO TO P3.
5. Explain the following statements/clauses of COBOL giving two examples each : 

(i)   ACCEPT and DISPLAY verbs
(ii)  REDEFINES clause  
(iii) CORRESPONDING option with MOVE and ADD verbs  
(iv) SEARCH verb  
(v)  RELEASE and RETURN statements.  

  

 

Hosted by www.Geocities.ws

1