View previous topic :: View next topic
|
Author |
Message |
machswap
New User
Joined: 19 Apr 2005 Posts: 14
|
|
|
|
Hi,
Why can't we delete a record in sequential files.
Thanks |
|
Back to top |
|
|
superk
Global Moderator
Joined: 26 Apr 2004 Posts: 4652 Location: Raleigh, NC, USA
|
|
|
|
You can. What has lead you to think otherwise? |
|
Back to top |
|
|
machswap
New User
Joined: 19 Apr 2005 Posts: 14
|
|
|
|
superk wrote: |
You can. What has lead you to think otherwise? |
Hi,
How can u delete a record physically.
if u delete a particular record it will still be there but will be empty..either spaces or zeroes.
is physical deletion possible;
eg.
input records - 100
after deltetion of one record- 99 |
|
Back to top |
|
|
Prandip
New User
Joined: 04 Mar 2005 Posts: 84 Location: In my tiny cubicle ...
|
|
|
|
As far as I know, the technique has always been the same:
- Read the file and write out each record to be kept.
- Once the record to be deleted has been reached, skip writing it.
- Continue reading and writing until the end-of-file is reached.
The resulting file should have one less record then the original. |
|
Back to top |
|
|
Ravi Kiran
New User
Joined: 24 May 2005 Posts: 1
|
|
|
|
we cannot delete a record in sequential files coz all the sequential records are chained even though they dont have an index component. The last 2 bytes of every record contains the address of the previous record and so delettion of one particular record is not possible as it contains the address of another record. |
|
Back to top |
|
|
mmwife
Super Moderator
Joined: 30 May 2003 Posts: 1592
|
|
|
|
The ans is because the function wasn't provided. The function wasn't provided, probably, because it was a dumb idea. How would they "physically" delete them? Would they leave a "hole" where the rec used to be? Or do they relocate all the recs following the "deleted" rec to fill in the "hole"?
Generally PS files are processed (and recreated) in cycles, so the current cycle usually "deletes" the unwanted recs.
As Superk alluded, PS recs can be "deleted" logically using pgm logic or by recreating the file w/o the undesired recs. Sounds like a plan to me.
BTW, Ravi, PS file recs aren't chained and there are no control bytes following each rec. Generally on DA devices there is a home address at the beginning of each track. Recs (blocks) on the track are found by detecting the IRGs (Inter Record Gaps) between blocks. The blocks are passed to I/O routines that fill the buffers for use by the Access Method that, in turn, retrieves the record for use by the pgm. |
|
Back to top |
|
|
|