IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

how do u delete a ESDS record thru COBOL?


IBM Mainframe Forums -> COBOL Programming
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
richie_techin

New User


Joined: 21 Jan 2006
Posts: 16
Location: india

PostPosted: Sat Jan 21, 2006 10:27 pm
Reply with quote

hi guys,

can u plz tell me how do delete a VSAM ESDS cluster thru COBOL?
Back to top
View user's profile Send private message
LeonL

New User


Joined: 20 Jan 2006
Posts: 5

PostPosted: Sun Jan 22, 2006 6:21 pm
Reply with quote

I'm assuming you will use a batch job to execute your Cobol program and then you will have to allocate a (temporary) data set (RECFM=FB,LRECL=80).
Write DELETE statements from your Cobol program to this data set:
" DELETE 'name-of-data-set' CLUSTER PURGE"
There must be 2 spaces in front of the DELETE keyword!

In your next JCL step execute PGM=IDCAMS with the temporary file assigned to DDname SYSIN.
Back to top
View user's profile Send private message
mmwife

Super Moderator


Joined: 30 May 2003
Posts: 1592

PostPosted: Sun Jan 22, 2006 8:13 pm
Reply with quote

Hi Richie,

In the title of your thread you write:
Quote:
how do u delete a ESDS record thru COBOL?

In your msg you write:
Quote:
can u plz tell me how do delete a VSAM ESDS cluster thru COBOL?

Which is it, record or cluster?
Back to top
View user's profile Send private message
richie_techin

New User


Joined: 21 Jan 2006
Posts: 16
Location: india

PostPosted: Mon Feb 06, 2006 12:28 pm
Reply with quote

hi,

i am sorry..i wanted to delete a record.if it does not delete,then what error code does it give?
Back to top
View user's profile Send private message
LeonL

New User


Joined: 20 Jan 2006
Posts: 5

PostPosted: Mon Feb 06, 2006 1:40 pm
Reply with quote

Vishal,

It has been some time since I processed a VSAM ESDS in Cobol, so I had to look in the manual.

There it says that you can't delete a record from a VSAM ESDS.
So you'll have to create a new VSAM ESDS, which you can do by using IDCAMS:

//STEP1 EXEC PGM=IDCAMS
//SYSPRINT DD SYSOUT=*
//SYSIN DD *
DEFINE CLUSTER -
(NAME(your.new.esds) -
.
.
(use the same parameters you used for the original ESDS)
.
IF LASTCC = 0 THEN -
REPRO IDS(your.old.esds) -
ODS(your.new.esds) -
COUNT(xxxx)
/*
// IF STEP1.RC = 0 THEN
//STEP2 EXEC PGM=IDCAMS
//SYSPRINT DD SYSOUT=*
//OUT DD DSN=your.new.esds,DISP=MOD
//SYSIN DD *
REPRO IDS(your.old.esds) -
OFILE(OUT) -
SKIP(yyyy)
/*
// ENDIF

In STEP1 you supply the number of records to copy up to (but not including!) the record you want to remove.

In STEP2 you supply the number of STEP1 +1 to skip the record you want to remove.

So if you want to remove record 537 then STEP1 should read COUNT(536) while STEP2 should read SKIP(537)
Back to top
View user's profile Send private message
sunish

New User


Joined: 23 May 2005
Posts: 19

PostPosted: Mon Feb 06, 2006 3:14 pm
Reply with quote

hi

you cannot delete a esds record. pl correct me if iam wrong
Back to top
View user's profile Send private message
nuthan

Active User


Joined: 26 Sep 2005
Posts: 146
Location: Bangalore

PostPosted: Mon Feb 06, 2006 3:22 pm
Reply with quote

Hi,
i think U cant delete an ESDS record but u can rewrite with another record of same Length.
Back to top
View user's profile Send private message
khamarutheen

Active Member


Joined: 23 Aug 2005
Posts: 677
Location: NJ

PostPosted: Mon Feb 06, 2006 3:34 pm
Reply with quote

Hi ,

Sunish Says:

Quote:
you cannot delete a esds record. pl correct me if iam wrong


Yes u r right. ESDS records can only be rewrited and it cannot be deleted....
Back to top
View user's profile Send private message
dneufarth

Active User


Joined: 27 Apr 2005
Posts: 419
Location: Inside the SPEW (Southwest Ohio, USA)

PostPosted: Tue Feb 07, 2006 8:47 am
Reply with quote

while there is no way to physically delete the record, you could rewrite it with a logical 'deleted' flag of your own design

or, you can do the old school way of reading the original file and only writing the records you want to a 'new' file -- in effect deleting the record(s)
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> COBOL Programming

 


Similar Topics
Topic Forum Replies
No new posts How to split large record length file... DFSORT/ICETOOL 10
No new posts Replace each space in cobol string wi... COBOL Programming 3
No new posts DELETE SPUFI DB2 1
No new posts COBOL -Linkage Section-Case Sensitive COBOL Programming 1
No new posts SFTP Issue - destination file record ... All Other Mainframe Topics 2
Search our Forums:

Back to Top