Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

delete a record in sequential file

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> Mainframe Interview Questions
View previous topic :: :: View next topic  
Author Message
priya_gmain

New User


Joined: 18 Sep 2006
Posts: 7

PostPosted: Mon Oct 16, 2006 2:05 pm    Post subject: delete a record in sequential file
Reply with quote

Hi,

Plz let me know how to delete a record in sequential file and rewrite the file in a cobol pgm.
Back to top
View user's profile Send private message

meetreks

New User


Joined: 28 Sep 2006
Posts: 26
Location: Edinburgh

PostPosted: Mon Oct 16, 2006 2:46 pm    Post subject:
Reply with quote

Hi,

You cannot possibly delete a record in a sequential file. THe DELETE keyword is only of Indexed files,which can be deleted.

Hope this helps.
Back to top
View user's profile Send private message
priya_gmain

New User


Joined: 18 Sep 2006
Posts: 7

PostPosted: Mon Oct 16, 2006 5:32 pm    Post subject: Re: delete a record in sequential file
Reply with quote

Ya I know that ......But in an interview I have been asked that if there is a requirement to delete a record in sequential file and rewrite .....how do u do that..........
Back to top
View user's profile Send private message
nachiks

New User


Joined: 08 Apr 2006
Posts: 1
Location: chennai

PostPosted: Tue Oct 17, 2006 6:26 pm    Post subject:
Reply with quote

HI,


We cannot delete records using DELETE in sequential files but we can logically delete the records.What we can do is we can rewite a record with SPACES. It looks like this

Code:
BTECH124 A---
BTECH125 B---

BTECH127 C---

TRY THIS

Code:
DECLARE A FILE
01 REC.
02 EMPNO PIC X(15).
02----
02----

IN WSS.
DECLARE A "77 EMPLOYEENO PIC A(15). "

ACCEPT EMPLOYEENO.

READ SEQUENTIAL-FILE <eof>     /* NOW IT READS ALL RECORDS
IF  EMPLOYEENO  =  EMPNO         /*IF CONDITIONS PICKS A REC.
MOVE SPACES TO REC.               /* SPACES ARE MOVED TO THAT REC
REWRITE REC.                           /* NOW REWITING WILL MAKE SPACES


PLS CHEK
BYE
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> Mainframe Interview Questions All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts SORTJOIN - Copy Matched and Unmatched... Steve Ironmonger DFSORT/ICETOOL 5 Tue Jan 17, 2017 4:26 pm
No new posts Copy RECFM =VB TO FB file with RECL =... sahil41352 DFSORT/ICETOOL 3 Wed Dec 28, 2016 11:29 pm
No new posts Add PD field from 2nd file to PD in 1st Sushant Garje DFSORT/ICETOOL 6 Thu Dec 01, 2016 4:32 pm
No new posts JCL to delete component in a package sundaram.naveen Compuware & Other Tools 14 Tue Nov 29, 2016 6:21 pm
No new posts File Aid to File Manager conversion murali3955 IBM Tools 4 Thu Nov 24, 2016 3:41 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us