GeekInterview.com
  I am new, Sign me up!
 
GeekInterview.com  >  Interview Questions  >  Mainframe  >  COBOL
Go To First  |  Previous Question  |  Next Question 
 COBOL  |  Question 94 of 164    Print  
State difference between reading a file by using start command and reading a file using the key value? (Both are in dynamic access mode)

  
Total Answers and Comments: 3 Last Update: April 30, 2009     Asked by: P_KARTHIKKUMAR 
  
 Sponsored Links

 
 Best Rated Answer
Submitted by: memays
 
Actually, the START command does not READ anything.  It simply sets the location pointer to the file for a subsequent READ command.    

For random reading, the key of the desired record (or part of the key) must be supplied, which causes the specific record which matches(in the case of READ EQUAL TO) to be retrieved.   Unless the key is changed, subsequent READ's would return the same record repeatedly.

In cases where a group of records (but not the whole file) need to be read sequentially, the START statement is used to position the file pointer to the 1st record to be read.  Subsequent READ NEXT statements will then read sequentially from that point.  

In dynamic mode, START is optional, and the same result can be accomplished by using a direct READ by key to retrieve the 1st record of the set, followed by READ NEXT statements to retrieve subsequent records. 

Above answer was rated as good by the following members:
rkrishnamf
January 30, 2007 09:00:41   
pbhatt Member Since: January 2007   Contribution: 2    

RE: State difference between reading a file by using s...
Hi Using the START-BROWSE command we can read all the records starting from the record having keyvalue equal to specified value and the specified value can be at any position (random) in the file. Whereas by simple READ command using a simple key value will result in reading of a single record to which the key value matches.All please correct me if I am wrong....pradeep
 
Is this answer useful? Yes | No
February 13, 2007 12:55:51   
BauV.QA Member Since: February 2007   Contribution: 1    

RE: State difference between reading a file by using s...
Hi In accessing the data records of any Indexed-Dynamic datafile START command will place the control at the first record of the group of recotds to be read that will match with the key values and READ command will simply reads a record (may be first record) only that matches the key value just like Random access.Regards Balaji V.
 
Is this answer useful? Yes | No
April 30, 2009 11:11:08   
memays Member Since: November 2007   Contribution: 5    

RE: State difference between reading a file by using start command and reading a file using the key value? (Both are in dynamic access mode)
Actually the START command does not READ anything. It simply sets the location pointer to the file for a subsequent READ command.

For random reading the key of the desired record (or part of the key) must be supplied which causes the specific record which matches(in the case of READ EQUAL TO) to be retrieved. Unless the key is changed subsequent READ's would return the same record repeatedly.

In cases where a group of records (but not the whole file) need to be read sequentially the START statement is used to position the file pointer to the 1st record to be read. Subsequent READ NEXT statements will then read sequentially from that point.

In dynamic mode START is optional and the same result can be accomplished by using a direct READ by key to retrieve the 1st record of the set followed by READ NEXT statements to retrieve subsequent records.

 
Is this answer useful? Yes | NoAnswer is useful 1   Answer is not useful 0Overall Rating: +1    


 
Go To Top


 Sponsored Links

 
About Us -  Privacy Policy -  Terms and Conditions -  Contact -  Ask Question -  Propose Category -  Site Updates 

Copyright © 2005 - 2010 GeekInterview.com. All Rights Reserved

Page copy protected against web site content infringement by Copyscape