Entering DISCARD text

If you specify DISCARD, you must qualify the rows that you want to discard by specifying FROM TABLE with the WHEN option.

About this task

Records that meet the specified WHEN conditions are then discarded during the REORG TABLESPACE UNLOAD CONTINUE or UNLOAD PAUSE. For additional information about using the DISCARD option, refer to the Db2 Utility Guide for your version of Db2.

Procedure

  1. On the Reorg Utility Profile Options panel, enter Y in the Discard Include field to include the Discard options.
  2. Enter Y in the Update field for the Discard option and press Enter.
    An ISPF edit session appears in which you can enter the FROM TABLE...WHEN syntax. The first time you create a utility profile that specifies DISCARD, the text appears as follows:
    Figure 1. Edit session for entering DISCARD text
       File  Edit  Edit_Settings  Menu  Utilities  Compilers  Test  Help            
     
     EDIT       DISCARD_FROM_TABLE(S)_SQL_TEXT                  Columns 00001 00072 
     Command ===>                                                  Scroll ===> CSR  
     ****** ***************************** Top of Data ******************************
     000001 -- THE DISCARD TEXT MUST BE PRECEEDED WITH A COMMENT                    
     000002 -- DESCRIBING THE DATABASE AND TABLESPACE THAT THE                      
     000003 -- FOLLOWING TEXT IS ASSOCIATED WITH.                                   
     000004 -- EXAMPLE:                                                             
     000005 --                                                                      
     000006 -- DATABASE: MYDATABS TABLESPACE: MYSPACE1                              
     000007 --         FROM TABLE MYCRTR1.MYTABLE1                                  
     000008 --          WHEN (KEY_COL BETWEEN 6001 AND 7000)                        
     000009 -- DATABASE: MYDATABS TABLESPACE: MYSPACE2                              
     000010 --         FROM TABLE MYCRTR2.MYTABLE2                                  
     000011 --          WHEN (KEY_COL BETWEEN 6001 AND 7000)                        
     000012 --                                                                      
     000013 -- ---------------------------------- KEYWORD DATABASE: IS REQUIRED     
     000014 -- |         ------------------------ DATABASE NAME                     
     000015 -- |         |        --------------- KEYWORD TABLESPACE: IS REQUIRED   
     000016 -- |         |        |           --- TABLESPACE NAME                   
     000017 -- |         |        |           |                                     
     000018 -- V         V        V           V                                     
     000019 -- DATABASE: MYDATABS TABLESPACE: MYSPACE2                              
     000019 -- DATABASE: MYDATABS TABLESPACE: MYSPACE2                              
     000020            FROM TABLE CRTR1.TABLE1                                      
     000021             WHEN (KEY_COL BETWEEN 8001 AND 9000)                        
     000022            FROM TABLE CRTR2.TABLE2                                      
     000023             WHEN (KEY_COL BETWEEN 8001 AND 9000)                        
     000024            FROM TABLE CRTR3.TABLE3                                      
     000025             WHEN (KEY_COL BETWEEN 8001 AND 9000)                        
     000026                                                                         
     000027 -- DATABASE: DATABAS1 TABLESPACE: TABLSPC1                              
     000028            FROM TABLE CRTR4.TABLE4                                      
     000029             WHEN (KEY_COL BETWEEN 8001 AND 9000)                        
     000030                                                                         
     000031 -- DATABASE: DATABAS2 TABLESPACE: TABLSPC2                              
     000032            FROM TABLE CRTR5.TABLE5                                      
     ****** **************************** Bottom of Data ****************************
  3. Edit the text to fit your needs. The discard text must specify the table name(s) and the WHEN clauses that describe the rows to discard. In addition, the discard text must be preceded by a comment that includes the database name and table space name.
    The layout of the comment statement is as follows:
    -- ---------------------------------- KEYWORD DATABASE: IS REQUIRED    
    -- |         ------------------------ DATABASE NAME                    
    -- |         |        --------------- KEYWORD TABLESPACE: IS REQUIRED  
    -- |         |        |           --- TABLESPACE NAME                  
    -- |         |        |           |                                    
    -- V         V        V           V                                    
    -- DATABASE: MYDATABS TABLESPACE: MYSPACE2                             
    The comment describing the database and table space must be formatted as follows:
    • The keyword DATABASE must begin in column 4.
    • Your database name must begin in column 14.
    • The keyword TABLESPACE must begin in column 23.
    • Your table space name must begin in column 35.
    The remainder of the text (the FROM TABLE and WHEN clauses) must be entered per SQL statement syntax rules. Be sure to remove extra sample statements from the text before exiting the edit session.
    Note: The discard text is not validated by Db2 Automation Expert.
  4. When you are finished updating the discard text, press PF3 (END).