I have a sequential file. How do I access a record in this
sequential file randomly in my program ?

Answers were Sorted based on User's Feedback



I have a sequential file. How do I access a record in this sequential file randomly in my program ..

Answer / srinivas.d

you cannot randomly acces in sequential files..

Is This Answer Correct ?    9 Yes 3 No

I have a sequential file. How do I access a record in this sequential file randomly in my program ..

Answer / guest

Harish ,

What is "KEY-FILE1" ?
Anyhow - you are still reading file sequentially ? arnn't
you ?

Is This Answer Correct ?    4 Yes 0 No

I have a sequential file. How do I access a record in this sequential file randomly in my program ..

Answer / sruthi

we can do that by using tables means arrays concept.
we can use search all for that

Is This Answer Correct ?    3 Yes 0 No

I have a sequential file. How do I access a record in this sequential file randomly in my program ..

Answer / jack

Read seq. file and store it in tables means arrays.
We can use 'seach all' for random access.

Is This Answer Correct ?    2 Yes 0 No

I have a sequential file. How do I access a record in this sequential file randomly in my program ..

Answer / mohan

Guys, i suppose that we need to use Arrays concept along
with Subscript or Index concept to access a record in a
sequential file.

Is This Answer Correct ?    2 Yes 0 No

I have a sequential file. How do I access a record in this sequential file randomly in my program ..

Answer / santhosh

write a temporary index file defining unique key, move the
sequential file to that temp index file and access the temp.
index file randomly

Is This Answer Correct ?    1 Yes 0 No

I have a sequential file. How do I access a record in this sequential file randomly in my program ..

Answer / lu

Hi Guys,
when you say "sequential" it means you have to read from 1
to 9999...Never say sequential file and read randomly !!!!!
use read util the field you want....
Perform 100-read until ws-field = 'yes'.......

Is This Answer Correct ?    0 Yes 2 No

I have a sequential file. How do I access a record in this sequential file randomly in my program ..

Answer / harish

YS WE CANT ACCESS FLAT FILE RANDOMLY

IF WE WANT TO ACCESS PARTICULAR RECORD



PROCEDURE DIVISION.

MOVE KEYFIELD VALUE TO W-S VARIABLE
PERFORN UNTIL W-FLAG = 'Y'
READ FILE1 AT END MOVE 'Y' TO W-FLAG
NOT AT END
IF KEY-FILE1 = WS-KEY-VARIABLE
MOVE--------

ELSE
MOVE 'Y' TO W-FLAG.

pls correct me if anything wrong

HARISH POOMGAME SHIVAPPA(hassan,karnataka)
NIIT TECHNOLOGY
KOLKATA

Is This Answer Correct ?    0 Yes 12 No

Post New Answer

More COBOL Interview Questions

How can we increase the size of an existing PDS to include more no. of modules. I tried the answer posted by Jagan(TSO PDS 'pds name') but did not find it working. The answer posted by kamal i know very well. Please suggest me a answer so that we don't need to delete the existing PDS and still we can change the size as well.

10 Answers  


How to delete a front spaces in a data-name/variable in cobol Example:- 01 data-name-1 PIC x(20) value " cobol language". 01 data-name-2 PIC x(20). MOVE data-name-1 to data-name-2. would like the value of data-name-2 is "cobol language".

3 Answers  


what is rediffine clause?in what situation it can use?give me real time example?

1 Answers   IBM,


how we separate the cobol cics statements from cobol&cics programming?

1 Answers   Valtech,


01 a pic 9(3) value is 123 01 b pic 9(6) move a to b wht will be the value ? and 01 a pic x(6) value is abc 01 b pic x(3) move a to b wht will be the value ?

7 Answers   Patni,






if a pic 9(3) value 354,b pic x(2) value '46' then a)a>b 2)a<b 3)error

8 Answers   Cap Gemini,


Can you please let me know the centre name of INS certification in Kolkata.

0 Answers  


i have n records in one file and in this file there is some fields and i want to count that how many sharma in my file so plz give the coding that how we read sharma ?

2 Answers  


What is length is cobol?

0 Answers  


How to get the last record in vsam file in cluster? And how can you get the kids file records into your cobol program?

0 Answers  


suppose a cobol programme A calling programme B,C and D. If C undergoes some change what if A,B,C,D need to be recompiled or only C nee to be recompliled.

2 Answers   IBM,


i have 10 names in an array and my name is one of them also array is not in sorted order i need to display my name using index how will i do this

0 Answers  


Categories