View previous topic :: View next topic
|
Author |
Message |
samayamsasi Warnings : 1 New User
Joined: 22 May 2005 Posts: 7 Location: Bangalore
|
|
|
|
Hi
i am sasi,
one interviewer asked these question , please answer it , it will be more help for me
1. how can delete a sequential file which has 1 millon records, through the cobol programming ?
2.can i delete a record in sequential file ?
Thanks
Sasi |
|
Back to top |
|
|
ofer71
Global Moderator
Joined: 27 Dec 2005 Posts: 2358 Location: Israel
|
|
|
|
1. If I had to delete a dataset from a COBOL program (why????), I would probably code TSO commands from COBOL (Either TSO's DELETE or through IDCAMS).
2. As far as I know, you can't delete a record from a sequential file programmatically. You will have to rewrite the file without the desired record. However, if the file is not too big, you can use ISPF's Edit-Macro commands (even from within COBOL) to delete a single record.
O. |
|
Back to top |
|
|
samayamsasi Warnings : 1 New User
Joined: 22 May 2005 Posts: 7 Location: Bangalore
|
|
|
|
Hi Rj, ofer
thx for ur replies
we can delete sequential file physical ( by idcams or thorugh 3.4 options)
my question is, is it possible delete a sequential file through the cobol programming ?
Sasi |
|
Back to top |
|
|
mmwife
Super Moderator
Joined: 30 May 2003 Posts: 1592
|
|
|
|
You can delete all the recs in the file by opening it for output and closing it immediately. |
|
Back to top |
|
|
prashanth1
New User
Joined: 27 Sep 2006 Posts: 47 Location: Hyderabad
|
|
|
|
mmwife,
means that, do we need to use (OLD,DELETE,DELETE) as the DISP parameters in JCL.
Pls Correct Me ,IF I wrong |
|
Back to top |
|
|
mmwife
Super Moderator
Joined: 30 May 2003 Posts: 1592
|
|
|
|
Hi Prashanth,
I have a feeling (because of the wording) the ques was intended to mean delete all 1 mil recs, not the file.
To delete the file you don't need a COBOL pgm. Just use IEFBR14 with a DD that contains disp=(old,delete,delete) as you suggested.
But, then I wasn't there. |
|
Back to top |
|
|
mmwife
Super Moderator
Joined: 30 May 2003 Posts: 1592
|
|
|
|
'Sfunny, you can delete ALL the recs in a seq file, but you can't delete just one.
Yeah, yeah; I know. |
|
Back to top |
|
|
|