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
 

 

How to perform MASS DELETE using JCL

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DB2
View previous topic :: :: View next topic  
Author Message
Vidhya Karthi

New User


Joined: 28 Aug 2007
Posts: 18
Location: Chennai

PostPosted: Mon Apr 21, 2008 2:51 pm    Post subject: How to perform MASS DELETE using JCL
Reply with quote

Hi All,
Can anyone explain me how to perform MASS DELETE using JCL?
I have a PS file with 1000 records , which are to be deleted from the table.
Can this be done thru JCL. Please help out.
Back to top
View user's profile Send private message

dick scherrer

Site Director


Joined: 23 Nov 2006
Posts: 19270
Location: Inside the Matrix

PostPosted: Mon Apr 21, 2008 7:40 pm    Post subject:
Reply with quote

Hello,


You could process the PS file and generate sql delete statements for each "key" to be deleted.

As there are only 1000, you could easily do this by editing also.
Back to top
View user's profile Send private message
Prajesh_v_p

Active User


Joined: 24 May 2006
Posts: 133
Location: India

PostPosted: Mon Apr 21, 2008 7:43 pm    Post subject:
Reply with quote

1) Using IKJEFT01

-> Reformat the data to be appended to an 'IN' clause in delete the query(Can get lot of ex for this from DFSORT forum)
-> Use IKJEFT01 to run the delete query(sysin should have the delete query and reformated data append)
-> Should have a primary key column here. Otherwise it will be difficult.

2) Using QMF Proc

-> Reformat the data in QMF format and QMF header,
-> import the data to a temporary table
-> Run a delete query against your table and tem table
-> Erase tem table

Please correct me If I am wrong.

Thanks,
Prajesh
Back to top
View user's profile Send private message
Vidhya Karthi

New User


Joined: 28 Aug 2007
Posts: 18
Location: Chennai

PostPosted: Tue Apr 22, 2008 9:54 am    Post subject: Reply to: How to perform MASS DELETE using JCL
Reply with quote

Hi,
I don't understand reformatting data. Can you please provide the sample JCL for doing mass delete?
Back to top
View user's profile Send private message
Prajesh_v_p

Active User


Joined: 24 May 2006
Posts: 133
Location: India

PostPosted: Tue Apr 22, 2008 10:10 am    Post subject:
Reply with quote

Suppose you have the emp numbers inthe file as below:
12003
12323
34344

create a DSN DSN2 in the following format:

12003,
12323,
34344);

Have a permanent DSN DSN1 as below:

Delete from emp_tbl
where emp_no in(

Now append DSN1 and DSN2 to the sysin of your IKJEFT01 step:

Please see the post http://ibmmainframes.com/viewtopic.php?t=19045&highlight=query for further info.

Thanks,
Prajesh
Back to top
View user's profile Send private message
Vidhya Karthi

New User


Joined: 28 Aug 2007
Posts: 18
Location: Chennai

PostPosted: Tue Apr 22, 2008 2:00 pm    Post subject: Reply to: How to perform MASS DELETE using JCL
Reply with quote

Hi Prajesh,
Still i'm not clear with this...

create a DSN DSN2 in the following format:

12003,
12323,
34344);

I can append a comma to each record thru syncsort. But, How can we append the ); in the last record. Can u plz help with sort card?

Thanks in advance.
Back to top
View user's profile Send private message
Prajesh_v_p

Active User


Joined: 24 May 2006
Posts: 133
Location: India

PostPosted: Tue Apr 22, 2008 2:23 pm    Post subject:
Reply with quote

Use a sort with below sort card:

INREC IFTHEN=(WHEN=INIT,OVERLAY=(6:C',',8:SEQNUM,3,ZD)),
IFTHEN=(WHEN=(8,3,CH,EQ,C'001'),OVERLAY=(6:C');'))
SORT FIELDS=(8,3,CH,D)
OUTREC BUILD=(1,7)

Input:
12003
12323
34344

Output:
34344,
12323,
12003);

Thanks,
Prajesh V P
Back to top
View user's profile Send private message
Vidhya Karthi

New User


Joined: 28 Aug 2007
Posts: 18
Location: Chennai

PostPosted: Tue Apr 22, 2008 5:15 pm    Post subject: Reply to: How to perform MASS DELETE using JCL
Reply with quote

Hi Prajesh,
Thanks for u'r help.
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 -> DB2 All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Mass comment and edit elixir1986 IBM Tools 3 Thu Mar 02, 2017 10:09 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 How to delete second instance from Fl... Gunapala CN DFSORT/ICETOOL 6 Tue Oct 18, 2016 11:42 pm
No new posts Delete record or Reset RC code using ... mpawan Compuware & Other Tools 4 Tue Jul 26, 2016 3:52 pm
No new posts Delete VSAM File Records amitc23 CICS 6 Sun Apr 10, 2016 10:10 am


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