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
Answer / srinivas.d
you cannot randomly acces in sequential files..
Is This Answer Correct ? | 9 Yes | 3 No |
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 |
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 |
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 |
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 |
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 |
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 |
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 |
How do u sort the table for Search ALL? Is it only using ASCENDING KEY IS statement in occurs clause? If the data is input in non ascending order, will the ASC KEY IS automatically sort the data? or will it throw compile time error?
How to get the last record in vsam file in cluster? And how can you get the ksds file records into cobol program?
What is diff between vsam and db2?what is advantage of db2 over vsam?which is best suited one?
How To move a value to an array using move verb?
How do we get current date from system with century in COBOL?
How do you set a return code to the JCL from a COBOL program?
why occurs clause not mentioned in 01 level
6 Answers HCL, NIIT, TCS, Tesco,
i am a btech cs 2009 passout. i am opting for mainframe course. is it good to do this course? pls. anyone suggest me
what if any ,is the syntex error in the following piece of code 01 B PIC A(7) 02 C PIC 9(4) ........ IF(B NUMERIC) ADD 10 TO C a.the condition in the if statement is wrong b.noting is wrong c.because C is initialised.ADD 10 TO C is wrong d.both B and C shoud have same size.
What is the linkage section?
What will happen if we generate GDG (+2) version without generating (+1) version?
how to resolve the file status 47.......