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

Reorg DISCARD for dependant tables


IBM Mainframe Forums -> DB2
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
CICS fan

New User


Joined: 03 Apr 2008
Posts: 82
Location: United States

PostPosted: Mon May 07, 2012 10:47 pm
Reply with quote

All,

We have two tables A and B where B is the child table with refrential integrity set as RESTRICT.

We are using a REORG DISCARD to archive rows from A using something like this.

Code:
REORG TABLESPACE TS1 SHRLEVEL REFERENCE       
          PUNCHDDN LOADSTMT DISCARDDN SYSDISC 
          UNLOAD CONTINUE                               
          DISCARD                                       
          FROM TABLE A                         
             WHEN (TRANS_DATE <= CURRENT DATE - 3 MONTHS)



This is obviously throing B into check pend. Now, we can change the rule to cascade and I ahve two questions on that.

1. If we set this as CASCADE will the rows on B will also be archived?
2. We can provide a archive dataset for A in 'DISCDS'. But can we provide a similar dataset name for 'B'?

Thanks for any help.
Back to top
View user's profile Send private message
sushanth bobby

Senior Member


Joined: 29 Jul 2008
Posts: 1020
Location: India

PostPosted: Tue May 08, 2012 8:45 am
Reply with quote

Hi CICSfan,

Quote:
1. If we set this as CASCADE will the rows on B will also be archived?
No. Rows will be deleted in B, when a delete statement is executed in A. Since you are archiving A table via REORG, B will be put in check-pending.
Quote:
2. We can provide a archive dataset for A in 'DISCDS'. But can we provide a similar dataset name for 'B'?
Ofcourse you can. Run the REORG utility with DISCARDS in B then another REORG with DISCARDS for A.

Thanks,
Sushanth
Back to top
View user's profile Send private message
CICS fan

New User


Joined: 03 Apr 2008
Posts: 82
Location: United States

PostPosted: Wed May 09, 2012 2:21 am
Reply with quote

Thanks Sushanth,

Yes, running the reorgs one after another is an option. My question was whether we can run reorg once and have the paretnt table rows and corresponding child table rows archived at one go. So we would need two DISCARD dataset. I cannot find any such option on IBM website. Any ideas?
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


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

PostPosted: Wed May 09, 2012 3:20 am
Reply with quote

Hello,

Quote:
I cannot find any such option on IBM website. Any ideas?
Possibly because there is no such option. . .

Suggest you run the 2 reorgs as Sushanth recommended.
Back to top
View user's profile Send private message
Pedro

Global Moderator


Joined: 01 Sep 2006
Posts: 2547
Location: Silicon Valley

PostPosted: Wed May 09, 2012 4:32 am
Reply with quote

Quote:
So we would need two DISCARD dataset.


I have never done it! (so proceed with caution).

Is it possible using templates? I was thinking of something like this:
Code:

TEMPLATE  mydiscrd  DSN  'PEDRO.DISCARD.&DB..&TS' 
 
REORG TABLESPACE  blah.blah
   DISCARDDN mydiscrd 
Back to top
View user's profile Send private message
CICS fan

New User


Joined: 03 Apr 2008
Posts: 82
Location: United States

PostPosted: Wed May 09, 2012 9:56 am
Reply with quote

Thank Dick and Pedro.

We eventually decided on running the reorgs in series followed by check utility.
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


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

PostPosted: Wed May 09, 2012 8:41 pm
Reply with quote

Good to hear you have a resolution - thank you for letting us know icon_smile.gif

d
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 -> DB2

 


Similar Topics
Topic Forum Replies
No new posts Reorg abended with REASON=X'00E40347' DB2 2
No new posts Need to fetch data from so many DB2 t... DB2 9
No new posts How to: PK does not exist in several ... DB2 6
No new posts Discrepancy b/w SYSIBM tables and BMC... DB2 0
No new posts SYSIBM Tables Query DB2 8
Search our Forums:

Back to Top