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 to crack cts interview apps? NOVEMBER 21 2010
If there are two files one with 100 records and other with 101 records. we have to find out the one record that is the odd man out . What are the steps to do it
what is mainframe? what is the mainframe software ? what is use in s/w field?
can anybody post me about file-aid and changemen tools pls and give me reference if any mainframe guys are there
What is a report item?
If we put three reads in COBOL in the same para one after the other, to read a PS file,will it read the same record thrice or it will read three records sequentially? For example : Input File 01 02 03 Para 900 Read infile Display Infile rec Read infile Display infile rec Read infile Display infile rec. What will be the output?
what is meaning by design document? who can repared for this?
If A>B next sentence end-if display 1 display 2. display 3. If a>b, it will display only 3.(the next sentence, ie., after fullstop/period) ____________________________________ if a>b continue end-if display 1 display 2. display 3. If a>b, it Will display 1 2 3 (the next statement) ____________________________________ if a>b continue display 1 end-if display 2 display 3. display 4. If a>b, Will it display 2 3 4 (or) 1 2 3 4 ?
What compiler option would you use for dynamic linking?
What are the divisions in a cobol program? Which one is the mandatory division among them?
How to replace the GOTO statement in COBOL without changing the structure of program. e.g. consider following code... I.D. E.D. D.D. P.D. compute C = A + B. GOTO para 100-display. compute D = C - D. GOTO 200-display. some other logic...... ........ GOTO 300-para. ...... ...... GOTO 400-para. Now I want to replacce all GOTO statements without changing the structure and otput of program.
ID DIVISION. PROGRAM-ID. PLO. DATA DIVISION. WORKING-STORAGE SECTION. 01 VAR1 PIC 9(2). 01 VAR2 PIC X(2). PROCEDURE DIVISION. ACCEPT VAR2. MOVE VAR2 TO VAR1. STOP RUN. if i give 'PI' in var2 then what will b output of progr. any abend?????