Add a WHERE clause to the UNLOAD in a RC/Migrator migration strategy
search cancel

Add a WHERE clause to the UNLOAD in a RC/Migrator migration strategy

book

Article ID: 20102

calendar_today

Updated On:

Products

RC/Migrator for DB2 for z/OS RC Compare for DB2 for z/OS

Issue/Introduction

User requirement of a RC/Migrator for Db2 for z/OS (RCM) migration strategy requires that a WHERE clause be added to the UNLOAD
of data from a table. This information can be added in the Implode/Explode Services option of the strategy by specifying a name for the WHERE clause.

Resolution

On the RCM Implode/Explode Services screen, when updating the Strategy,  after scrolling to the right with PF11 the following will display:

In this sample, table authid1.table1 is the primary object of the migration. 

         20.0   --------- RC/M Implode/Explode Services -------- yy/mm/dd hh:mm
COMMAND ===>                                                  SCROLL ===> CSR

STRATEGY ===> table1               DESCRIPTION  ===>
CREATOR  ===> authid1              SHARE OPTION ===> U (U,Y,N,X,L)
SRC SSID ===> ssid                 NEW OBJECTS  ===> N (U,Y,N)
------------------------------------------------------------------ authid1  < >

   + >-EXPL OPT-+ AUX RTN MQT SEQ      SECU ALL  NUMBER
S      A   TG     IMP IMP IMP IMP   RI RITY ROWS OF ROWS   WHERE
_      A   A      _   _   _   _     _  _    _    ________  Y xxxxxxx
******************************* BOTTOM OF DATA ********************************

Under the WHERE heading, specify Y and a name for the WHERE clause...in this case the EQF is called REDCARS.

20.0  ----------- Data Query Edit ----------- ( Caps Off )   yyyy/mm/dd hh:mm
COMMAND ===>                                                  SCROLL ===> CSR

Query Name  ==> xxxxxxx   For Table: authid1.table1                            >
Description ==>                        >  Share  ==> Y        Default   ==> N
Confirm Replace ==> Y                  Auto Cast ==> Y        View SQL  ==> N
Test Count  ==> N         Shrink ==> N Row Limit ==>          Userid: authid1

Sel C Ord Column Name           Type    ----------- Where Condition ------- AND
S     __   1 col1           C(30)   = 'xxx'
S     __   2 col2           C(64)
S     __   3 col3           D(4,2)
S     __   4 col4           D(2,0)
******************************* BOTTOM OF DATA ********************************

The Data Query Edit screen will then display on which your WHERE conditions can be specified.

The above predicate will be searching table authid1.table1 for records to unload where column col1 = 'xxx' during the unload stage of the migration. 

The Analysis output would look like this:

For a model utilizing PTIUNLD:

.DATA
  FILE(PTIUNLD)
SELECT  col1 , col2 , col3 , col4
   FROM authid1.table1
  WHERE ( col1 = 'xxx' )
  ORDER BY cool1
  FOR FETCH ONLY
  ;
  LIMIT(ALL)
.ENDDATA

For a model utilizing FASTUNLOAD

.DATA
  FASTUNLOAD
   UNLDDN          SYSREC
   LIMIT           0
   OUTPUT-FORMAT   LOAD
   INPUT-FORMAT    TABLE
   VSAM-BUFFERS    80
   SORTNUM         2
   SORTDEVT        SYSDA
   ESTIMATED-ROWS  0
   SQL-ACCESS      EXTENSION
   TRUNCATE        NO
   SELECT col1, col2, col3, col4
   FROM authid1.table1
   NEWOBID 3
   WHERE  (  col1  =  'xxx'  )
   ORDER BY col1
   ;
.ENDDATA

Additional Information

RC/M Implode/Explode Services Dependent Object Selection

12. To create and selected extended data queries, scroll right (PF11) to view the Where field. Data queries let you specify the data to migrate.
The Where field has two prompts. The first prompt lets you create or select a new query. Valid values are as follows:
Y -- Create a new data query.
S -- Select a previously saved data query.
N -- Do not use a data query. This is the default.
Press PF3 (End) to save the strategy.