Hai friends
why we need to read a file before re-write a record?
Answers were Sorted based on User's Feedback
Answer / diwakar
Without knowing what field to rewrite we cannot use rewrite
the field in a record.Thats why we read the file first and
then rewrite the same
| Is This Answer Correct ? | 13 Yes | 0 No |
Answer / mf buzz
Hi,
For Rewrite, the file has to be opened in I-O mode. REWRITE
is used to update records. Rewrite statement will update
the last read record. Hence, we have to read the record to
be updated first. Hope this clarifies.
| Is This Answer Correct ? | 4 Yes | 0 No |
Answer / anna
All pr answers are not right.
We read the record first because :
a) we need to knouw if record is exist
b) if you do not read the record on output file will have
just field that you changed the rest will be blank.
| Is This Answer Correct ? | 4 Yes | 0 No |
Answer / ravi patnam
1) When you want to modify a record, first you have to get
that into memory from physical file by the way of reading.
2)Then do modifications.
3)After the modification over again put it bak to the
physical file by using 'Rewrite' command.
| Is This Answer Correct ? | 3 Yes | 0 No |
Answer / mallappa
Rewrite is nothing but Update so if you want to
modify/changes in the record you should read the record
first, which you want to
then you can rewrite it. I hope it will clarify your
doubts.
| Is This Answer Correct ? | 2 Yes | 0 No |
Answer / guest
The file may be ESDS, RRDS or KSDS.
Assuming that the access mode is sequential.
If you are directly performing a 'REWRITE' operation it
will end oup with file status=43. Means'DELETE OR REWRITE &
NO GOOD READ FIRST'.
| Is This Answer Correct ? | 1 Yes | 0 No |
Answer / viks
A disk file, for example MASTER FILE, can be opened as I-O,
which means records from the disk will be accessed, read,
changed, and rewritten.
| Is This Answer Correct ? | 1 Yes | 3 No |
Define cobol?
What are the different rules of SORT operation?
How to read records from flat file in reverse order through COBOL program?
14 Answers Accenture, Broadridge, IBM, MAT, Polaris, SPIC, Syntel, TCS, Wipro,
How to pass return codes from cobol to jcl?
How do you define a variable of comp-1 and comp-2?
How do you define a table/array in COBOL?
Can anybody give me example of subscript and index
01 text-data pic x(100). move 'xyzdbfrjjg u' to text-data. how to find the value of last index of text-data?
What do you do to resolve SOC-7 error?
I have dataset DS1 which has records say 1 2 3 4 5 ... ... etc And also I have second dataset DS2 whcih has records 1 3 4 5 6 8 .. ... Both the files are sorted and now I want to compare these files and write it into the third files if the records are matching.
what is scope terminator
How may divisions are there in JCL-COBOL?