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

i have a sequencial file contains multiple records, i want to extract one row which contains various fields like order number,date,warehouse,.ect.. in to the another file by accepting the order number from jcl. how can i do it. pls help me..

4 Answers   CGI,


How do you define a sort file in JCL that runs the COBOL program?

6 Answers   Syntel,


What is the difference between NEXT SENTENCE and CONTINUE?

2 Answers   Mphasis,


Can the OCCURS clause be at the 01 level?

8 Answers   Oracle,


can internal sort be applied to sort ksds files?

1 Answers  






How many maximum number of procedures can we write in one COBOL program?

6 Answers  


How do u find the programs calling the given module, without having doing 3.13 on loadlib/source library?

2 Answers  


What are the two search techniques ?

2 Answers   iGate,


I have a field with data type X(10). I want to perform arithmetic operation on this field? I tried doing it by moving the value into a numeric field. but it didn't work out. I am getting a S0C7 abend. Pls let me know if there is any way of getting this done?

2 Answers   ADP,


where will u code file status ?

2 Answers   TCS,


What is redefines clause in COBOL?

0 Answers   B-Ways TecnoSoft,


What is the difference between performing a SECTION and a PARAGRAPH?

5 Answers   Accenture, Patni,


Categories