Hai friends
why we need to read a file before re-write a record?

Answers were Sorted based on User's Feedback



Hai friends why we need to read a file before re-write a record?..

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

Hai friends why we need to read a file before re-write a record?..

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

Hai friends why we need to read a file before re-write a record?..

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

Hai friends why we need to read a file before re-write a record?..

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

Hai friends why we need to read a file before re-write a record?..

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

Hai friends why we need to read a file before re-write a record?..

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

Hai friends why we need to read a file before re-write a record?..

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

Post New Answer

More COBOL Interview Questions

how do you reference the ksds vsam file formats from cobol programs

0 Answers  


01 WS-NAME PIC X(10) OCCURES 2. by this we can get ws-name 2 times. My qustion is how can we access the second name

5 Answers   TCS,


) what is the difference between AID and HANDLE AID?

0 Answers   IBM,


level number 77 is used to define a)group data b)elementary data c)redefine d)none

8 Answers   TCS,


what is the difference between Normal vaiable and comp variable.

5 Answers   DELL,






what is the use of keep and pass in disp

1 Answers  


SSRange is used to do a range check on which of the Following. SUBSCRIPT,INDEX,REFERENCE MODIFICATION,Run-time option.

3 Answers   Lehman Brothers,


i have mainprogram and subgram...if i compile mainprogram without stop run..what will u get in compilation time?

5 Answers   HCL,


How can we increase the size of an existing PDS to include more no. of modules.

3 Answers  


I have two questions here. 1. How to read a flat file in reverse order? 2. How to read a VSAM KSDS file in reverse order? In both the cases we donot know the total number of records.

1 Answers   L&T,


subscript and index r not coded in u r application program what will happen?

2 Answers  


How do you reference the following file formats from cobol programs?

0 Answers  


Categories