544
Princeton Softech’s Move for DB2 User Manual

Move for DB2 User Guide

Embed Size (px)

Citation preview

Page 1: Move for DB2 User Guide

Princeton Softech’s

Move for DB2User Manual

Page 2: Move for DB2 User Guide

User Manual ii

Move for DB2

User Manual

The software described in this manual and this manual are furnishedunder a license agreement or nondisclosure agreement. The softwareand the documentation may be used only in accordance with the termsof that agreement. No part of this manual may be reproduced ortransmitted in any form or by any means, electronic or mechanical,including photocopying and recording, for any purpose without theexpress written permission of Princeton Softech, Inc.

Copyright Princeton Softech, Inc. 1994, 1995, 1996, 1997, 1998,1999, 2000.All rights reserved.

Princeton Softech's Move for DB2TM Version 4.1 May 2000.

Princeton Softech's Access for DB2TM Version 4.1 May 2000.

Princeton Softech's Archive for DB2TM Version 4.1 May 2000.

Princeton Softech's Compare for DB2TM Version 4.1 May 2000.

ISPF/PDF, TSO, and DB2 are products of International BusinessMachines, Inc. (IBM).

LOADPLUS and UNLOAD PLUS are products of BMC Software,Inc.

IEF is a product of Sterling Software.

Page 3: Move for DB2 User Guide

User Manual iii

Table of Contents

About this Manual................................................................ 1

Documentation ........................................................................... 3

Summary of Amendments Release 4.1 ................................... 4

1. Introduction ..................................................................... 7

1.1 Processing Flow .................................................................. 8Extract Process ............................................................................8Insert Process ..............................................................................9

1.2 General Information........................................................... 121.2.1 Terminology ....................................................................121.2.2 Naming Conventions .......................................................151.2.3 Basic Screen Format and Handling ..................................17

2. Session Overview ........................................................... 21

2.1 Main Menu ....................................................................... 22

2.2 Specify the Source Data .................................................... 25Specify Tables ...........................................................................26Specify Criteria..........................................................................28Specify Object Definitions .........................................................31Perform the Extract ...................................................................33

2.3 Specify the Destination ...................................................... 36

3. Specify Access Definitions ............................................. 41

3.1 Choose an Access Definition.............................................. 423.1.1 Access Definition Selection List.......................................44

3.2 Components of an Access Definition.................................. 49

3.3 Table/View Selection......................................................... 503.3.1 Specifying Table Names...................................................57

3.3.1.1 Using a Selection List..........................................573.3.1.2 Automatically Inserting Table Names..................59

Page 4: Move for DB2 User Guide

Table of Contents

iv Move for DB2

3.3.1.3 Supporting Facilities ...........................................603.3.2 Handling the Table List ...................................................633.3.3 Access Definition Specific Commands .............................643.3.4 Completed Table Selection...............................................65

3.4 Specifying Criteria ............................................................ 673.4.1 Selection Criteria .............................................................683.4.2 Other Column Specifications ...........................................713.4.3 Zooming Column Information .........................................743.4.4 SQL WHERE Clause Specification ..................................753.4.5 Table Status Indicated......................................................78

3.5 Using the Point-and-Shoot Facility..................................... 803.5.1 Initial Display for Point-and-Shoot ..................................833.5.2 Point-and-Shoot Basics ....................................................84

3.5.2.1 Screen Elements ..................................................853.5.2.2 Displaying Column Attributes .............................883.5.2.3 Available Commands ..........................................89

3.5.3 Selecting Rows ................................................................903.5.4 Scrolling Data..................................................................91

3.5.4.1 Vertical Scrolling ................................................913.5.4.2 Horizontal Scrolling ............................................913.5.4.3 Locking Columns for Horizontal Scrolling ..........91

3.5.5 Excluding Rows...............................................................933.5.6 Finding Specific Data ......................................................943.5.7 Expanding Truncated Data ..............................................953.5.8 Displaying Hexadecimal Data ..........................................983.5.9 Using Sidelabels Format ..................................................99

3.5.9.1 Scrolling .............................................................993.5.9.2 Displaying Wide Data .......................................1003.5.9.3 Considerations When Using Sidelabels..............102

3.5.10 Joining Tables..............................................................1043.5.10.1 One Related Table ...........................................1043.5.10.2 Several Related Tables.....................................1073.5.10.3 No Related Tables ...........................................1083.5.10.4 More than One Relationship............................108

3.5.11 Handling Multiple Tables ............................................1093.5.11.1 Multiple Table Display ....................................1093.5.11.2 Coordinated Scroll...........................................1103.5.11.3 Zooming a Joined Table Display......................1113.5.11.4 Unjoining Tables .............................................113

3.5.12 Special Considerations for Multi-way Joining ..............1133.5.12.1 Using Join .......................................................1143.5.12.2 Scrolling..........................................................1163.5.12.3 Displaying Traversal Paths ..............................1173.5.12.4 Unjoining ........................................................119

3.5.13 Displaying SQL ...........................................................1203.5.14 Reporting.....................................................................1243.5.15 Terminating a Session..................................................1313.5.16 Row List Status Indicated.............................................133

3.6 Group Selection Processing ..............................................134

3.7 Selecting Relationships .....................................................1373.7.1 Displaying Information..................................................141

Page 5: Move for DB2 User Guide

Table of Contents

User Manual v

3.7.2 Relationship Status ........................................................1423.7.3 Displaying Traversal Information ..................................1463.7.4 Generating a Relationship Usage Report ........................148

3.8 Using Relationships ..........................................................1493.8.1 Sample Scenarios...........................................................1493.8.2 Traversal Cycles ............................................................1553.8.3 Referential Cycles ..........................................................157

3.9 Dynamically Defining the Access Definition......................164

3.10 Database Changes ..........................................................165

3.11 Access Definition Parameters..........................................167

3.12 Defining for Relational Tools .........................................169

4. Definitions .....................................................................171

4.1 Primary Keys ...................................................................1754.1.1 Specifying a Primary Key...............................................1764.1.2 Selection List of Primary Keys .......................................1784.1.3 Modifying a Primary Key...............................................1824.1.4 Defining Generic Primary Keys .....................................184

4.2 Relationships....................................................................1884.2.1 Specifying a Relationship...............................................1894.2.2 Selection List of Relationships .......................................1924.2.3 Creating a Relationship..................................................1964.2.4 Editing Relationships.....................................................1974.2.5 Saving and Using the Relationship.................................2104.2.6 Modeling Relationships .................................................2114.2.7 Generic Relationships ....................................................212

4.3 Column Maps...................................................................2184.3.1 Choosing a Column Map ...............................................2204.3.2 Selection List of Column Maps ......................................2224.3.3 Specifying Column Map Tables .....................................2264.3.4 Defining Column Maps..................................................2294.3.5 Validation......................................................................2334.3.6 Managing the Column Display ......................................2354.3.7 Specifying Source for Destination Columns ...................2374.3.8 Completed Column Map ................................................251

4.4 Table Maps ......................................................................2524.4.1 Choosing a Table Map ...................................................2524.4.2 Selection List of Table Maps..........................................2554.4.3 Specifying Table Map Sources .......................................2594.4.4 Defining Table Maps .....................................................2604.4.5 Including Column Maps ................................................265

4.5 Export and Import Processes ............................................2714.5.1 Using the Export Process ...............................................2724.5.2 Using the Import Process ...............................................279

Import Summary............................................................2814.5.3 File Format ....................................................................282

Primary Keys .................................................................283

Page 6: Move for DB2 User Guide

Table of Contents

vi Move for DB2

Relationships .................................................................284Column Maps ................................................................285Table Maps ....................................................................286Access Definitions .........................................................288Compare Definition .......................................................293

5. Data Migration .............................................................295

5.1 Migration Menu ...............................................................296

5.2 Extract Data.....................................................................3005.2.1 Extract Process Menu ....................................................3015.2.2 Select the Object Definitions ..........................................3035.2.3 Perform the Extract Process ...........................................306

5.2.3.1 UNLOAD PLUS................................................3095.2.3.2 Perform Convert with Extract.............................312

5.2.4 Extract Processing .........................................................3145.2.4.1 Batch Execution ................................................3175.2.4.2 UNLOAD PLUS................................................3245.2.4.3 Online Execution Status ....................................325

5.2.5 Extract Process Report ...................................................326

5.3 Control File Overview ......................................................328

5.4 Insert Process ...................................................................3305.4.1 INSERT Process Menu ...................................................3305.4.2 INSERT Process Table Map............................................3325.4.3 Perform Insert and Update/Insert Process........................3355.4.4 Insert Process Report ......................................................357

5.5 DB2 Load Process............................................................3595.5.1 DB2 Load Utility Parameters .........................................3625.5.2 LOADPLUS Utility Parameters......................................3685.5.3 Job Processing ...............................................................373

5.6 Delete Process ..................................................................379Batch Execution ......................................................................382

5.7 Create Process..................................................................3865.7.1 CREATE Process Menu.................................................3865.7.2 CREATE Process Defaults .............................................3875.7.3 CREATE Process Table Map .........................................4005.7.4 Perform Create Process ..................................................403

5.7.4.1 Create Database.................................................4125.7.4.2 Create Tablespace..............................................414

5.7.5 Grant Privileges.............................................................4175.7.6 SYNONYMS.................................................................4205.7.7 OUTPUT SQL ...............................................................422

5.8 Convert Process................................................................4245.8.1 Convert Extract File Panel .............................................4245.8.2 Perform Convert Process................................................4275.8.3 CONVERT Process Report ............................................429

5.9 Retry/Restart Process .......................................................432

5.10 Browse Extract File ........................................................436

Page 7: Move for DB2 User Guide

Table of Contents

User Manual vii

6. Specify Options.............................................................443

6.1 User Options ....................................................................444Change Line Characters ..........................................................448Specify Description and Security Status ...................................448

6.2 Editor and Display Options...............................................450

6.3 Job Card and Print Options...............................................455

7. Batch Maintenance Utilities .........................................457

7.1 Informational Control Statements......................................461DIRECTORY Statement..........................................................461

7.2 Utilities to Maintain PST Objects .....................................468DELETE Statement .................................................................468COPY Statement .....................................................................470RENAME Statement ...............................................................472

7.3 Utilities to Migrate PST Objects .......................................475Batch Export Utility.................................................................475Batch Import Utility.................................................................477

7.4 General Batch Control Statements.....................................479PAGESIZE Statement .............................................................479ERROR Statement...................................................................479OUTDD Statement ..................................................................480

A. Main Menu Variations ................................................481

B. Allocating External Files..............................................483

C. Exit Routines for Column Maps..................................489

D. Creating a Row List File..............................................493

E. Printing Extract and Control Files ..............................497

F. Compatibility Rules for Relationships.........................501

G. Skipped Columns.........................................................503

H. Date Formats ...............................................................505

Index...................................................................................509

Page 8: Move for DB2 User Guide

Table of Contents

viii Move for DB2

Page 9: Move for DB2 User Guide

User Manual ix

Table of Figures

Figure 1. Main Menu.................................................................... 22Figure 2. Data Migration Menu .................................................... 25Figure 3. Extract Process Menu.................................................... 26Figure 4. Using the GET TABLES RELATED Command ............ 27Figure 5. Related Tables Included................................................. 27Figure 6. Point-and-Shoot Display................................................ 29Figure 7. Selecting Relationships for MOVE functions.................. 30Figure 8. Extract Process Steps .................................................... 31Figure 9. Specify Object Definitions to EXTRACT....................... 32Figure 10. Extract Process Parameters.......................................... 33Figure 11. Extract Process Warnings ............................................ 34Figure 12. Extract Process Report Format .................................... 35Figure 13. Insert Process Menu .................................................... 36Figure 14. Insert Process Table Map - Initial Display.................... 38Figure 15. Insert Process Table Map - Modify Creator ID............. 39Figure 16. Specify Insert Process Parameters................................ 40Figure 17. Choose an Access Definition........................................ 42Figure 18. Select an Access Definition.......................................... 45Figure 19. Access Definition Attributes ........................................ 46Figure 20. Object Attributes ......................................................... 47Figure 21. Copy Access Definition ............................................... 47Figure 22. Rename Access Definition ........................................... 48Figure 23. Select Tables/Views for AD – Access Rights ............... 51Figure 24. Select Tables/Views for AD - Criteria Portion.............. 55Figure 25. Table Selection List ..................................................... 58Figure 26. Selected Table Included in Access Definition................ 58Figure 27. Indented Table Display ................................................ 61Figure 28. Selecting A Table For Column Handling ...................... 68Figure 29. Specify Selection Criteria for AD................................. 69Figure 30. Selection Criteria Specified.......................................... 71Figure 31. Describe Columns for AD............................................ 72Figure 32. Zoomed Column Information ....................................... 75Figure 33. Specify SQL WHERE Clause...................................... 76Figure 34. SQL WHERE Clause Indicated ................................... 78Figure 35. Column Specifications Indicated .................................. 79Figure 36. Start Table Row Selection Prompt ............................... 81

Page 10: Move for DB2 User Guide

Table of Figures

x Move for DB2

Figure 37. Columnar Screen Elements .......................................... 85Figure 38. Sidelabels Screen Elements .......................................... 85Figure 39. Column Attributes Displayed ....................................... 88Figure 40. Selecting Primary Key Values...................................... 90Figure 41. Unselecting Primary Key Values.................................. 90Figure 42. Repositioned Locked Column....................................... 92Figure 43. Excluding Rows .......................................................... 93Figure 44. Excluded Rows Message.............................................. 94Figure 45. Expanding When Length Exceeds Display Width ......... 96Figure 46. Expanded Column Display........................................... 97Figure 47. Hexadecimal Values Displayed .................................... 98Figure 48. Sidelabels Display ....................................................... 99Figure 49. Locked SHIP_UPDATED Column .............................100Figure 50. Column Wrapping ......................................................101Figure 51. Using EXPAND in Sidelabels Format .........................102Figure 52. Attributes in Sidelabels Format ...................................103Figure 53. Using JOIN Command................................................105Figure 54. Result of Joining.........................................................106Figure 55. Table Selection List Prompt........................................107Figure 56. Relationship Selection List Prompt..............................108Figure 57. Sample Multiple Table Display...................................109Figure 58. Zoom Multi-Table Display .........................................112Figure 59. Result of Zooming Display .........................................112Figure 60. Sample Multiple Table Display...................................116Figure 61. Indented Table Display ...............................................118Figure 62. Text Display of Generated SQL..................................121Figure 63. Output Data Options Panel .........................................122Figure 64. Specify Report Options...............................................124Figure 65. Report Format Parameters ..........................................127Figure 66. Point-and-Shoot Confirmation Prompt ........................131Figure 67. Confirm Temporary Point-and-Shoot Values...............131Figure 68. Reconfirm Temporary Point-and-Shoot Values............132Figure 69. Confirm Drop Start Table Options..............................132Figure 70. Row List Indicated......................................................133Figure 71. Start Table Group Selection Processing.......................134Figure 72. Group Processing Indicated.........................................136Figure 73. Specify Relationship Usage Panel ...............................137Figure 74. Relationship Information.............................................141Figure 75. Selecting Relationships for MOVE Functions..............142Figure 76. Status Revised............................................................143Figure 77. Specify Relationship Usage Panel Redisplayed............144Figure 78. Unknown Relationship................................................145Figure 79. Default Specifications for Q1 and Q2..........................150Figure 80. Both Q1 and Q2 Set to Yes.........................................151Figure 81. Set Q2 to Yes for One Relationship.............................152Figure 82. Set Q1 and Q2 for Multiple Children ..........................154Figure 83. Set Q1 and Q2 for Multiple Relationships ...................156Figure 84. Set Q1 and Q2 to NO .................................................159Figure 85. Set Q1 to Extract Parent .............................................160

Page 11: Move for DB2 User Guide

Table of Figures

User Manual xi

Figure 86. Set Q1 and Q2 to YES................................................161Figure 87. Set Q1 to YES............................................................162Figure 88. Unselect to Disable RI Cycle.......................................163Figure 89. Access Definition Parameters......................................167Figure 90. Choose a Definition Option.........................................171Figure 91. Choose a Primary Key ................................................176Figure 92. Select Primary Keys ...................................................178Figure 93. Primary Key Attributes...............................................179Figure 94. Object Attributes ........................................................180Figure 95. Copy Primary Key......................................................180Figure 96. Rename Primary Key..................................................180Figure 97. Modify PST Primary Key ...........................................182Figure 98. Select One or More Columns ......................................183Figure 99. Name a Generic Primary Key......................................185Figure 100. Specify Creator ID for Base Table ............................185Figure 101. Confirm Generic Processing Prompt..........................186Figure 102. Generic Key Override Confirmation Prompt..............186Figure 103. Confirm New Base CreatorID...................................187Figure 104. Choose a Relationship Panel .....................................189Figure 105. Select Relationships Panel.........................................192Figure 106. Relationship Attributes Panel ....................................193Figure 107. Object Attributes ......................................................194Figure 108. Copy Relationship ....................................................194Figure 109. Rename Relationship ................................................195Figure 110. Create New Relationship Panel .................................196Figure 111. Define Relationship Panel .........................................198Figure 112. Literal String ............................................................200Figure 113. Selecting Columns from List .....................................202Figure 114. Selected Columns Inserted ........................................203Figure 115. Concatenated Columns..............................................204Figure 116. Substring of Column.................................................205Figure 117. Expanded Relationship Editor Prompt .......................207Figure 118. Model New Relationship Prompt...............................211Figure 119. Verify MODEL Command Prompt............................212Figure 120. Creating a Generic Relationship ................................213Figure 121. Specify Creator ID for Base Table ............................214Figure 122. Create New Generic Relationship..............................214Figure 123. Confirm GENERIC Processing Prompt.....................215Figure 124. Generic Relationship Override Confirmation Prompt .215Figure 125. Prompt for Creator ID ..............................................216Figure 126. Modify Generic Relationship.....................................217Figure 127. Choose a Column Map .............................................220Figure 128. Select Column Maps.................................................222Figure 129. Column Map Attributes ............................................223Figure 130. Object Attributes .......................................................224Figure 131. Copy Column Map ...................................................224Figure 132. Rename Column Map ...............................................225Figure 133. Specify Column Map Tables.....................................226Figure 134. Define Column Map - Initial Column List .................230

Page 12: Move for DB2 User Guide

Table of Figures

xii Move for DB2

Figure 135. Display Unmapped Columns.....................................235Figure 136. Matching Unused Source Columns............................236Figure 137. Define a Column Map - Return from LIST................237Figure 138. Aging Specifications .................................................239Figure 139. Expanded Source Column Field ................................250Figure 140. Choose a Table Map.................................................252Figure 141. Select Table Map......................................................255Figure 142. Table Map Attributes................................................256Figure 143. Object Attributes ......................................................257Figure 144. Copy Table Map........................................................257Figure 145. Rename Table Map...................................................258Figure 146. Specify Table Map Source........................................259Figure 147. Define Table Map.....................................................260Figure 148. Listing Available Destination Tables .........................262Figure 149. Define Table Map - Return from LIST......................263Figure 150. Select One Column Map ...........................................266Figure 151. Column Maps Specified............................................269Figure 152. Edit Column Map Confirmation................................270Figure 153. Export Process Panel ................................................272Figure 154. Choose an Access Definition to Export......................275Figure 155. Select Access Defintions to Export............................276Figure 156. Export Summary ......................................................278Figure 157. EXPORT Process Report..........................................279Figure 158. Import Process Panel ................................................279Figure 159. Import Summary.......................................................281Figure 160. IMPORT Process Report ..........................................282Figure 161. Data Migration Menu ...............................................296Figure 162. Extract Process Menu...............................................301Figure 163. Specify Object Definitions to EXTRACT..................304Figure 164. Specify EXTRACT Parameters and Execute.............306Figure 165. Select Extract Data Set .............................................309Figure 166. Specify BMC UNLOAD PLUS Parameters for Extract309Figure 167. Specify EXTRACT Parameters and Execute.............311Figure 168. Specify Convert Parameters ......................................312Figure 169. Extract Process Warnings .........................................317Figure 170. Save JCL Options.....................................................323Figure 171. Extract Process Status ..............................................325Figure 172. Extract Process Report Format .................................326Figure 173. Insert Process Menu..................................................330Figure 174. Insert Process Table Map..........................................332Figure 175. Specify INSERT Parameters and Execute .................337Figure 176. Specifying Aging Parameters ....................................341Figure 177. Propagating Key Set(s) .............................................346Figure 178. CREATE Object List when UNKNOWN Destination

Tables ..................................................................................348Figure 179. Insert Process Status.................................................350Figure 180. Save JCL Options.....................................................356Figure 181. Insert Process Report Format ....................................357Figure 182. DB2 LOAD Process Menu .......................................360

Page 13: Move for DB2 User Guide

Table of Figures

User Manual xiii

Figure 183. Specify DB2 LOAD Parameters and Execute ............362Figure 184. Specify LOADPLUS Parameters and Execute...........368Figure 185. Save JCL Options.....................................................374Figure 186. Specify DELETE Parameters and Execute ................379Figure 187. Delete Process Status................................................382Figure 188. Delete Process Report Format ...................................384Figure 189. CREATE Process Menu ...........................................386Figure 190. CREATE Defaults Menu..........................................388Figure 191. Table Defaults ..........................................................389Figure 192. Tablespace Defaults..................................................392Figure 193. Index Defaults ..........................................................396Figure 194. Creator ID Defaults ..................................................399Figure 195. Create Process Table Map ........................................401Figure 196. CREATE Object List................................................403Figure 197. SHOW INDEX on CREATE Object List..................411Figure 198. DB2 Output from CREATE .....................................412Figure 199. Create Database .......................................................412Figure 200. Create Tablespace ....................................................414Figure 201. Grant Privileges........................................................418Figure 202. CREATE Additional Synonyms ................................420Figure 203. Output SQL..............................................................422Figure 204. CONVERT Extract File ...........................................424Figure 205. Convert Process Status .............................................427Figure 206. Convert Process Report Format ................................429Figure 207. Pending Process List - User's SQL ID .......................432Figure 208. Pending Process List - All SQL IDs ..........................434Figure 209. Pending Process Information.....................................434Figure 210. Restart Delete Process ..............................................435Figure 211. EXTRACT or CONTROL File Browse Parameters ..436Figure 212. Browse Control File - Statistics.................................439Figure 213. Browse Control File - Status of Each Row ................440Figure 214. Options Menu............................................................443Figure 215. User Options Panel ...................................................444Figure 216. Line Characters Pop-up Prompt ................................448Figure 217. Object Attributes ......................................................449Figure 218. Editor and Display Options Panel..............................450Figure 219. Job Card and Print Options .......................................455Figure 220. Main Menu - Move Only ..........................................481Figure 221. Main Menu - Remote Access ....................................482Figure 222. Allocate Dataset Panel ..............................................483Figure 223. Specify Primary Key Values without Point-and-Shoot494Figure 224. Specify Partial Primary Key - Example 1 ..................495Figure 225. Specify Partial Primary Key - Example 2 ..................496

Page 14: Move for DB2 User Guide

Table of Figures

xiv Move for DB2

Page 15: Move for DB2 User Guide

User Manual 1

About this Manual

This manual details how to use Move for DB2 to extract relationalsets of DB2 data and move them to destination databases.

Organization

The information in this manual is organized into the following sections:

1. Introduction General information helpful for usingMove for DB2 including basic screen handlingand terminology.

2. Session Overview Session overview providing a shortdemonstration of how to extract and insertdata. We recommend that you read thedemonstration for an overview of the basicprocessing flow using Move for DB2.

3. Access Definitions Explanation of defining and modifying the setof specifications called an Access Definition.The Access Definition is used to select the dataused to create an Extract File.

4. Definitions Description of defining and modifying primarykeys, relationships, Column Maps, and TableMaps. Information is also provided aboutexporting and importing these definitions.

5. Migration Description of the basic steps required to copydata, create an Extract File and then performinsert and delete processes.

Other pertinent facilities are discussedincluding: creating DB2 objects, transformingthe Extract File data for use with the DB2

Page 16: Move for DB2 User Guide

About this Manual

2 Move for DB2

Load or relational databases on otherplatforms, retrying and restarting an insert ordelete process, and browsing Extract Files.

6. Options Explanation of the user options. A discussionof the job card and print options is alsoincluded.

A. Main Menu The Main Menu panel that is displayed whenonly Move for DB2 is installed.

B. AllocatingExternal Files

Details about the services Move for DB2provides to allocate external files.

C. Exit Routines forColumn Maps

Details about using exit routines when definingColumn Maps.

D. Creating a RowList File

Information about how to create a Row Listfile for values that do not reside in DB2. Thisfile contains the primary key values used as thestarting point for an Extract Process.

E. Print Extract File Information about how to print the contents ofthe Extract File or Control File.

F. CompatibilityRules forRelationships

Details about the column compatibility ruleswhen defining relationships to the PrincetonSoftech Directory.

G. Skipped Columns Information about how Move for DB2 handlesvalues that are not valid dates when aging.

H. Date Formats Information about specifying formats forvalues that are to be aged.

I. Migrate ObjectDefinitions inBatch

Information about migrating the PST objectdefinitions in batch.

For ease of reading, the text in this manual refers to Move for DB2 asMOVE.

Page 17: Move for DB2 User Guide

Documentation)

User Manual 3

Documentation

The following is a list of Relational Tools documentation.

Access for DB2 Introduction Overview of Access for DB2 andbasic information on accessingand editing a related set of data,creating Access Definitions, andprocessing embedded SQL.

Access for DB2 User Manual Detailed information on accessingand editing a related set of data,and creating and maintainingAccess Definitions, primary keysand relationships in the PrincetonSoftech Directory.

Move for DB2 Introduction Overview of Move for DB2 andinformation on migrating arelated set of data.

Move for DB2 User Manual Detailed information on using theMove for DB2 facilities forextracting and loading a relatedset of DB2 data.

Compare for DB2 Introduction Overview of Compare for DB2and information on comparingtwo sets of related data.

Compare for DB2 User Manual Detailed information on using theCompare for DB2 facilities tocompare two sets of related data.

Archive for DB2 User Manual Detailed information on using theArchive for DB2 facilities toarchive and restore related data.

Relational Tools CommandReference Manual

Detailed information about all ofthe Relational Tools commands.

Relational Tools Installationand Administration Guide

Instructions for installing andmaintaining the RelationalTools.

Page 18: Move for DB2 User Guide

About this Manual

4 Move for DB2

Summary of Amendments Release 4.1

This manual includes the following enhancements for release 4.1 ofMOVE:

Support for DB2 version 6

This release provides support for new features included in DB2 v6.The Relational Tools can detect when version 6 is being used andwill provide the following enhancements:

• Support for the new 8K and 16K buffer pools is provided for usewhen creating DB2 Tablespaces and Databases.

• The CREATE DATABASE facility supports the specification ofindex buffer pools.

• The COPY attribute for indexes is supported and will beextracted and included in the CREATE INDEX DDL generation,where appropriate.

• ADB2EXPL now supports the new DB2 EXPLAIN output whichincludes the new STATEMENT and FUNCTION tables.

• The Relational Tools have been updated to ensure nodiscontinued DB2 keywords will be generated. This includes theremoval of all references to DSETPASS, removal of SUBPAGEand TYPE 1 specification for indexes and the use of RO for thecreation of databases.

Creating PST Objects

The CREATE object facility has been enhanced with the followingfunctions:

• A new DROP ALL primary command that will drop all tablesthat currently exist, as well as their subordinate objects.

• The ability to use variables as default specifications fortablespace and database names. This will assist in providingsupport for users that have naming conventions for objects thatare related to the names of the generated tables. The variablesavailable allow database names to be based on a table nameand/or creator id. The variables available allow tablespace namesto be based on the table name, creator id and/or database name.

Page 19: Move for DB2 User Guide

Summary of Amendments ( Release 4.1)

User Manual 5

Selecting Tables/Views for an AD

This dialog has been enhanced with the following functions:

• The different columns in the selection list may now be sorted ineither ascending or descending order. For example, the list oftables may be sorted in ascending sequence, based on their“status”.

• Support for the FIND command has been extended to include thestatus column. This will allow the user to perform a findoperation on a status such as “SQL” to find all tables that have anSQL WHERE Clause specified.

Batch Utility for PST Directory Maintenance

A new batch utility has been added to help maintain the PSTDirectory. This new utility includes the following functions:

• Ability to produce a summary report for one or more PSTobjects. User specified criteria may be provided to determine thecontents of the report.

• Ability to produce a detailed report of each object type. Userspecified criteria may be provided to determine the contents of thereport and the format of the report.

• The COPY, RENAME and DELETE commands for PST objectsare now available in batch. These commands support wildcards,allowing many objects to be processed at one time.

BMC Integration

The following enhancements have been added to the integration withBMC’s Unload Plus:

• Any specific “image copy” dataset name may be used whenextracting data from image copies using BMC’s Unload Plus.

• New batch overrides have been added for BMC Unload Plusprocessing. This will allow the date, time, dataset and processingmode to be changed using the override facility.

Page 20: Move for DB2 User Guide

About this Manual

6 Move for DB2

Miscellaneous Changes

The following general enhancements have also been added:

• The user now has an option to request the inclusion of the list oftables processed as generated JCL comments in the generatedbatch JCL. This option is available for batch operations forExtract and Insert/Update.

• Support for the inclusion of self-documenting comments in anSQL WHERE Clause when editing or specifying criteria.

• A new globally available primary command, REFRESHDIRECTORY that can flush and subsequently refresh theRelational Tools internal cache buffer.

• Two new line commands, COPY and RENAME are available forall PST objects. These line commands are available on theselection list for each object type.

• Information listing the available line commands for PST objectselection lists has been added to the top of the selection list paneldisplay.

Minor editorial and technical changes have been made throughout thismanual.

Page 21: Move for DB2 User Guide

User Manual 7

1. Introduction

MOVE is a relational copy facility used to copy or move relationallyintact sets of data from multiple source tables to correspondingdestination tables. MOVE handles any number of tables and anynumber of relationships regardless of the complexity.

MOVE is indispensable for:

• Creating test databases that are relationally intact subsets ofan existing production database.

• Copying related sets of data from a production database to a“work area” where any problems can be resolved. Then, thecorrected data can be re-introduced to the productiondatabase.

• Migrating subsets of data that require data transformations aspart of the migration.

Programmers and DBAs are no longer required to spend countlesshours writing programs to accomplish these tasks. Instead, MOVEprovides an interactive utility to prompt for the necessary informationand perform the task.

MOVE runs as a TSO/ISPF application and incorporates familiarISPF commands. The Help and Tutorial facility in ISPF are alsosupported. Menu-driven prompt screens or panels are used to specifywhich data to obtain and which process to perform. Intelligent screenhandling technology provides simultaneous display of multiple tables,pop-up windows, cursor-sensitive online help, and tutorials.

Page 22: Move for DB2 User Guide

1. Introduction

8 Move for DB2

1.1 Processing Flow

To copy a related set of data, you define the source of the data and thedestination. The source is defined in the Extract Process and thedestination in the Insert Process.

Extract Process

An Extract is the process of copying data from a set of one or morerelated tables to an “Extract File”. An Extract File is a sequential filethat contains the extracted data and information about that data. Theinformation defines the characteristics of the data, and optionallyincludes the object definitions for that data. (Object definitions arethe definitions for tables, keys, indexes, and so forth.) Once stored,an Extract File can be used repeatedly to create new or refreshexisting databases.

To perform an Extract Process specify:

• The names of the tables involved in the extract and select one ofthese tables as the starting point or Start Table.

• The relationships between the selected tables that are to be usedfor the extract. This step is optional. By default, all relationshipsare used.

• For the data, you can qualify which rows are to be extracted byspecifying:

Selection criteria for any of the tables,A random selection factor and maximum row limit, andSpecific rows in the Start Table.

• For the object definitions, table and column definitions are alwaysextracted. You can select which of the following subordinatedefinitions are to be extracted:

Primary Keys and RelationshipsIndexesViewsAliasesSynonymsColumn Field Procedure Names

Page 23: Move for DB2 User Guide

1.1 Processing Flow

User Manual 9

The information that is defined for the Extract Process—table names,relationships, and selection criteria—is stored in an Access Definition.Access Definitions are available to all Relational Tools. In fact,Access Definitions defined using Access for DB2 orCompare for DB2 can be used by MOVE.

You can also define a temporary Access Definition to be used for asingle Extract Process.

If BMC's UNLOAD PLUS is available, you can specify whether it isto be used to extract the data.

Insert Process

Once an Extract File is created, the data contained in the file can beinserted into the destination tables. These tables may or may notreside in the same DB2 subsystem.

Table Maps are used to match source tables to destination tables.Using Table Maps, individual tables can be excluded and unlikenamed tables can be mapped.

You can use an existing Table Map (APPLY command), or define theTable Map along with the other specifications for the process.

When the columns in the destination table match the columns in thesource table, MOVE automatically inserts the data. When thecolumns do not match, Column Maps can be used.

Column Maps are used to match source columns to destinationcolumns that have different column names. These maps also enableusers to specify defaults, literals, constants, expressions, and exitroutines to populate destination columns. Although MOVEautomatically handles many transformations, exit routines can be usedfor more complex processing.

If the destination tables do not exist, MOVE generates the appropriateSQL DDL statements to create the tables either as part of the Insert oras a separate step. The created tables can be identical to the sourcetables with the destination columns taking on the attributes of thecorresponding source columns or the table definitions can bemodified.

In addition to tables, other object definitions such as primary keys,relationships, indexes, and so forth that have been extracted with thedata, can be created by request.

Access Definition

Table Maps

Column Maps

Create ObjectDefinitions

Page 24: Move for DB2 User Guide

1. Introduction

10 Move for DB2

Insert processing is determined by whether or not the row exists. Arow is inserted when the primary key value is unique indicating thatthe row does not exist. However, if the primary key value is notunique, a row already exists, one of two actions is taken as indicatedby the user:

• With a simple Insert, the row to be inserted is marked asdiscarded and it is not inserted.

• With Update/Insert processing, the row to be inserted replaces orupdates the existing row.

MOVE also handles tables that do not have primary keys.

Several other processes or facilities are provided in addition to Extractand Insert. These include:

DB2 LOAD The Extract File can be transformed to DB2Load format to take advantage of the IBMDB2 Load Utility to insert large volumes ofdata. (This option can be modified to useBMC’s LOADPLUS.)

Delete Process Once an Extract File is created, theextracted data can be deleted from thesource tables.

Create Process The object definitions in the Extract Filecan be used, without inserting source data,to create tables, primary keys andrelationships, indexes, views, aliases, andsynonyms.

Convert Process The data in the Extract File can betransformed based on the Table Map andColumn Maps and saved as modified. Thisis useful to mask source data and createconsistent, refreshable test data.

Retry Retry can be executed when an Insert orDelete process could not be performed forone or more rows in the Extract File. Whena process cannot be performed for a specificrow, that row is marked as discarded. TheRetry Process will attempt the previousoperation for just the rows that werediscarded.

Insert Processing

Other Processes

Page 25: Move for DB2 User Guide

1.1 Processing Flow

User Manual 11

Restart Restart can be executed when a processdoes not complete successfully. A processcan terminate unexpectedly due to resourcerestrictions, such as space allocation or timelimitations.

Using Restart, the process is restarted fromthe last commit point. MOVE keeps trackof the last successfully committed row inthe Extract File, and restarts the processwith the next row in the file.

Browse The Extract File can be browsed. This isuseful for reviewing the error status ofindividual rows or for determining whatdata is in an Extract File.

Page 26: Move for DB2 User Guide

1. Introduction

12 Move for DB2

1.2 General Information

This section discusses general information about MOVE. Thisincludes the terminology used to describe MOVE and basic systemconcepts.

1.2.1 Terminology

The following paragraphs describe some common terms and how theyrelate to using MOVE.

Throughout this document, “tables” refers to tables, views, aliases,and synonyms, which are operated on in a similar manner. Thedifferences in handling are noted where pertinent.

MOVE enables you to define and store a description of the set of datato be extracted. This description is referred to as an AccessDefinition. The same Access Definitions can be used byAccess for DB2 to browse and edit data in DB2 tables, byCompare for DB2 to select data from DB2 tables for the CompareProcess, and by Archive for DB2 to archive data in DB2 tables.

An Access Definition contains a variety of information including:

• Set of tables from which to extract.

• Relationships to use to determine traversal paths for theExtract Process.

• Optionally, sort and selection criteria.

• Various other criteria discussed in later sections of thismanual.

An Access Definition can be used repeatedly to extract the same set ofdata. An Access Definition can be saved for future use. A saveddefinition can be modified and saved under the same name or a newname.

The first table from which the data is extracted is the Start Table. Allother tables are accessed in logical sequence based on tablerelationships and specifications in the Access Definition.

The name of an Access Definition is composed of three parts:

GROUP.USER.NAME

Tables

Access Definitions

Page 27: Move for DB2 User Guide

1.2 General Information

User Manual 13

The group and user portions are useful when organizing projects byassigning a different group name to each project and, within theprojects, a different user value for each person working in the group.

An Extract File is a sequential file that contains the extracted dataand information about that data. The information defines thecharacteristics of the data. Once created, an Extract File can bereused. This provides a constant set of data with which to create andrefresh test databases. (The Extract File can also be used byCompare for DB2. Users can compare the test database ‘after’testing an application with the ‘before’ version of the data in theExtract File.)

MOVE uses the referential integrity information stored in the DB2Catalog. The table and column information is also obtained from theDB2 Catalog. When the DB2 Catalog does not contain the neededrelationship information, user-specified definitions stored in the PSTDirectory are used to supplement the Catalog.

The PST Directory contains information necessary for accessing DB2data. This information includes user-specified:

Access DefinitionsPrimary Key DefinitionsRelationship DefinitionsColumn MapsTable Maps

Access Definitions, Column Maps, and Table Maps are unique toRelational Tools, but primary key definitions and relationships areusually available in the DB2 Catalog. MOVE takes advantage of theDB2 Catalog for that information whenever possible. However, whenthe information is not available in the DB2 Catalog, you can useMOVE facilities to specify the information and store it in the PSTDirectory.

The primary key definition contains the name of the column orcolumns that uniquely identifies each row. For example, assume aCUSTOMERS table has a column CUST_ID that contains a uniquevalue for each row in the table. The column CUST_ID would be anacceptable primary key for the CUSTOMERS table.

MOVE requires primary keys when:

• Extracting data from a table that has two or more parents. Theprimary key guarantees uniqueness of the extracted rows.

• Updating a table. The primary key provides the ability to identifywhether a row exists.

Extract File

ReferentialIntegrity Rules

Directory

Primary KeyDefinition

Page 28: Move for DB2 User Guide

1. Introduction

14 Move for DB2

The relationship definition is the information that specifies how twotables are related. For the DB2 Catalog, the relationship is defined bya primary key/foreign key pairing. The foreign key is the set ofcolumns in a child table that describe the correspondence with theprimary key columns in the parent table. For example, assume anORDERS table contains a column CUST_ID that can be related tothe primary key column CUST_ID in the CUSTOMERS table. Thecolumn in the ORDERS table is the foreign key.

Although relationships based on the primary key/foreign key pairingcan be defined in the PST Directory, users can specify relationshipsbased on any set of compatible columns between two tables. Aprimary key is not required in either of the tables. In addition,relationships in the PST Directory can be defined using substring andconcatenation functions for columns as well as literal and constantvalues.

Whenever a list of relationship definitions is presented, the source isindicated. Relationships from the DB2 Catalog are identified as DB2relationships, relationships from the PST Directory are PSTrelationships. Only PST relationships can be created and modified usingthe relationship definition function provided by MOVE. (DB2relationships can be created using the Create Process.) However, DB2relationships can be used as the ‘model’ for new PST relationships.

The PST relationships are defined by and available to all RelationalTools interchangeably.

The Table Map definition or Table Map is a set of specificationsused by MOVE to match the sets of source tables to destinationtables.

The Table Map name consists of two parts:

MAPID.MAPNAME

The MAPID is frequently used to group the maps by user or project.

Table Maps are also used and created by Compare for DB2. Theycan be used interchangeably.

RelationshipDefinition

Table MapDefinition

Page 29: Move for DB2 User Guide

1.2 General Information

User Manual 15

The Column Map definition or Column Map is a set ofspecifications used by MOVE to determine which source data is usedto populate each destination column when the Insert Process, LoadProcess, or Convert Process is performed.

The Column Map name consists of two parts:

MAPID.MAPNAME

The MAPID is frequently used to group the maps by user or project.

Column Maps are also used and created by Compare for DB2. TheColumn Maps created using Compare for DB2 can always be usedby MOVE. However, the converse is not always possible. MOVEprovides additional facilities not available in Compare for DB2.

This document refers to the parameters required by DB2 to create objectsas object definitions. MOVE can be used to migrate these objects fromone subsystem to another by extracting the object definitions from thesource and creating the objects based on these definitions at thedestination. The following objects can be migrated:

Tables Indexes AliasesViews Primary Keys Synonyms

Relationships Column Field Procedure Names

1.2.2 Naming Conventions

Naming conventions for the following must conform to DB2 standards:

Tables ViewsColumns IndexesPrimary Keys AliasesRelationships SynonymsAuthorization ID (also referred to as Creator ID)

The following objects are unique to MOVE and must be composed ofcharacters that are valid in SQL identifiers. These object names andthe maximum length of each are:

Group ID 8User ID 8Map ID 8Access Definition base name 12Column Map base name 12Table Map base name 12

Column MapDefinition

Object Definitions

Page 30: Move for DB2 User Guide

1. Introduction

16 Move for DB2

A DB2 delimited identifier is a sequence of one or more charactersenclosed within SQL escape characters or delimiters. MOVEsupports DB2 delimited identifiers for any DB2 objects.

Delimited identifiers are not supported for the names of AccessDefinitions, Table Maps, and Column Maps.

Delimited identifiers can be supplied as the operands of primarycommands but quotation marks must be used as the delimiters.

Since a delimited identifier can exceed the space allocated on the panelsfor certain output fields, MOVE will truncate any name whose lengthexceeds the field length on the panel. The field is protected and cannot beedited. Line commands can be used to delete the entry. When linecommands are not available (for example, specifying the Start Table orthe default Creator ID), the field is large enough to support the maximumwidth and may be edited.

To conserve space, the delimiters are not included with the delimitedidentifier when the name is provided in the heading of a panel.Delimiters are also omitted when the delimited names are presented inselection lists.

When specifying names as operands for the commands and on panels,MOVE supports the standard DB2 naming conventions. Thisincludes the ability to use DB2 LIKE syntax to obtain a selection list.The characters that have special meaning are:

% Represents any number of characters_ Represents any single character

MOVE uses external files to store information necessary for MOVEprocesses and to provide documentation about those processes. Forthese files, you can specify unqualified names, without quotes, and thedefault prefix specified on the User Options panel is automaticallyadded to the file name. For example, if a file is specified as:

SAMPLE.CONTROL.FILE

and the current default prefix is PSTDEMO, the file is assumed to benamed:

PSTDEMO.SAMPLE.CONTROL.FILE

If you want to specify the name explicitly, enclose it in single quotesas in:

'SAMPLE.CONTROL.FILE'

DelimitedIdentifiers

Using DB2 LIKESyntax

File Names

Page 31: Move for DB2 User Guide

1.2 General Information

User Manual 17

An asterisk, specified alone or as the last character in the data setname, is used to obtain a selection list. For example, to obtain aselection list of names that begin with PSTDEMO.SAMP, specify:

'PSTDEMO.SAMP*

(For more information about specifying a default data set prefix, seeSection 6. Specify Options)

1.2.3 Basic Screen Format and Handling

This manual describes the process necessary to create an AccessDefinition, to extract data from a DB2 database, insert the extracteddata at a specified destination, and maintain supplemental informationstored in the Directory. In so doing, all of the basic screens used toperform these functions will be discussed in a logical order. The sizeof the screen in the examples varies. During an actual session, thenumber of lines depends on the type of terminal being used.

MOVE emulates ISPF commands and screen format and handling.

For the most part, the figures in this manual present the panels as theyappear when all Relational Tools are available. Those facilities thatare available with MOVE are documented in this manual. Thosefacilities available exclusively with Access for DB2 are noted in thismanual and documented in the Access for DB2 User Manual. Thosefacilities available exclusively with Compare for DB2 are noted inthis manual and documented in the Compare for DB2 User Manual.Those facilities available exclusively with Archive for DB2 are notedin this manual and documented in the Archive for DB2 User Manual.

MOVE incorporates a unique pop-up window facility independent ofthe current ISPF release. The pop-up windows supply prompts tofacilitate the current functions without terminating that function.

Some of these pop-up windows provide selection lists. For example,when defining the tables to be included in the Access Definition, apop-up window containing a list of available tables can be displayed.The tables can be selected directly from this list. When the pop-upwindow is removed, the selected tables are automatically included inthe Access Definition and the definition process continues.

The characters used to draw the box around the pop-up window aresite-defined. User options are provided to change these characters.Throughout this manual, pop-up windows are delimited by easy-to-read dashes and vertical bars.

Common Panel

Pop-up Windows

Page 32: Move for DB2 User Guide

1. Introduction

18 Move for DB2

The function keys are handled as in ISPF. The keys provide a simpleway to execute primary commands. When a function key is pressed,it is evaluated as if the command assigned to the key was typed in theprimary command area of the screen. (See the Relational ToolsCommand Reference Manual for information on assigning values tofunction keys.)

The ISPF command PFSHOW is available to specify whether thefunction key assignments are displayed on the screen. The ISPFcommand KEYS is available to display the list of the function keyassignments. This list is modifiable.

Changes to the PF key assignments during a Relational Tools sessiononly affect the assignments while using Relational Tools. They donot affect the assignments when using other ISPF applications.

Several functions are frequently assigned to function keys. Thefollowing are of note:

HELP Displays information. When an error condition ispresent, a one-line message is displayed the first timethe HELP key is pressed. If the HELP key is presseda second time, a full-screen display addresses thedetails of the error and how to correct it.

When an error condition is not present, the HELP keydisplays a full-screen help panel. This informationexplains the purpose and use of the current panel. Italso lists the commands available on the currentpanel. HELP is usually assigned to PF1.

END Signals that input is to be processed and the currentpanel is to be terminated. The display returns to thepreviously displayed panel. END is usually assignedto PF3.

Function Keys

FunctionsFrequentlyAssigned to Keys

Page 33: Move for DB2 User Guide

1.2 General Information

User Manual 19

All ISPF scrolling functions are supported. Vertical and horizontalscrolling is coordinated with the scroll value specified in the SCROLLfield. This value can be specified as:

Cursor location determines the scroll amount.

PAGE Full page scroll such that the line or columnfollowing the last line or column of the current pageis the first line or column of the next page.

DATA Full page scroll such that the last line or column onthe current screen is the first line or column on thenext screen.

HALF Half page scroll.

n Specific number of rows or columns to scroll.

MAX Depending on direction, either the first full screen ofdata or the last full screen of data is displayed.

Scrolling

Page 34: Move for DB2 User Guide

1. Introduction

20 Move for DB2

Page 35: Move for DB2 User Guide

User Manual 21

2. Session Overview

The following overview highlights the key facilities provided withMOVE by presenting a brief sample session. For this sample session,assume you want to create a test database by copying data from oneset of related tables to another. This task is comprised of two basicsteps:

• Specify the Source Data

• Specify the Destination

This sample session begins with the Relational Tools Main Menu anddemonstrates how to perform these two steps with MOVE.

Page 36: Move for DB2 User Guide

2. Session Overview

22 Move for DB2

2.1 Main Menu

When MOVE is invoked, the Main Menu is displayed. The figurebelow displays the Main Menu that is shown when all PrincetonSoftech Relational Tools are installed. (The figure in Appendix A.Main Menu Variations shows the Main Menu when only MOVE isinstalled.)

------------------ Princeton Softech's Relational Tools ------------------OPTION ===>

0 OPTIONS - Site and User Options SQLID ===> 1 BROWSE TABLE - Browse a DB2 Table SUBSYS ===> TDB2 2 EDIT TABLE - Edit a DB2 Table LOCATION ===> 3 BROWSE USING AD - Browse DB2 Tables Using Access Definition 4 EDIT USING AD - Edit DB2 Tables Using Access Definition 5 ADS - Create or Modify Access Definitions 6 DEFINITIONS - Maintain Primary Keys, Relationships, Maps and ADs 7 MIGRATION - Data Migration - Extract, Insert, Delete, ... 8 COMPARE - Compare Two Sets of Data 9 ARCHIVE - Archive and Restore Data

T TUTORIAL - Information About Princeton Softech's Tools C CHANGES - Changes from Prior Release(s) X EXIT - Terminate Product Use

Figure 1. Main Menu

To select the desired option, type the one-character identifiercorresponding to the function you want to invoke.

0 OPTIONS To specify site and user options. MOVE Administrator privileges are

required to define site options. User options include user’s sessionoptions, editor options and JOB card and job related information.

1 BROWSE TABLE

To browse data from a DB2 table. This facility is documented in theAccess for DB2 User Manual.

2 EDIT TABLE

To edit data from a DB2 table. This facility is documented in theAccess for DB2 User Manual.

3 BROWSE USING AD

To browse data from DB2 using an Access Definition. This facility isdocumented in the Access for DB2 User Manual.

Panel Options

Page 37: Move for DB2 User Guide

2.1 Main Menu

User Manual 23

4 EDIT USING AD

To edit data from DB2 using an Access Definition. This facility isdocumented in the Access for DB2 User Manual.

5 ADS

To create and maintain Access Definitions. These definitions can beused to specify the data to be extracted.

6 DEFINITIONS

To define and maintain primary keys and relationships that are usedwhen the information is not available in the DB2 Catalog, to defineTable Maps and Column Maps used during the INSERT, DB2 LOADand CONVERT processes, to define Access Definitions and to invokethe Export/Import Object Definitions Utility.

7 MIGRATION

To perform the MOVE processes of Extract, Insert, DB2 Load,Delete, Create, Convert, Retry, Restart and Browse.

8 COMPARE

To perform the COMPARE process and browse the results. Thisfacility is documented in the Compare for DB2 User Manual.

9 ARCHIVE

To perform the ARCHIVE processes of Archive and Restore. Thisfacility is documented in the Archive for DB2 User Manual.

T TUTORIAL

To display the Relational Tools online Tutorial.

C CHANGES

To display the changes to Relational Tools for the release.

X EXIT

To terminate Relational Tools.

Page 38: Move for DB2 User Guide

2. Session Overview

24 Move for DB2

The values in the three input fields are profiled. These fields are:

SQLID The DB2 SQLID used to connect to DB2. On initialentry to MOVE this field is blank since you have notconnected to DB2. You can enter a value andMOVE will attempt to use that value whenconnecting to DB2. The DB2 SQLID is displayed inthis field when this panel is redisplayed. You canthen change the displayed value and MOVE willattempt to reconnect using the value you entered.The default is the current user's TSO USERID.During the session, you can change the SQLID onany of the menus.

SUBSYS The DB2 subsystem name. This field is required. InFigure 1. Main Menu, TDB2 is specified. A useroption is available to display this value on all of theRelational Tools panels; however, the value forSUBSYS can be modified only on the menus.

LOCATION The remote access location. This field is displayedonly when remote access is available. See sitemanagement for the available locations.

Panel fields

Page 39: Move for DB2 User Guide

2.2 Specify the Source Data

User Manual 25

2.2 Specify the Source Data

With MOVE, you use an Access Definition to specify the source datato be extracted. To do this, you can:

• Select Option 5 ADS from the Main Menu to define an AccessDefinition before selecting Option 7 MIGRATION.

• Select Option 7 MIGRATION from the Main Menu to use anexisting Access Definition or to define a new Access Definitionthat can be saved. You can also define a temporary AccessDefinition for the current Extract Process only.

A full discussion about how to define an Access Definition is providedin Section 3. Specify Access Definitions.

In this sample session, Option 7 MIGRATION is selected. The DataMigration menu is displayed.

----------------------------- Data Migration ------------------------------OPTION ===> SQLID ===> PSTDEMO SUBSYS ===> TDB21 EXTRACT - Extract Data from DB2 (Source) LOCATION ===>2 INSERT - Insert Data into DB2 (Destination)3 DB2 LOAD - Create DB2 Load Files and Load4 DELETE - Delete Data from DB2 Tables5 CREATE - Create Tables and Related Object Definitions6 CONVERT - Convert an Extract File Using Table and Column Maps

R RETRY/RESTART - Retry/Restart an Insert or Delete ProcessB BROWSE - Browse Content of Extract or Control File

Figure 2. Data Migration Menu

Select MigrationOption

Page 40: Move for DB2 User Guide

2. Session Overview

26 Move for DB2

Select Option 1 EXTRACT. This is the option used to define thesource data and actually extract it from the database. The EXTRACTProcess menu is displayed.

------------------------- EXTRACT Process ------------------------------OPTION ===>

1 TABLES - Specify Set of Tables and Selection Criteria 2 PATHS - Specify Traversal Paths via Relationship List 3 OBJECTS - Specify Object Definitions to Extract 4 PERFORM - Specify EXTRACT Parameters and Perform EXTRACT

Type of Access Definition to Use for EXTRACT ===> T (P-Perm, T-Temp)

If Permanent, Specify New or Existing Access Definition Name GROUP ===> USER ===> NAME ===>

Use '_' for DB2 LIKE Character ===> N (Y-Yes, N-No)

Figure 3. Extract Process Menu

For this sample session, the Access Definition is temporary. T isspecified in response to the Type of Access Definition to Use forExtract prompt. An existing Access Definition is not used and a newAccess Definition is not created. If you specify P, you must providethe name of a new or existing Access Definition.

Specify Tables

Regardless of whether the specifications are permanent or temporary,you define the source by first specifying the names of the tables fromwhich data is to be extracted. Select Option 1 TABLES on theEXTRACT Process menu.

The Select Tables/Views for AD panel is displayed. You can directlytype the names of the tables as shown in Figure 4. The name of asingle table, CUSTOMERS, has been entered. CUSTOMERS is alsospecified as the Start Table or the table from which data is to beextracted first.

In addition to manually specifying the names of the tables, you can usethe GET TABLES RELATED command. This command directsMOVE to insert the names of the tables related to a specific table onthe list. You indicate the table by specifying the name with thecommand or by positioning the cursor to the line containing the tablename. If only one table is listed, as shown in the figure, it is assumedto be the indicated table and need not be specified for the GETTABLES RELATED command.

GET TABLESRELATEDCommand

Page 41: Move for DB2 User Guide

2.2 Specify the Source Data

User Manual 27

For example, in the following figure the GET TABLES RELATEDcommand is entered. The ALL operand is used to insert all tablesdirectly related to the CUSTOMERS table and all tables related tothose inserted tables and so on.

-- Select Tables/Views for AD: TEMPORARY AD ----------------------------------Command ===> GET TABLES RELATED ALL Scroll ===> CSR

Primary : COL, SEL, SQL, REL, POINT, GROUP, GET TABLES RELATED, INDENT Line : COL, SEL, SQL, ALL, GR(A), GP(A), GC(A), EXP

Default Creator ID ===> PSTDEMO Table 1 of 1 <<MOREStart Table ===> CUSTOMERSStart Table Options : None Ref --Extract Parms--Cmd Status (CreatorID.)Table/View Name Tbl EveryNth RowLimit Type--- -------- -------------------------------- --- -------- -------- ----------*** ************************************ TOP **********************************___ CUSTOMERS ____ ________ TABLE*** *********************************** BOTTOM ********************************

Figure 4. Using the GET TABLES RELATED Command

MOVE checks the DB2 Catalog and the PST Directory for tablesrelated to CUSTOMERS and adds those tables to the list. MOVE thenchecks for tables related to these inserted tables and adds them also.This chain-like process continues until the complete set of relatedtables is included. (In this example, SALES and ORDERS are relatedto CUSTOMERS. ORDERS is related to DETAILS which is relatedto ITEMS.)

-- Select Tables/Views for AD: TEMPORARY AD ------------------------------------Command ===> Scroll ===> CSR

Primary : COL, SEL, SQL, REL, POINT, GROUP, GET TABLES RELATED, INDENT Line : COL, SEL, SQL, ALL, GR(A), GP(A), GC(A), EXP

Default Creator ID ===> PSTDEMO Table 1 of 5 <<MOREStart Table ===> CUSTOMERSStart Table Options : None Ref --Extract Parms--Cmd Status (CreatorID.)Table/View Name Tbl EveryNth RowLimit Type--- -------- --------------------------------- --- -------- -------- ----------*** ********************************* TOP *************************************___ CUSTOMERS ____ ________ TABLE___ SALES N ____ ________ TABLE___ ORDERS N ____ ________ TABLE___ DETAILS N ____ ________ TABLE___ ITEMS N ____ ________ TABLE*** ********************************* BOTTOM **********************************

Figure 5. Related Tables Included

All Related Tables

Page 42: Move for DB2 User Guide

2. Session Overview

28 Move for DB2

Other commands are provided to display selection lists of all tables,LIST TABLES, or selection lists of all tables related to a specifictable, LIST TABLES RELATED. Then, rather than have MOVEautomatically add the tables, you can select individual tables from thelist as desired.

You can scroll and edit the list of table names on the SelectTables/Views for AD panel using standard ISPF-facilities. Forexample, after using GET TABLES RELATED to add the relatedtables, you can use the Delete line command to delete a table from thelist. For this sample, assume the SALES table is deleted.

The REF command is also available on this panel. This commandswitches the setting for the Reference Table field. This setting specifieswhether all the tables except the Start Table are reference tables. Thecommand is specified as REF Y to set the Reference Table field for allcolumns to Y indicating that all tables are reference tables or REF N toset the Reference table fields for all columns to N specifying that alltables are not reference tables.

Specify Criteria

After you have specified the names of the tables, you can specify theselection criteria in a variety of ways.

• You can specify random selection of rows and a row limit for eachtable by entering a value in the fields provided under the ExtractParms heading on the Select Tables/Views for AD panel.

• You can use the commands specific to Access Definitions as listedon the panel. These commands enable you to display columninformation and to define criteria for row selection. Details aboutthese commands are provided in Section 3. Specify AccessDefinitions and the Relational Tools Command ReferenceManual. In this demonstration only the POINT and RELcommands are used.

In this sample, a subset of customers and all of their orders isextracted. Using the CUSTOMERS table as the starting table, youcan select specific rows to be extracted from that table.

Since the technology used to select the rows is referred to as Point-and-Shoot, the POINT command is entered on the Select Tables/Views forAD panel. The primary key values for all of the rows selected during aPoint-and-Shoot session are saved in a file referred to as the Point-and-Shoot or Row List file.

Other Commands

POINT Command

Page 43: Move for DB2 User Guide

2.2 Specify the Source Data

User Manual 29

When you enter the POINT command, MOVE prompts for the nameof a data set containing previously selected rows. If one exists, specifythe name and press ENTER. The rows from the Start Table aredisplayed and any previously selected rows are indicated. If a data setdoes not exist or you want to stop using an existing data set, leave thefield blank and press ENTER.

MOVE presents the rows in the Start Table in a browse-only display.Use the Select Related line commands, SR and SSR, or the SELECTRELATED primary command to select the individual customer rowsyou want to extract.

The title of the display indicates Point-and-Shoot row selection. InFigure 6. Point-and-Shoot Display, five rows have been selected asnoted by the S in the F or status flag field and the message in the upperright-hand corner of the panel. SR is specified in the line commandfield for two customers, 07260 Five Star Videos and 07101 MovieMania. The primary key values for these rows are to be included withthe previously selected ones.

---------------- Relational Tools: Point-and-Shoot -------- 5 Rows SelectedCommand ===> Scroll ===> CSR

Cmd F == Table: PSTDEMO.CUSTOMERS(T1) ==================== 1 OF 27 ======== CUST_ID CUSTNAME ADDRESS CITY STATE ------- ---------------------- =================== ------------ -----*** ********************************** TOP ********************************___ S 07006 Excalibur Video 35 Seminary Ave Harvard MAsr_ 07260 Five Star Videos 123 Howe Lane Boston MA___ S 07235 Jack's Grafton Plaza Grafton MA___ S 07440 Monarch Movies 280 Chestnut St Springfield MA___ S 07201 Movie Buff 400 Merrimac Concord MAsr_ 07101 Movie Mania 572 Front St Auburn MA___ 07126 Movie Rentals 101 Munson St Greenfield MA___ S 07118 Movie Store 752 State Road Menemsha MA___ 07203 Movies-R-Us 1772 Bridge St Bourne MA___ 07191 Popcorn 15 Crystal Park Lenox MA___ 07156 Prime Tyme 982 Upper State St Marion MA___ 07140 ProMusic 84 Second Ave Chicopee MA___ 07160 Reely Great Videos 590 Frontage Rd Amherst MA___ 07053 Replay Video 9032 Dickerson St Amherst MA___ 07150 Rick's Flicks 823 Chestnut St Springfield MA___ 07140 Showcase 1150 Indiana Terr Beverly MA___ 07141 Showcase II 57 Rock Hollow Salem MA

Figure 6. Point-and-Shoot Display

When individual rows are selected from the Start Table using Point-and-Shoot, the Extract Process begins with those rows. In thisexample, the extract begins with the selected customers. The relatedrows from the other tables are extracted based on the relationshipsdefined between the CUSTOMERS table and the other tables. Fordetails, see Section 3.4.4 SQL WHERE Clause Specification.

Use END to terminate the Point-and-Shoot session. MOVE promptsfor the name of a data set in which to store the selected rows and then

Point-and-ShootDisplay

SelectionComplete

Page 44: Move for DB2 User Guide

2. Session Overview

30 Move for DB2

returns to the Select Tables/Views for AD panel. If a data set is notsupplied, the list is temporary. That means it is used only for thecurrent Extract Process and discarded when the process completes.

You can select which relationships between the specified tables are tobe traversed to extract the data. This is especially useful whenmultiple relationships are defined between tables. Use the RELcommand on the Select Tables/Views for AD panel to display theSpecify Relationship Usage panel. (You can also use END toredisplay the EXTRACT Process menu, Figure 3, and select Option 2PATHS to display the following panel.)

------------------------ Specify Relationship Usage --------------------------Command ===> Scroll ===> CSR

For Each Relationship Indicate: Rel 1 of 3

Q1: If a Child Row is Included, Include its Parent Row to Satisfy the RI Rule?Q2: If a Parent Row is Included to Satisfy any RI Rule, Include All Child Rows?

Q Q Child --Relation--Cmd Status 1 2 Limit Parent Table Child Table Name Type--- -------- --- --- -------------------- --------------------- ------ ----- *********************************** TOP *********************************___ NEW Y N CUSTOMERS ORDERS RCO DB2___ NEW Y N ORDERS DETAILS ROD DB2___ NEW Y N ITEMS DETAILS RID DB2 ********************************** BOTTOM ********************************

Figure 7. Selecting Relationships for MOVE functions

All of the relationships that have been defined between all of the tableson the Select Tables/Views for AD panel are displayed. The first timethis panel is displayed, all of the relationships have a NEW status.The default handling for these new relationships is specified as anAccess Definition option. You can specify whether or not all NEWrelationships are to be automatically selected. You can explicitlyselect, S, and unselect, U, any relationship. On this panel, all of therelationships are new and are to be selected as defined.

Questions Q1 and Q2 provide control for specifying whether parentrows are extracted to satisfy RI rules and, further, whether the childrenof those extracted parent rows should also be extracted. For details onselecting relationships and specifying values for questions Q1 and Q2,see Section 3.7 Selecting Relationships.

Relationships

Page 45: Move for DB2 User Guide

2.2 Specify the Source Data

User Manual 31

You can request an analysis of the relationship traversal path using theSHOW STEPS command from the Specify Relationship Usage panel.MOVE will describe the traversal path based on the specified sourcetables and selected relationships and display text documenting theseries of steps that are to be performed.

--------------------------- EXTRACT Process Steps -------------------------Command ===> Scroll ===> PAGE ROW 0 OF 16******************************** TOP OF DATA ******************************

Step 1: Extract Rows from Start Table PSTDEMO.CUSTOMERS. Row List is used and Determines the Rows Selected.

Step 2: Extract Rows from PSTDEMO.ORDERS which are Children of Rows Previously Extracted from PSTDEMO.CUSTOMERS in Step 1 using Relationship RCO.

Step 3: Extract Rows from PSTDEMO.DETAILS which are Children of Rows Previously Extracted from PSTDEMO.ORDERS in Step 2 using Relationship ROD.

Step 4: Extract Rows from PSTDEMO.ITEMS which are Parents of Rows Previously Extracted from PSTDEMO.DETAILS in Step 3 to satisfy an RI rule using Relationship RID.

******************************* BOTTOM OF DATA ****************************

Figure 8. Extract Process Steps

This is a powerful way to check your relationship specifications beforeactually extracting data. You can make changes as needed to obtainthe required set of relationally intact data.

After viewing the SHOW STEPS information, use END to return theSpecify Relationship Usage panel. Use END again to return to theprevious panel.

Specify Object Definitions

In addition to the data, you can request that one or more types ofassociated object definitions are extracted from the source and storedin the Extract File. The available object types include: primary keysand relationships, indexes, views, aliases, synonyms, and column fieldprocedure names. By default, the table definitions are alwaysextracted so that MOVE can automatically create any unknown tablesat the destination.

SHOW STEPSCommand

Page 46: Move for DB2 User Guide

2. Session Overview

32 Move for DB2

Use Option 3 on the EXTRACT Process menu to specify whichobject definitions are to be extracted. The following panel is displayed:

------------------ Specify Object Definitions to EXTRACT -------------Command ===>

Use S Line Command to Select ALL Associated Objects of Specified TypeUse U Line Command to Unselect Associated Objects of Specified Type

Cmd Status Object Type--- --------- ----------------------------- _ SELECT Primary Keys and Relationships _ SELECT Indexes _ UNSELECT Views _ UNSELECT Aliases _ UNSELECT Synonyms _ UNSELECT Column Field Procedure Names

Note: Catalog Queries to Extract Object Definitions are Expensive Selected Objects Extracted for Tables ONLY Will Always Extract Index Required by DB2 Primary Key

Figure 9. Specify Object Definitions to EXTRACT

You select and unselect object definition types using the S, select, or U,unselect, line commands. On initial display, Primary Keys andRelationships and Indexes are designated as SELECT.

Use END to return to the EXTRACT Process menu.

The object definitions you select on the Select Object Definitions toEXTRACT panel are extracted for every table included in the ExtractProcess when you request that object definitions are to be extracted onthe Specify EXTRACT Parameters and Execute panel (discussed inthe following section).

Page 47: Move for DB2 User Guide

2.2 Specify the Source Data

User Manual 33

Perform the Extract

To perform the Extract Process, select Option 4 PERFORM from theEXTRACT Process Menu. The Specify EXTRACT Parametersand Execute panel is displayed. There are prompts for severalparameters on this panel.

--------------------- Specify EXTRACT Parameters and Execute --------------Command ===>

Extract File DSN ===> 'PSTDEMO.SAMPLE.EXTRACT'Extract ===> D (D-Data, O-Object Definitions, B-Both)If Extracting Data: Limit Number of Extract Rows ===> (1-10000, Blank-Site Limit) Extract Data using ===> (D-DB2, B-BMC’s Unload Plus)

Perform Convert with Extract ===> (Y-Yes, N-No)

Run Process in Batch or Online ===> O (B-Batch, O-Online) If Batch, Review or Save JCL ===> (N-No, R-Review, S-Save)

Figure 10. Extract Process Parameters

Since the extracted data is stored in an Extract File, specify the nameof the sequential file that is to contain the extracted data at the promptfor Extract File DSN. If the file does not exist, MOVE prompts forallocation information and creates the file.

You can extract the data, the object definitions or both. Use the secondprompt, Extract, to specify your choice. For this demonstration, onlydata is extracted.

If BMC's UNLOAD PLUS is available, additional prompts areprovided to specify whether it is used to perform the extract.

Perform Convert with Extract allows you to direct MOVE to convertthe data before writing it to the Extract File. This useful when youneed to mask sensitive data or alter values to be extracted from thedatabase.

The other prompts enable you to limit the number of rows of data thatare extracted, to execute in batch or online, and, if in batch, to reviewthe JCL.

When you request review of the JCL for batch execution, the JCL isdisplayed in the ISPF editor. You can save this JCL using the ISPFfacilities. Use END to return to your MOVE session. (Whether ENDalso automatically submits the job is determined by a user optiondiscussed in Section 6. Specify Options. The saved JCL can beedited and executed from ISPF without entering a MOVE session.

Page 48: Move for DB2 User Guide

2. Session Overview

34 Move for DB2

Before the process is executed, the Access Definition is evaluated.Several conditions generate warning messages. These messages aredisplayed. For example, in the following figure a relationship will notbe traversed.

------------------- Specify EXTRACT Parameters and Execute ---------------Command ===>

Extract File DSN ===> +---------------------- EXTRACT Errors & Warnings -----------------+ | | | EXTRACT Process Can Proceed Despite the Following Warnings: | | 1 Relationship(s) will not be Traversed (See SHOW STEPS) | | | | Press ENTER Key to Proceed Despite Warnings | | Enter END Command to Return to EXTRACT Menu to Correct Problem | +------------------------------------------------------------------+

Figure 11. Extract Process Warnings

As noted in the message, you can correct the problem and then executethe process, or execute the process despite the problem.

When the process is executed online, the execution status is displayed.The status information includes the name of the table being processedand the number of processed rows. This information is refreshedfrequently.

HelpfulInformation

Page 49: Move for DB2 User Guide

2.2 Specify the Source Data

User Manual 35

MOVE generates an EXTRACT Process Report. For batch execution,the report is available in a data set or SYSOUT, as specified on theJOB Card and Print Options panel. For online, execution, the reportis automatically displayed when the process terminates. The followingis a sample of this report.

--------------------------- EXTRACT Process Report ------------------------Command ===> Scroll ===> PAGE ROW 0 OF 21******************************** TOP OF DATA ******************************

EXTRACT Process Report

Extract File : PSTDEMO.SAMPLE.EXTRACT Access Definition : TEMPORARY ACCESS DEFINITION Created by : COHEND Time Started : 1999-03-07 11.01.31 Time Finished : 1999-03-07 11.01.39

Total Number of Extract Tables : 4 Total Number of Extracted Rows : 3972 Total Number of First Pass Start Table Rows: 107

Extracted Object Types Number ---------------------- ------ 1 Table-List Tables 4

Extracted Extract Tables Rows ------------------------ ---------- 1 PSTDEMO.CUSTOMERS 132 2 PSTDEMO.ORDERS 792 3 PSTDEMO.DETAILS 2176 4 PSTDEMO.ITEMS 872

******************************* BOTTOM OF DATA ****************************

Figure 12. Extract Process Report Format

The contents of the online display of the EXTRACT Process Reportcan be directed to a data set or SYSOUT. Use the OUTPUTcommand to specify the destination of the report. Otherwise, the reportis not retained.

When the Extract Process is complete, use END to return to theEXTRACT Process menu and END again to return to the DataMigration menu.

Extract ProcessReport

Page 50: Move for DB2 User Guide

2. Session Overview

36 Move for DB2

2.3 Specify the Destination

Once you have used MOVE to extract the source data and generate theExtract File, you can specify the destination using the Insert Option onthe Data Migration menu.

When you select Option 2 Insert on the menu, the INSERT Processmenu is displayed.

-------------------------------INSERT Process -----------------------------OPTION ===>

1 TABLE MAP - Specify Table Map and Column Maps 2 PERFORM INSERT - Specify INSERT Parameters and Perform INSERT 3 PERFORM UPDATE - Specify UPDATE Parameters and Perform UPDATE

Specify Data Set Names for Extract File and Control File: Extract File DSN ===> 'PSTDEMO.SAMPLE.EXTRACT' Control File DSN ===> 'PSTDEMO.INSERT.CONTROL'

Figure 13. Insert Process Menu

The name of the last Extract File you created is providedautomatically. This file contains the source data that is to be insertedat the destination.

The Extract File is used solely to contain the extracted source data. Itis not affected directly by the Insert Process. Therefore, the ExtractFile can be used by multiple users simultaneously and repeatedly.

The name of a Control File is also required.

There may be instances, during an Insert Process, when a row cannotbe inserted. For example, assume RI rules enforce that a row cannotbe inserted because a related row in the parent table does not exist.MOVE marks this row as discarded when the insert is attempted.

The Control File is used to keep track of the discarded rows. When theprocess is complete you can browse the entire Extract File or just therows that were discarded to determine why they could not beprocessed.

Extending the above example, assume that by displaying the discardedrows you determine that some rows were not inserted because a parentrow did not exist. You can create the needed parent row to remedy theproblem. Then, you can “RETRY” the Insert Process for only thoserows that were discarded without duplicating any previous successfulprocessing.

Extract File

Control File

Page 51: Move for DB2 User Guide

2.3 Specify the Destination

User Manual 37

Since the Extract File is designed to contain the source data, it can bereused as needed to insert the same data into different destination tablesor to refresh a destination after testing an application. In contrast, theControl File is designed to keep track of a specific processthedestination and the discarded rows. Using the same Extract File andunique Control Files, multiple users can work with the same data andstill perform their individual Insert Process requests. For example,programmers can test their applications against their own copy of thedata. If necessary, they can refresh that test data over and over usingthe same source data in the Extract File.

The Insert Process can be performed in one of two ways:

1. You can specify insert only. That means only new rows are to beinserted. Thus, a source row is discarded when the primary keyvalue of the source row matches the value in an existingdestination row.

2. You can specify update. That means new rows are inserted andexisting destination rows are updated. Thus, when the primary keyvalue of the source row matches the value in an existingdestination row, the destination row is updated.

The Insert Process menu, as shown in Figure 13. Insert ProcessMenu, provides three options:

TABLE MAP

PERFORM INSERT

PERFORM UPDATE

MOVE can insert the data from the Extract File into destination tableswith the same names or different names. When the destination tablesdo not exist, MOVE can create the destination tables to match thesource exactly and then insert the data. When MOVE determines thatdestination tables must be created, you are prompted to specifywhether primary keys, relationships, indexes, and so forth as containedin the Extract File are also created. (If the definitions for these objectshave not been extracted, only the tables are listed.) This is useful whenmoving source data from one subsystem to another and the destinationtables have not been defined. You can let MOVE do it for youautomatically.

By default, MOVE assumes the base destination table names are thesame as the source table names. However, at the very least, you mustspecify a default Creator ID for the destination using the TABLE MAPoption.

Separate Sourcefrom Destination

INSERT versusUPDATE

Insert ProcessOptions

TABLE MAP

Page 52: Move for DB2 User Guide

2. Session Overview

38 Move for DB2

When you select Option 1 TABLE MAP from the INSERT Processmenu, the following panel is displayed.

---------------------------- INSERT Process Table Map ----------------------Command ===> Scroll ===> CSR

Available Commands: APPLY, SAVE, LIST, MAP, POPULATE, END when CompleteDestination May be any DB2 Tables or Views Column Src CID: PSTDEMO Dest CID ===> Map ID ===>

Extract Tables Destination Table Name Type Column Map or "LOCAL"------------------ ---------------------------- ------- -------------------************************************ TOP **********************************CUSTOMERS CUSTOMERS UNKNOWNORDERS ORDERS UNKNOWNDETAILS DETAILS UNKNOWNITEMS ITEMS UNKNOWN*********************************** BOTTOM ********************************

Figure 14. Insert Process Table Map - Initial Display

MOVE automatically displays the Source Creator ID in the field SrcCID, and the names of all of the tables in the Extract File in the fieldExtract Tables. MOVE assumes these same values for the destinationtables in the field Destination Table Name. You must supply theDestination Creator ID in the field Dest CID. (It can be the same asthe Source Creator ID to re-insert or update the source data, althoughthis is not typical.)

The Type is supplied by MOVE and specifies whether the destinationis a table, a view or unknown. On initial display, the destination isUNKNOWN. This is revised after you specify the Dest CID.

You can overtype the Dest CID and the Destination Table Names tospecify the names you want. MOVE automatically adjusts the Type.

Table Map Panel

Page 53: Move for DB2 User Guide

2.3 Specify the Destination

User Manual 39

For example, assume you have a test database that has the samestructure as the production system. The Creator ID is used todistinguish these two sets of tables. To insert the source data extractedfrom the production system into the same-name test tables, specify theDest CID and do not change the Destination Table Names. MOVEautomatically identifies the Type for each destination using the DestCID. In this example, the Dest CID is specified as PSTDEMO2 andall of the destinations are tables.

---------------------------- INSERT Process Table Map ----------------------Command ===> Scroll ===> CSR

Available Commands: APPLY, SAVE, LIST, MAP, POPULATE, END when CompleteDestination May be any DB2 Tables or Views Column Src CID: PSTDEMO Dest CID ===> PSTDEMO2 Map ID ===>

Extract Tables Destination Table Name Type Column Map or "LOCAL"----------------- ---------------------------- ------- --------------------************************************ TOP **********************************CUSTOMERS CUSTOMERS TABLEORDERS ORDERS TABLEDETAILS DETAILS TABLEITEMS ITEMS TABLE*********************************** BOTTOM ********************************

Figure 15. Insert Process Table Map - Modify Creator ID

You can also map each table column-by-column using Column Maps.Column Maps provide enormous flexibility. You can map columnswith different names or use a subset of columns. You can also insertliteral data, use an exit routine to modify the data before inserting it,insert the same source data into more than one column, insert thedefined DB2 default value, specify an expression, or insert NULL ifvalid for the column. You can age the date in DATE, TIMESTAMP,character and numeric columns.

If a suitable Table Map has been defined and stored in the PSTDirectory, you can use the APPLY command to insert thespecifications for that Table Map into the current one. You candetermine which specifications are includedonly the Dest CID,Destination table names, any Column Maps, or all of these.

For details on Table Maps, see Section 4.4 Table Maps. For detailson Column Maps, see Section 4.3 Column Maps.

Use END to return to the INSERT Process menu.

Specifying DestCID

Column Maps

Apply ExistingTable Map

Page 54: Move for DB2 User Guide

2. Session Overview

40 Move for DB2

In this sample session, Option 2 PERFORM INSERT is selected fromthe INSERT Process menu. The following panel is displayed.

----------------------- Specify INSERT Parameters and Execute -----------------Command ===>

Names for Extract File and Control File: Extract File DSN : PSTDEMO.SAMPLE.EXTRACT Control File DSN : PSTDEMO.INSERT.CONTROL

Process Options: Delete All Rows in Target Tables ===> N (Y-Yes, N-No) If YES, Commit Frequency ===> T (T-After Each Table, E-At End)

Age Date Values ===> N (Y-Yes, N-No) Lock Tables During Process ===> N (Y-Yes, N-No) Commit Every Nth Row ===> (1-1000, Blank-Site Limit) Limit Number of Discarded Rows ===> (1-999999, Blank-No Limit) Run Process in Batch or Online ===> O (B-Batch, O-Online) If Batch, Review or Save JCL ===> (N-No, R-Review, S-Save)

Figure 16. Specify Insert Process Parameters

The data set names of the Extract File and the Control File are supplied.

Several parameters allow you to control the Insert Process. Forexample, you can specify whether the data in the destination tables isdeleted prior to performing the insert (perhaps to fully refresh testdata), and whether tables are locked during the process and thefrequency of committing the data.

You can also request that the Insert Process be terminated based on thenumber of discarded rows. For instance, if more than 50 rows arediscarded there may be some problem with RI rules such that rowscannot be inserted because necessary parents do not exist. Rather thancontinue the process and accumulate a large number of discarded rows,the process is terminated. You can display the discarded rows,determine the problem, correct it, and retry the Insert Process.

You can execute the process online or in batch. When online,execution status is displayed in a pop-up window and, when theprocess is completed, an INSERT Process Report is automaticallydisplayed. When executed in batch, the INSERT Process Report isoutput to SYSOUT or another user-designated file.

After typing your specifications for the Insert Process, press ENTERto direct MOVE to perform the process.

The remainder of this manual provides details on all of the MOVEpanels, facilities, and accompanying commands. It emphasizes thecore capability provided by MOVE, the ability to copy relationallyintact sets of DB2 data and object definitions.

Perform theProcess

Limit DiscardedInserts

Online versusBatch

More Details

Page 55: Move for DB2 User Guide

User Manual 41

3. Specify Access Definitions

An Access Definition describes the data to be extracted from thesource database. The components of an Access Definition are:

• A list of tables from which the data is to be extracted.

• Selection criteria, including row limits, random selection, andPoint-and-Shoot.

• The list of relationships that are to be traversed for the tablesspecified on the list.

The functions used to create a new Access Definition are the same asthose used to modify an existing Access Definition. You can initiate thecreation of an Access Definition by specifying a unique name to beassigned to the new Access Definition. You can use an existing AccessDefinition as a model and save it under a new name.

A series of panels prompt you through the process of creating andmodifying an Access Definition. You can create or modify an AccessDefinition explicitly by selecting the ADS option or implicitly byselecting the MIGRATION option on the Main Menu. For details aboutthe MIGRATION option, see Section 5. Data Migration.

When creating an Access Definition, it is important to consider thepurpose of the Access Definition and who is to use it. An AccessDefinition can be used to edit the data using Access for DB2, extractthe data using MOVE, select data to be compared usingCompare for DB2, and archive data using Archive for DB2.However, if Access Definitions are shared between products careshould be taken to avoid inadvertent changes. For example, anAccess Definition can be modified during an edit or browse sessionand an unsuspecting user could then extract an unexpected set of data.In addition, an Access Definition used by MOVE does not allowduplicate table entries, either directly or indirectly through views,synonyms or aliases. Access for DB2 does allow these duplicateentries.

Consider Purpose

Page 56: Move for DB2 User Guide

3. Specify Access Definitions

42 Move for DB2

3.1 Choose an Access Definition Use Option 5 ADS from the Main Menu or suboption 5 ADS fromOption 6 DEFINITIONS on the Main Menu to create or modify anAccess Definition. (For information about Main Menu Option 6,DEFINITIONS, see Section 4. Definitions.)

When you select the ADS option, the Choose an Access Definitionpanel is displayed. Specify the name of the desired Access Definition.If you do not know the name, leave one or more of the fields blank oruse DB2 LIKE syntax in one or more of the fields. A selection listbased on the specifications on this panel is displayed.

The fully qualified name of an Access Definition consists of three parts:

GroupUserName

The Choose an Access Definition panel prompts for the three partsof the Access Definition name.

---------------------- Choose an Access Definition -------------------Command ===> SQLID ===> PSTDEMOAccess Definition: SUBSYS ===> TDB2 Group ===> PSTDEMO LOCATION ===> User ===> USR Name ===>

Use '_' for DB2 LIKE character ===> N (Y-Yes, N-No)

Figure 17. Choose an Access Definition

Several prompts are provided on this screen.

SQLID Current SQLID. If you modify this value,MOVE will attempt to reconnect to DB2using the modified SQLID. Since you can beconnected with only one SQLID, theconnection with the original SQLID is notmaintained. However, if MOVE cannotconnect with the specified SQLID, you willbe returned to the Main Menu and an errormessage will be displayed.

SUBSYS Current subsystem. If you modify this value,MOVE will attempt to connect to thatsubsystem. Since you can be connected toonly one subsystem at any time, the

Panel Fields

Page 57: Move for DB2 User Guide

3. Specify Access Definitions

User Manual 43

connection to the original subsystem is notmaintained. However, if MOVE cannotconnect to the specified subsystem, you willbe returned to the Main Menu and an errormessage will be displayed.

LOCATION Current location. This field is only displayedif remote access is available.

If you modify this value, MOVE will attemptto connect to the remote subsystem. Sinceyou can be connected to only one subsystemat any time, the connection to the originalsubsystem is not maintained. However, if theconnection fails, you will be returned to theMain Menu and an error message will bedisplayed.

Group 1 to 8-character group ID. The default is thepreviously entered value or, if GROUP hasnever been specified, the TSO ID of thecurrent user.

User 1 to 8-character user name. The default is thepreviously entered value or, if USER hasnever been specified, the DB2 SQLID of thecurrent user.

Name 1 to 12-character name of the AccessDefinition.

Use '_' for DB2 LIKEcharacter

Specifies whether or not the underscore, '_',is to be used as a DB2 LIKE character orused literally as part of the name.

For example, A_B could be assumed to be athree-character name containing thecharacters 'A_B' as entered or a three-character name that begins with 'A', ends with'B', and has any valid character in the middle.The default is No which means that '_' is nothandled as a DB2 LIKE character.

You may enter the fully qualified name of the Access Definition to becreated or modified. When a fully qualified name is entered, you areautomatically presented with the Select Tables/Views for AD panelto begin the process of creating or modifying an Access Definition.

Specify Name

Page 58: Move for DB2 User Guide

3. Specify Access Definitions

44 Move for DB2

If an explicitly named Access Definition does not currently exist, it isassumed that you are going to create that definition and the SelectTables/Views for AD panel is displayed for you to begin.

You may use DB2 LIKE syntax in any of the fields or leave one ormore fields blank to obtain a selection list. The content of theselection list is determined by the values specified for Group, User,and Name.

For example, a selection list of all Access Definitions, regardless of theGroup or User, can be obtained by leaving all three fields blank.

A selection list of all Access Definitions in any Group beginning with Aand for the User identified as JAA, can be obtained by specifying:

Group A%User JAAName blank or %

If a selection list is requested and there are no Access Definitions thatmatch the selection criteria, the message "NO MATCHES" isdisplayed.

The Group, User, and Name values specified on this panel are storedin your profile. The next time you display this panel, those values areautomatically provided in the fields. You may change any of thesevalues.

The END command or the CANCEL command can be used to returnto the previous menu. The OPTIONS command can be used todisplay the User Options panel to specify the user options.

3.1.1 Access Definition Selection List

A selection list of Access Definitions is displayed based on thespecifications in the Group, User, and Name fields on the Choose anAccess Definition panel. The names are presented in alphabeticalorder sorted by Group, User, and Name.

Obtain SelectionList

Subsequent Use

PrimaryCommands

Page 59: Move for DB2 User Guide

3. Specify Access Definitions

User Manual 45

Use the Select line command, S, to indicate the Access Definition to bemodified. In the following figure, the formatted list is displayed and thelast definition on the list, GRP.USER.ADSAMPLE, is selected.

------------------------- Select Access Definitions ------------------------- Command ===> Scroll ===> CSR

Line Cmds: S-Select, D-Delete, C-Copy, R-Rename, AT-Attr, I-Info 1 of 8

----- Access Definition ------ ------ Last Modified ------- Cmd Group User Name By Date --- -------- -------- ------------ -------- ------------------- ************************** TOP **************************************** ___ ADMIN JAA EMPL01 ALLEGRA 1998-09-21 16.36.59 ___ ADMIN JAA PAYROLL LISAC 1998-09-22 09.51.12 ___ DVLMT01 PSTDEMO SAMPLTST DCOHEN 1998-10-23 19.12.23 ___ DVLMT01 PSTDEMO TEST04 DCOHEN 1998-10-13 14.52.49 ___ DVLMT02 PSTDEMO TEST05 KEBLERD 1998-10-06 16.37.59 ___ DVLMT02 PSTDEMO TEST06 KEBLERD 1998-10-13 14.52.49 ___ GRP USER ADSAMP SENTNER 1998-11-02 13.23.14 s__ GRP USER ADSAMPLE ALLEGRA 1998-10-26 12.14.39 ************************ BOTTOM ***************************************

Figure 18. Select an Access Definition

The fields on this panel are:

Cmd Field for line commands. The available line commands are:

S Select an Access Definition for processing.

D Delete an Access Definition. After deleting, themessage “*DELETED” appears in the Date fieldunder the Last Modified heading.

C Copy an Access Definition. The copy commandallows you to create a new Access Definition bycopying an existing Access Definition. The CopyAccess Definition panel prompts for the name of theAccess Definition. After copying, the message“*COPIED” appears in the Date field under theheading Last Modified. (See page 48 for details.)

R Rename an Access Definition. The Renamecommand allows you to change the name of anexisting Access Definition. The Rename AccessDefinition panel prompts for the new name of theselected Access Definition. After renaming, themessage “*RENAMED” appears in the Date fieldunder the heading Last Modified. (See page 49 fordetails.)

AT Modify attributes of an Access Definition. TheObject Attributes panel allows you to edit thedescription and security status of the Access

Panel fields

Page 60: Move for DB2 User Guide

3. Specify Access Definitions

46 Move for DB2

Definition. (See page 49 for details.)

I Display information about an Access Definition.(See page 46 for details.)

Group The group name supplied when the Access Definitionwas created.

User The user name supplied when the Access Definitionwas created.

Name The base name of the Access Definition.

By TSO User ID of the user that created or last updatedthe Access Definition.

Date Date and time of last update displayed in the format ofa DB2 TIMESTAMP.

The description is a one- to 40-character description of the AccessDefinition. A user option controls whether or not the description ofeach Access Definition is displayed on this panel. (See Section 6.1User Options for information about the Selection List Formatoption.)

To display the attributes of an Access Definition, type I in the Cmdfield next to the name of the Access Definition. The following figureshows the Access Definition Attributes panel.

--------------------------Access Definition Attributes -------------------Command ===>

Group : GROUP User : USER Name : ADSAMPLE

Description : Sample Access Defintion Security Status : PUBLIC Last Modified By : PSTDEMO Modified On : 2000-01-12 11.06.42

Number of Tables : 6 Start Table : CUSTOMERS Default Creator ID : PSTDEMO

Access Definition Parameters Dynamically Add New Tables : Yes Modify Selection/Sort Criteria : Yes Begin Table Display with : Selection Criteria for Start Table Changes to AD During Edit : Permanent Use NEW Relationships : Yes

Figure 19. Access Definition Attributes

Access Defintion

Last Modified

Description

Access DefinitionAttributes

Page 61: Move for DB2 User Guide

3. Specify Access Definitions

User Manual 47

This is a read-only display. Relational Tools generates andmaintains all of the information on this panel according to yourspecifications for the Access Definition.

Page 62: Move for DB2 User Guide

3. Specify Access Definitions

48 Move for DB2

To modify the description and security status attributes of an AccessDefinition, type AT in the Cmd field next to the name of the AccessDefinition. The description and security status are specified on theObject Attributes panel.

+-----------------------Object Attributes-----------------------+ ¦ ¦ ¦ Object Name: GRP.USER.ADSAMPLE ¦ ¦ ¦ ¦ Modify the attributes below as needed. ¦ ¦ ¦ ¦ Description ===> Sample Access Defintion ¦ ¦ ¦ ¦ Security Status===> PUBLIC (PUBLIC, PRIVATE, READONLY) ¦ ¦ ¦ ¦ Use END command to accept any changes and return. ¦ ¦ Use CANCEL command to ignore any changes and return. ¦ ¦ ¦ +---------------------------------------------------------------

Figure 20. Object Attributes

The Object Attributes panel provides a 40-character area to displayand edit the description. An 8-character area is available to specifyone of the following security statuses:

PUBLIC Anyone can edit and use. PRIVATE Only owner can edit and use. READONLY Anyone can use, only owner can edit.

Based on installation options, site management can establish thatusers may not specify security status on this panel. In that case, theprompt for security status is replaced with “Not Active” on the panel.Any attempt to change the security status will result in an errormessage.

To copy an Access Definition, type C in the Cmd field next to thename of the Access Definition to be copied. The following figureshows the Copy Access Definition panel.

+-------Copy Access Definition-------+ ¦ ¦ ¦ Existing Name: GRP.USER.ADSAMPLE ¦ ¦ ¦ ¦ New Name: ¦ ¦ ¦ ¦ Group ===> GRP ¦ ¦ User ===> PSTDEMO ¦ ¦ Name ===> ADSAMPLE ¦ +------------------------------------+

Figure 21. Copy Access Definition

The Copy Access Definition panel displays the name of the sourceAccess Definition and prompts for a new three-part name for the copyoperation.

Object Attributes

Copy an AccessDefinition

Page 63: Move for DB2 User Guide

3. Specify Access Definitions

User Manual 49

To rename an Access Definition, type R in the Cmd field next to thename of the Access Definition to be renamed. The following figureshows the Rename Access Definition panel.

+------Rename Access Definition------+ ¦ ¦ ¦ Existing Name: GRP.USER.ADSAMPLE ¦ ¦ ¦ ¦ New Name: ¦ ¦ ¦ ¦ Group ===> GRP ¦ ¦ User ===> USER ¦ ¦ Name ===> ADSAMPLE ¦ +------------------------------------+

Figure 22. Rename Access Definition

The Rename Access Definition panel displays the current name ofthe Access Definition and prompts for a new three-part name.

After editing an Access Definition selected from this list either byprimary or line command, you are returned to the Select AccessDefinitions panel. If the Access Definition was selected from the listby a line command, the list is scrolled such that the last AccessDefinition accessed is shown on the first line of the display.

The following primary commands are available when the SelectAccess Definitions panel is displayed:

BOTTOM FIND RFIND SORT CANCEL LOCATE SELECT TOP DOWN OPTIONS SHOW UP END RESET

The S line command and the SELECT primary command can be usedto select an Access Definition. When a primary command is used, thenamed Access Definition does not have to be one that is included inthe selection list.

Use the END command or the CANCEL command to return to theChoose an Access Definition panel.

Rename anAccess Definition

Return Display

AvailableCommands

Terminate List

Page 64: Move for DB2 User Guide

3. Specify Access Definitions

50 Move for DB2

3.2 Components of an Access Definition

MOVE provides a series of panels to prompt for the components of anAccess Definition. The first panel, Select Tables/Views for AD isused to specify the list of tables from which data is to be extracted.The other panels are accessed from this panel.

The following diagram shows how the panels are arranged. The nameof each panel is specified in bold text. The command that displays thepanel from the Select Tables/Views for AD panel is also displayed ineach panel box.

The following sections discuss each of these panels and how they areused to specify the set of source data that is to be extracted.

These panels are available from the Extract Process menu as well asthrough the Main Menu option, ADS. For example, Option 1TABLES on the Extract Process menu displays the SelectTables/Views for AD panel. All of the panels described above canbe accessed from this panel. Option 2 PATHS on the ExtractProcess menu displays the Specify Relationship Usage panel. (TheExtract Process menu is available from the MIGRATION Option onthe Main Menu. See Section 5. Data Migration for moreinformation.)

Page 65: Move for DB2 User Guide

3. Specify Access Definitions

User Manual 51

3.3 Table/View Selection

The Select Tables/Views for AD panel is used to specify the namesof tables that are to be accessed for an Extract Process. This panel isdisplayed when an Access Definition has been selected on the SelectAccess Definitions panel or explicitly named on the Choose anAccess Definition panel. This panel is also displayed when theTABLES option is selected from the EXTRACT Process submenuwhen option 7 MIGRATION is selected from the Main Menu. (TheMigration Menu is discussed in detail in Section 5.2 Extract Data.)

When Access for DB2 and MOVE are available, this panel ispresented on two screens, a left-hand and a right-hand “page”. Toindicate the presence of right and left pages, More followed by anarrow is presented in the upper right of the panel. The direction of thearrow indicates whether the remaining prompts are to the right or left.Use the primary commands LEFT and RIGHT or the assignedfunction keys to scroll the pages horizontally.

When Access for DB2 is not available, only the right-hand page isdisplayed. (See Figure 24. Select Tables/Views for AD - CriteriaPortion on page 56.) This discussion assumes both products areinstalled.

If an existing Access Definition is selected, the set of tables definedfor that Access Definition is shown. If the Access Definition is beingcreated, there are no table names to display and space is provided toenter the name of a table to be included. A variety of commands areavailable to help populate this list. For example, you can specify thename of a single table and use the GET TABLES RELATED ALLcommand to populate the list with all of the tables related to thatsingle table.

Two Pages

Initial Display

Page 66: Move for DB2 User Guide

3. Specify Access Definitions

52 Move for DB2

Assume that the Access Definition named ADSAMPLE has beenselected and contains the name of one table, CUSTOMERS. The left-hand page of the Select Tables/Views for AD panel is shown withthe fully qualified name of the current Access Definition on the titleline.

-- Select Tables/Views for AD: GRP.USER.ADSAMPLE ----------------------------Command ===> Scroll ===> CSR

Primary: COL, SEL, SQL, REL, POINT, GROUP, GET TABLES RELATED, INDENT, ARC Line : COL, SEL, SQL, ALL, GR(A), GP(A), GC(A), EXP, ARC

Default Creator ID ==> PSTDEMO Table 1 of 1 MORE>>Start Table ==> CUSTOMERSStart Table Options : None

--- Access Rights ----Cmd Status (CreatorID.)Table/View Name (S)el/(U)pd/(I)ns/(D)el Type--- -------- --------------------------- ----------------------- -------*** ******************************* TOP ********************************___ CUSTOMERS D TABLE*** ****************************** BOTTOM ******************************

Figure 23. Select Tables/Views for AD – Access Rights

There are several fields on this panel.

Default CreatorID

1- to 8-character identifier. This default Creator IDis used whenever a Creator ID is omitted from theTable/View Name field. The default value, whencreating an Access Definition, is the current user’sDB2 SQLID.

Start Table Name of the table from which data is extracted first.If the Creator ID for the Start Table is not the sameas the default, the table name must be fully qualified.Any table defined in the Access Definition may beselected as the Start Table. If the field is left blank,the first table in the list is the default Start Table.Conversely, if the table named in the Start Tablefield is not in the Access Definition, it is added. Youmay specify a partial name, with wild cardcharacters to generate a selection list.

Start TableOptions

Identifies whether any of the Start Table selectioncriteria methods have been specified. This is adisplay-only field that contains one or more of thefollowing:

Temp. RowList(POINT)

Primary key values have beenstored in a Row List and areavailable only for the currentExtract Process.

Sample Display

Panel Fields

Page 67: Move for DB2 User Guide

3. Specify Access Definitions

User Manual 53

RowList(POINT)

Primary key values have beenstored in a Row List and areavailable for any ExtractProcess.

Group Selection(GROUP)

Group selection processing hasbeen specified.

None Special Start Table criteria havenot been specified.

Details about Row Lists are provided in Section 3.5Using the Point-and-Shoot Facility and detailsabout group selection processing are provided inSection 3.6 Group Selection Processing.

Cmd Field for line commands. Line commands are usedto select the tables for which further definition isrequired. Specify:

ALL Select all rows. This removes or drops allselection criteria.

ARC Display Specify Archive Criteria for ADpanel. (This command is only available ifArchive for DB2 is installed. ARC is notavailable when creating or modifying anAccess Definition through option 7MIGRATION on the Main Menu.)

COL Display Describe Columns for AD panel.

EXP Display the Criteria in Effect panel to listthe types of criteria in effect for the table

GR Add names of directly related tables to thelist.

GP Add names of directly related parent tablesto the list.

GC Add names of directly related child tablesto the list.

For GR, GP, and GC a number from 1through 9 can be specified with the linecommand to indicate the number of levelsto include.

Also, the alphabetic character A can bespecified to indicate that ALL levels are to

Page 68: Move for DB2 User Guide

3. Specify Access Definitions

54 Move for DB2

be included.

LR Generate a selection list of related tables.

SEL Display Specify Selection Criteria forAD panel

SQL Display SQL WHERE Clause panel.

ISPF-like line commands are available to copy,move, repeat, insert, and delete table names. Formore information on the available line commands seepage 61.

Status Indicates the status of the table. This is a displayonly field that contains one or more of the following:

ARC Archive criteria or index columnsspecified.

blank All columns are selected withdefault display formatting.Default.

COL Column attributes specified.

SEL Selection criteria specified.

SQL A SQL WHERE clause specified.

UNKNOWN The named table is not known toDB2. This is possible if the tablehas not been created yet, has beendropped since the AccessDefinition was defined, wasmistyped, or the default CreatorID is changed and the table namewhen combined with this value isUNKNOWN. An AccessDefinition may be saved with anUNKNOWN table. However, anUNKNOWN table may not bedefined as the Start Table.

VIEWERR The named view is not usable.Typically, this means that there isa conflict between the viewdefinition and the underlying basetables. An Access Definition maybe saved with a view that is in

Page 69: Move for DB2 User Guide

3. Specify Access Definitions

User Manual 55

VIEWERR status. However, aVIEWERR view may not bedefined as the Start Table.

REMOTE The named table is a remote aliasto another DB2 subsystem.Remote tables are not supported.This table name must be removedbefore saving the AccessDefinition.

If remote access is available,change the LOCATION to accessthese tables.

TEMPTABLE The table is a DB2 TemporaryTable. It contains no data, shouldbe defined as a reference table andcannot be used as the Start Tableor selected for a browse or Point-and-Shoot session. However, youcan extract the object definition.

Table/ViewName

Name of the table or view to be included in theAccess Definition. Tables are identified by CreatorID and table name. At least one table or view mustbe specified. If the Creator ID is not specified here,the Default Creator ID is assumed.

A table may be referenced once, therefore a tablename can be specified only once. This includes atable and one or more views of that table, or onemore aliases or synonyms of that table. (This appliesto MOVE only.)

If you exit this panel and at least one table is notspecified, MOVE deletes the Access Definition.

You can specify a Temporary Table, but it must be areference table and cannot be used as the Start Table.Since there is no data in the table, you cannot join toit during a browse or Point-and-Shoot session

Access Rights Access privileges. This field is not used by MOVE.It is relevant for Access for DB2. See the Accessfor DB2 Usage Manual.

Page 70: Move for DB2 User Guide

3. Specify Access Definitions

56 Move for DB2

Type Indicates whether the entry is a table, view, alias orsynonym. The possible values are:

TABLEVIEWS-TABLES-VIEWA-TABLEA-VIEW

Table nameView nameSynonym for a tableSynonym for a viewAlias for a tableAlias for a view

When you scroll right, the right-hand page of the SelectTables/Views for AD panel is displayed.

-- Select Tables/Views for AD: GRP.USER.ADSAMPLE -----------------------------Command ===> Scroll ===> CSR

Primary: COL, SEL, SQL, REL, POINT, GROUP, GET TABLES RELATED, INDENT, ARC Line: COL, SEL, SQL, ALL, GR(A), GP(A), GC(A), EXP, ARC

Default Creator ID ===> PSTDEMO Table 1 of 1 <<MOREStart Table ===> CUSTOMERSStart Table Options : None R D --Extract Parms--Cmd Status (CreatorID.)Table/View Name F A EveryNth RowLimit Type--- ----------- ------------------------------- --- -------- -------- --------*** ********************************** TOP ***********************************___ CUSTOMERS ____ ________ TABLE*** ******************************** BOTTOM **********************************

Figure 24. Select Tables/Views for AD - Criteria Portion

Many of the fields on this panel are also displayed on the left-handpage and are described previously in this section. The following fieldsare displayed only on this portion.

RF Identifies whether all of the rows in the table shouldbe selected because the table is a reference or look-up table. Specify:

N

Y

Extract only the related rows.

Extract all of the rows.

If Y is specified, the relationships for this table arenot displayed on the Specify Relationship Usagepanel because they are irrelevant when selectingrows from a reference table. Also, when theCompare Process is performed, reference tables arenot linked to related tables to identify relatedchanges. This field is displayed as Ref Tbl ifArchive for DB2 is not installed.

Use REF command to set all tables except the Start

Panel Fields

Page 71: Move for DB2 User Guide

3. Specify Access Definitions

User Manual 57

Table as reference tables.

Any table on the list, except the Start Table, may beselected as a reference table. Overtype the fieldwith the desired designation. There is no limit to thenumber of tables that may be specified as referencetables.

DA Specifies whether archived rows are deleted fromthe table. This field is only available when Archivefor DB2 is installed.

Every Nth A numeric value that specifies a random factor forrow selection from the table. For example, a valueof 5 specifies that every fifth row beginning with thefifth row is to be extracted. Any value from 1through 9999 may be specified.

Row Limit A numeric value that specifies the maximumnumber of rows that can be selected from the table.Any value from 1 through 99999999 may bespecified.

Top and bottom markers indicate the first and last table names in thelist on both the left and right pages of the panel.

You can specify a description for the Access Definition. Use theATTRIBUTES command to display the Object Attributes panel.This panel provides a 40-character area to display and edit thedescription. (Site management determines whether this panel alsodisplays a prompt for Security Status.) For additional informationabout the Object Attributes panel see Specify Description andSecurity Status in Section 6.1 User Options.

The following commands are available when the Select Tables/Viewsfor AD panel is displayed:

ALL EXP RELATIONSHIP ATTRIBUTES FIND RESET BOTTOM GET TABLES RELATED RFIND BROWSE GROUP SAVE CANCEL INDENT SEL CRITERIA COLUMNS LIST SORT CREATE PRIMARY KEY OPTIONS SQL CREATE RELATIONSHIP PARAMETERS TOP DOWN POINT UP END REF

Description

AvailableCommands

Page 72: Move for DB2 User Guide

3. Specify Access Definitions

58 Move for DB2

If Access for DB2 is installed, the primary commands EDIT, LEFTand RIGHT are available. If Archive for DB2 is installed, theprimary commands ARCHIVE and DAA are available.

3.3.1 Specifying Table Names

At least one table must be specified in the Access Definition. Inaddition to manually typing the table names in the field provided onthe panel, you may select from a selection list or let MOVE insert thetable names automatically.

3.3.1.1 Using a Selection List

The LIST command provides a variety of selection lists.

The LIST TABLES command is used to display an alphabetical listof tables from which one or more may be selected. A name patternmay be specified using DB2 LIKE syntax to limit the selection list. Ifa name pattern is not specified, the list includes all tables for thedefault Creator ID. For example to list all tables that begin with Afor the default Creator ID use:

LIST TABLES A%

You can include additional operands (DB, TS, PL, or PKG) to limitthe list to tables in a specific database, tablespace, plan, or package.These operands allow DB2 LIKE syntax. For example to list alltables that begin with A for the default Creator ID in a databasenamed PST1, specify:

LIST TABLES A% IN DB PST1

You can use DB2 LIKE syntax for the value for the operands DB,TS, PL, or PKG.

The LIST VIEWS command is used to display an alphabetical list ofviews from which one or more may be selected. A name pattern maybe specified.

The LIST ALIASES command is used to display an alphabetical listof aliases from which one or more may be selected. A name patternmay be specified.

The LIST SYNONYMS command is used to display an alphabetical listof synonyms for the current SQLID from which one or more may beselected. (This command does not accept DB2 LIKE syntax.)

LIST TABLES

LIST VIEWS

LIST ALIASES

LIST SYNONYMS

Page 73: Move for DB2 User Guide

3. Specify Access Definitions

User Manual 59

Assume a new Access Definition is being created and the LISTTABLES command is entered. A selection list displays all tables forthe default Creator ID in this example, PSTDEMO.

-- Select Tables/Views for AD: GRP.USER.ADSAMPLE ---------------------------- Command ===> list tables Scroll ===> CSR

Primary: COL, SEL, SQL, REL, POINT, GROUP, GET TABLES RELATED, INDENT, ARC Line : COL, SEL, SQL, ALL, GR(A), GP(A), GC(A), EXP, ARC

Default Creator ID ===> PSTDEMO Start Table ===> +--------Select One or More Tables-------+ Start Table Options : None | Cmd CreatorID.TableName 1 OF 6 | | --- ---------------------------- | Cmd Status (CreatorID.)Table | ************** TOP ************* | Type --- ------ ----------------- | ___ PSTDEMO.DETAILS | ---- *** ********************* | ___ PSTDEMO.ITEMS | **** ___ CUSTOMERS | S__ PSTDEMO.ORDERS | *** ************************ | ___ PSTDEMO.SALES | **** | ___ PSTDEMO.SHIP_INSTR | | ___ PSTDEMO.SHIP_TO | | ************ BOTTOM ************* | +----------------------------------------+

Figure 25. Table Selection List

This selection list can be scrolled. Any number of tables can beselected using the Select line command, S. Tables can be unselectedby overtyping the S with a blank. The selected tables are included inthe Access Definition when the ENTER key or END is used toterminate selection list processing. When the list is scrolled, theselections are processed such that the list is shown with a left-justifieduppercased S in the Cmd field of every selected table.

A maximum of 50 tables can be selected from the selection list.

In this example, the ORDERS table is selected by typing S in theCmd field of the selection list. END or ENTER is used to signal thattable selection is complete. The Select Tables/Views for AD panel isredisplayed and includes the selected table.

-- Select Tables/Views for AD: GRP.USER.ADSAMPLE ---------------------------- Command ===> Scroll ===> CSR

Primary: COL, SEL, SQL, REL, POINT, GROUP, GET TABLES RELATED, INDENT, ARC Line: COL, SEL, SQL, ALL, GR(A), GP(A), GC(A), EXP, ARC

Default Creator ID ===> PSTDEMO Table 1 of 2 <<MORE Start Table ===> CUSTOMERS Start Table Options : None R D --Extract Parms-- Cmd Status (CreatorID.)Table/View Name F A EveryNth RowLimit Type --- -------- -------------------------------- --- -------- -------- ------- *** ******************************* TOP *********************************** ___ CUSTOMERS N ____ ________ TABLE ___ ORDERS N N ____ ________ TABLE *** ****************************** BOTTOM *********************************

Figure 26. Selected Table Included in Access Definition

Table Selected

Page 74: Move for DB2 User Guide

3. Specify Access Definitions

60 Move for DB2

The selection list can be displayed again as needed. The selection listwill not contain any tables that are already included in the AccessDefinition.

In addition to a selection list of all tables, a selection list of only thetables related to a specific table can be displayed. The LISTTABLES RELATED primary command or the LR line command areused to display the list of tables related to a specific table. The LISTTABLES RELATED command requires that the name of a table bespecified. For example, to display a list of tables that are related tothe CUSTOMERS table using the default Creator ID, enter:

LIST TABLES RELATED TO CUSTOMERS

The same is accomplished by specifying:

LIST TABLES RELATED

and positioning the cursor at the line containing the name CUSTOMERS.You can also use the List Related line command, LR.

The display lists the names of the related tables, the source of therelationship definition, and the type of table in the relationship aseither parent or child. The source of the relationship definition isspecified as DB2 for those relationships obtained from the DB2Catalog and as PST for those defined to the Princeton SoftechDirectory.

Tables can be selected from the list of related tables in the samemanner as selecting tables from the full table list obtained using theLIST TABLES primary command. This list can be redisplayed asneeded.

3.3.1.2 Automatically Inserting Table Names

The GET TABLES RELATED command obtains the same list as theLIST RELATED command except that GET TABLES RELATEDautomatically includes the related tables in the Access Definition. Aselection list is not presented. You may delete any unwanted relatedtables.

The ALL operand can be specified on the command to obtain theentire set of related tables. This includes all parents, grandparents,children, grandchildren, and so on related to the named table.

For example, assume the four tables in the following diagram arerelated as shown. The arrows indicate the direction of the relationshipas parent to child.

Selection List ofRelated Tables

Page 75: Move for DB2 User Guide

3. Specify Access Definitions

User Manual 61

Specifying GET TABLES RELATED ALL for any one of the tablesin the diagram will populate the table list with all of the table names.

Operands are provided to insert only related parents or only relatedchildren for a specified number of levels. Note the followingexamples:

• GET TABLES RELATED TO CUSTOMERS CHILD

Inserts all children directly related to CUSTOMERS. In thisexample, only the ORDERS table is inserted.

• GET TABLES RELATED TO CUSTOMERS 2 CHILD

Inserts two levels of childrenchildren and grandchildren. In thisexample, the ORDERS table and the DETAILS table are inserted.

Conversely, the command can also be directed to include parenttables. Note the following examples:

• GET TABLES RELATED TO DETAILS PARENT

Inserts only the parents of the DETAILS table. In this example,the ORDERS table and the ITEMS table are parents.

• GET TABLES RELATED TO DETAILS 2 PARENT

Inserts two levels of parentsparents and grandparents. In thisexample, in addition to the ORDERS table and the ITEMS table,the CUSTOMERS table is inserted because, as parent of theORDERS table, it is the grandparent of the DETAILS table.

Comparable line commands, GRn, GRA, GPn, GPA, GCn and GCAare also available. Enter the line command in the line command areaof any table name on the Select Tables/Views for AD panel.

A table designated as a reference table cannot be the subject of eitherthe GET RELATED primary command or any of the GR linecommands. By definition, all rows in a reference table are extractedsubject to selection criteria regardless of relationships with othertables on the table list.

3.3.1.3 Supporting Facilities

You may find, when using the GET RELATED or LIST RELATEDcommands, that one or more tables you expected are not included ortables you did not expect are included. You can create neededrelationships and display the tables in a format based on theirrelationships.

Page 76: Move for DB2 User Guide

3. Specify Access Definitions

62 Move for DB2

A relationship does not exist when an expected table is not includedby GET RELATED or LIST RELATED processing. You can createadditional relationships using the CREATE RELATIONSHIPcommand on the Select Tables/Views for AD panel. This displaysthe panels used to define relationships stored in the Princeton SoftechDirectory. (The Definitions option on the Main Menu also displaysthese panels. The information about defining relationships isdiscussed in Section 4.2 Relationships.)

When you signal that you have completed defining the relationshipusing END or CANCEL, you are returned to the SelectTables/Views for AD panel. When you execute GET RELATED orLIST RELATED, the newly related tables are included.

The list of the tables in the Access Definition can be viewed in a formatthat shows parent-child relationships. This information may be helpfulwhen determining which tables are to be included in the AccessDefinition. Multiple references to a table are indicated. Use theINDENT command on the Select Tables/Views for AD panel or on theSpecify Relationship Usage panel to display the indented list.

Assume the four tables CUSTOMERS, ORDERS, DETAILS, andITEMS, as shown in the previous diagram, are listed in the AccessDefinition. The following panel is displayed when the INDENTcommand is executed.

----------------------------- Indented Table Display -------------------------Command ===> Scroll ===> CSR ROW 0 OF 10*********************************** TOP OF DATA ******************************

Default Creator ID : PSTDEMO

Table Name Relation Type ------------------------------------------------------------- -------- ----1. CUSTOMERS START TABLE2. C:ORDERS RCO DB23. C:DETAILS ROD DB24. P:ITEMS RID DB2

Figure 27. Indented Table Display

The fields on the panel include:

Default Creator ID The default Creator ID as specified on theSelect Tables/Views for AD panel.

Table Name Name of the table. If the Creator ID is notthe same as the default Creator ID it isincluded with the name.

CreatingRelationships

DisplayingRelationships

Panel Fields

Page 77: Move for DB2 User Guide

3. Specify Access Definitions

User Manual 63

The Start Table is listed first followed by theother tables ordered and formatted to reflectthe relationships. When there is more thanone related table, the names of the parents arelisted followed by the children. Within theselists of parents and children, the order isdetermined by the Access Definition table list.

Special notation is included with the tablename to provide information about therelationships. This notation includes:

Parent/Child IndicatorsExcept for the Start Table, the table name isprefixed to indicate whether it is the parent orthe child in the relationship defined betweenthe named table and the table under which itis indented. The prefix is either:

C: ChildP: Parent

Multiple Reference IndicatorAny table that is referenced multiple times isnoted by the suffix (n) where n is an integervalue indicating the line number on the panelcontaining the first occurrence. The firstoccurrence is not displayed with a multiplereference indicator. Thus, table names listedbelow the first occurrence on the list are notlisted again.

Cycle IndicatorAny table that is included in a cycle is notedby the suffix (CYCLE:n) where n specifiesthe line numbers of the other tables in thecycle.

Relation Name of the relationship between the higherlevel table and this table. START TABLE isalways specified for the Start Table.

Type Identifier to denote whether the relationship isdefined in the DB2 Catalog, DB2, or in thePrinceton Softech Directory, PST.

Page 78: Move for DB2 User Guide

3. Specify Access Definitions

64 Move for DB2

If indenting is such that sufficient space is not available to display thefull name, the name is preceded with a level indicator (Ln where n isthe level number) and positioned to the left such that the entire namefits on the line.

Any tables that have been selected as reference tables are noted at thebottom of the list and not directly included in the formatted list.

Also, any table included on the list that does not have a relationshipwith another table on the list is not included in the formatted list.These “unconnected tables” are listed at the bottom after the referencetables.

Use END to return to the Select Tables/Views for AD panel.

3.3.2 Handling the Table List

On the Select Tables/Views for AD panel, you can scroll the list oftables using UP, DOWN, TOP, and BOTTOM. You can also use theFIND command to locate a table name by specifying all or part of thename with the command.

To edit the list of tables, you can directly overtype a table name or useline commands.

The line commands available for editing include standard ISPF-likecommands to manipulate the order of the tables and to add new tables.

The available line command functions are:

Copy C or CC Delete D or DD Insert I Move M or MM Repeat R or RR Use A or B to indicate destination of a copy or moveoperation.

Each table name must be unique. Any editing can result in duplicatetable names, which must be resolved before saving or using theAccess Definition.

Rearranging the order in which the tables are listed has no impact onthe sequence in which the data is extracted from the tables when theAccess Definition is used by MOVE to copy DB2 data.

Table names may be deleted by using the Delete line commands, byspacing over the name, or by using the Erase EOF key in the table

Line Commands

Delete Names

Page 79: Move for DB2 User Guide

3. Specify Access Definitions

User Manual 65

name field. Although any number of tables can be deleted from theAccess Definition, at least one table must be specified. If all tablesare deleted from the Access Definition and the Select Tables/Viewsfor AD panel processing is terminated, the Access Definition isautomatically deleted. If the user option, Confirm Delete, is definedas YES, you will be prompted for confirmation before the AccessDefinition is deleted.

If the name of a table is modified, it is assumed that you are deletingthe table and specifying another one, therefore any columnspecifications or SQL WHERE Clause for the original named tableare deleted. Also, any pertinent relationships are removed from thelist displayed on the Specify Relationship Usage panel. However, ifonly the Creator ID portion of the table name is modified, the columnspecifications and SQL WHERE Clause, if any, are retained. Also, ifany of the previously listed relationships are not defined for the tablename combined with the new Default Creator ID, the relationships areretained in UNKNOWN status unless specifically deleted. Additionalrelationships, if any, are added.

3.3.3 Access Definition Specific Commands

Primary commands, unique to the Princeton Softech tools, areavailable when defining an Access Definition. These commands areprovided to display panels on which to specify additional AccessDefinition information. The most frequently used commands arelisted at the top of the panel.

These commands, in alphabetical order, are:

ALL Delete the selection criteria specified for the indicatedtable so that all rows are selected.

ARC Display the Specify Archive Criteria for AD panelfor the table to select columns for indexing or tospecify archive criteria. (This command is onlyavailable if Archive for DB2 is installed.)

COL Display the Describe Columns for AD panel for thistable. This portion of the panel is used to specify thedisplay behavior of the columns and the sort criteria.The display behavior is specified on the DescribeColumns for AD panel and is used for displayingdata for a Point-and-Shoot session.

GETTABLES

Include tables related to a specific table in the AccessDefinition. (For more information, see Section

Modify Name

PrimaryCommands

Page 80: Move for DB2 User Guide

3. Specify Access Definitions

66 Move for DB2

RELATED 3.3.1.2 Automatically Inserting Table Names.)

GROUP Display the Start Table Group Selection Processingprompt. This panel is used to specify randomselection of Start Table rows based on values in onecolumn.

INDENT Display the list of tables in an indented format. Thisformat indicates the hierarchy in which the tables areto be accessed. Tables are identified as parent orchild in the relationship with the next higher leveltable. Multiple references to a single table are noted.

PARM Display the Access Definition Parameters panel forthis Access Definition.

POINT Display the data from the Start Table as a Point-and-Shoot session. Users select the rows from the StartTable to be used as the starting point of an ExtractProcess. The primary key value for each selected rowis saved.

REL Display the Specify Relationship Usage panel forthis Access Definition. This specifies therelationships to be traversed when extracting data.

SEL Display the Specify Selection Criteria for AD panelfor this table. This portion of the panel is used tospecify the selection criteria when extracting datafrom each table and displaying the data for a Point-and-Shoot session.

SQL Display the SQL WHERE Clause panel for thistable. This panel is used to specify an SQL WHEREClause. The SQL WHERE Clause is used whenextracting data from a table and displaying data for aPoint-and-Shoot session.

The line commands listed on the Select Tables/Views for AD panelare discussed with the Cmd field for Figure 23. Select Tables/Viewsfor AD – Access Rights on page 52.

Use END to return to the Select Tables/Views for AD panel fromany of these displays. Use the CANCEL command to abandon anychanges made on these panels and then return.

Line Commands

Page 81: Move for DB2 User Guide

3. Specify Access Definitions

User Manual 67

3.3.4 Completed Table Selection

Use the END command to signal that specifications on the SelectTables/Views for AD panel are complete. The Access Definition isstored in the Princeton Softech Directory. The Select AccessDefinitions panel, the Choose an Access Definition panel, or theEXTRACT Process menu is redisplayed depending on how theSelect Tables/Views for AD panel was requested.

When an error condition is encountered, it must be resolved. Someerrors prevent the user from proceeding in the definition process; othererrors must be resolved before saving the Access Definition.

The following errors must be resolved to proceed to another panel:

• Invalid entry in the line command field• Invalid characters in any field• Syntax errors in the command entry field

The following errors must be resolved before saving the AccessDefinition.

• A duplicate table name is specified (MOVE only)• No table names are specified• A remote table name is specified

Appropriate error messages are displayed. Use HELP to displayadditional information.

Use the SAVE command to store the Access Definition under thecurrent name or a new name. For more information see theRelational Tools Command Reference Manual.

The CANCEL command returns to the previous panel. Any dataediting or line commands that are present are ignored. All changes,including those that have introduced errors, are abandoned. Anyspecifications previously stored by the SAVE command are retained.

Error Handling

SAVE Command

CANCELAbandonsChanges

Page 82: Move for DB2 User Guide

3. Specify Access Definitions

68 Move for DB2

3.4 Specifying Criteria

MOVE provides several methods for specifying selection criteria.These include specifying:

• Selection criteria for individual columns in a table.

• An SQL WHERE Clause for a table.

• Specific rows from the Start Table using the Point-and-Shootfacility.

• Random sampling specifications for the Start Table using groupselection processing.

• A sampling rate to be used to extract a random set of rows for anindividual table.

• A maximum number of rows for an individual table or for theentire Extract File.

When more than one form of criteria is specified, they are combined.However, if Point-and-Shoot values are specified for a Start Tablealong with selection criteria, a prompt is displayed on the SpecifyEXTRACT Parameters and Execute panel enabling you to specifywhether only the Point-and-Shoot values or both the values andselection criteria are to be used.

When selection criteria or an SQL WHERE Clause is not specified,all rows in the non-start tables are candidates for extraction basedonly on the related data they contain and, if specified, a randomselection factor and maximum row limit value.

Prompts for a random factor and a row limit for a table are providedon the Select Tables/Views for AD panel and are discussed inSection 3.3 Table/View Selection. The Point-and-Shoot facility isavailable from the Select Tables/Views for AD panel and isdiscussed in Section 3.5 Using the Point-and-Shoot Facility. Groupselection processing is available from the Select Tables/Views forAD panel and is discussed in Section 3.6 Group SelectionProcessing.

The prompts for selection criteria and an SQL WHERE clause aredisplayed on different panels and discussed with the appropriate paneldescription in the following sections.

Page 83: Move for DB2 User Guide

3. Specify Access Definitions

User Manual 69

To remove the selection criteria and the SQL WHERE Clausespecification from a table, use the ALL primary or line command on theSelect Tables/Views for AD panel. For example, to remove the criteriafor the CUSTOMERS table, you can specify the primary command as:

ALL CUSTOMERS

3.4.1 Selection Criteria

Selection criteria limit the set of rows extracted from each table anddetermine which rows are displayed during a Point-and-Shoot session.Selection criteria can be specified for one or more columns.

The Specify Selection Criteria for AD panel is used to specify theselection criteria for each table. By default, all rows in each table areincluded, subject to user and site maximums. To specify selectioncriteria, use either the SEL primary or SEL line command on theSelect Tables/Views for AD panel.

For example, to specify selection criteria for the CUSTOMERS tableusing the primary command enter:

SEL CUSTOMERS

Alternatively, you can enter the line command, SEL, in the Cmd fieldnext to the table name as shown in the following figure. (This figureassumes that four tables have been specified for the Access DefinitionGRP.USER.ADSAMPLE.)

-- Select Tables/Views for AD: GRP.USER.ADSAMPLE --------------------------- Command ===> Scroll ===> CSR

Primary: COL, SEL, SQL, REL, POINT, GROUP, GET TABLES RELATED, INDENT, ARC Line: COL, SEL, SQL, ALL, GR(A), GP(A), GP(C), EXP, ARC

Default Creator ID ===> PSTDEMO Table 1 of 4 <<MORE Start Table ===> CUSTOMERS Start Table Options : None R D --Extract Parms-- Cmd Status (CreatorID.)Table/View Name F A EveryNth RowLimit Type --- -------- -------------------------------- --- -------- -------- -------- *** *********************************** TOP ******************************** sel CUSTOMERS N ____ ________ TABLE ___ ORDERS N N ____ ________ TABLE ___ ITEMS N N ____ ________ TABLE ___ DETAILS N N ____ ________ TABLE *** ********************************** BOTTOM ******************************

Figure 28. Selecting A Table For Column Handling

ALL Command

SEL Command

Page 84: Move for DB2 User Guide

3. Specify Access Definitions

70 Move for DB2

The prompts for selection criteria are displayed:

-- Specify Selection Criteria for AD: GRP.USER.ADSAMPLE -------------------Command ===> Scroll ===> CSR

Table Name: PSTDEMO.CUSTOMERS Col 1 of 9 <<MORECombine All Column Criteria by ===> A (A-AND, O-OR)

Cmd Column Name Selection Criteria--- ---------------- ---------------------------------------------------*** ********************************* TOP ********************************___ CUST_ID___ CUSTNAME___ ADDRESS___ CITY___ STATE___ ZIP___ YTD_SALES___ SALESMAN_ID___ PHONE_NUMBER*** ******************************* BOTTOM *******************************

Figure 29. Specify Selection Criteria for AD

The fields on the panel are:

Table Name The name of the current table or view.

Combine AllColumn Criteria by

Specifies the logical operator to apply to thecolumn criteria.

A All criteria are logically ANDed.Default.

O All criteria are logically ORed.

Cmd Line command entry field. The supportedline commands include:

M or MMA or BZ

Move line.Destination for move.Zoom to display all prompts foreach column on a single panel.

The names cannot be edited and columns cannot be inserted or deleted on this display.

By default, the columns are listed initially inthe order in which they were specified toDB2. Use the Move line command torearrange the order for Point-and-Shoot. Theorder has no impact on data selection or sortsequence.

Panel Fields

Page 85: Move for DB2 User Guide

3. Specify Access Definitions

User Manual 71

Column Name The name of the column. All columns in thetable are listed.

Notation is displayed to the right of the TableName indicating the relative position of thefirst displayed column name within the list.This notation is displayed as Col x of y wherex represents the relative position of the firstdisplayed column and y the total number ofcolumns in the list.

Selection Criteria Specifies the selection criteria for eachcolumn. Any valid SQL predicate is allowed.

Valid Operators

=><

<>>=<=

¬=¬>¬<

IN (a,b,c,d...)

IS NULL

LIKE

BETWEEN x AND y

NOT IN (a,b,c,d...)

IS NOT NULL

NOT LIKE

MPT BETWEEN x AND y

Selection criteria are specified by supplying an appropriate operatoralong with a corresponding value or a list of values. For example,entering > 'M' in the Selection Criteria field for the columnCUSTNAME, selects all customers with names that arealphabetically greater than M. Similarly, entering = 'MA' in theSelection Criteria field for the column STATE, selects all customersfrom the state of Massachusetts. If the fields are ORed, all customerssatisfying either condition are included. If the fields are ANDed, onlythe customers that satisfy both conditions are included. That is, onlythe customers whose names begin alphabetically greater than M andare from the state of Massachusetts are included.

Specifying theCriteria

Page 86: Move for DB2 User Guide

3. Specify Access Definitions

72 Move for DB2

The following figure displays the selection criteria to obtain customerswho satisfy both conditions.

-- Specify Selection Criteria for AD: GRP.USER.ADSAMPLE -------------------Command ===> Scroll ===> CSR

Table Name: PSTDEMO.CUSTOMERS 1 of 9 <<MORECombine All Column Criteria by ==> A (A-AND, O-OR)

Cmd Column Name Selection Criteria--- ------------------- -------------------------------------------------*** ********************************* TOP ********************************___ CUST_ID___ CUSTNAME > 'M'___ ADDRESS___ CITY___ STATE = 'MA'___ ZIP___ YTD_SALES___ SALESMAN_ID___ PHONE_NUMBER*** ****************************** BOTTOM *******************************

Figure 30. Selection Criteria Specified

The primary commands available on the Specify Selection Criteriafor AD panel include:

BOTTOM COLUMNS OPTIONS TOP BROWSE DOWN RESET UP CANCEL END SAVE ZOOM CAPS LEFT SQL

The EDIT command is available if Access for DB2 is also installed.

3.4.2 Other Column Specifications

The Describe Columns for AD panel is used to define other columnspecifications for the selected table. These specifications apply to thePoint-and-Shoot session only and do not affect the Extract Process.Use the COL command on the Select Tables/Views for AD panel orthe Specify Selection Criteria for AD panel. You can also scroll theSpecify Selection Criteria for AD panel left.

AvailableCommands

Page 87: Move for DB2 User Guide

3. Specify Access Definitions

User Manual 73

The column specification prompts are shown in the following figure.

-- Describe Columns for AD: GRP.USER.ADSAMPLE --------------------------------Command ===> Scroll ===> CSR

Table Name: PSTDEMO.CUSTOMERS Col 1 of 9 MORE>>

Disp Acc -Sort-- -Heading-Cmd Column Name Y/N S/U Lvl A/D N/L L/R/C Data Type Null Crit --- -------------------- ---- --- --- --- --- ----- ------------ ---- ---- ********************************** TOP ***********************************___ CUST_ID Y U __ _ N C CHAR(5) NO NO___ CUSTNAME Y U __ _ N C CHAR(20) NO YES___ ADDRESS Y U __ _ N C VARCHR(50) NO NO___ CITY Y U __ _ N C VARCHR(15) NO NO___ STATE Y U __ _ N C CHAR(2) NO YES___ ZIP Y U __ _ N C CHAR(5) YES NO___ YTD_SALES Y U __ _ N C DECIMAL(7,2) NO NO___ SALESMAN_ID Y U __ _ N C CHAR(6) YES NO___ PHONE_NUMBER Y U __ _ N C CHAR(10) YES NO ********************************* BOTTOM *********************************

Figure 31. Describe Columns for AD

The information on this portion of the panel is used for a Point-and-Shoot or browse session to determine how data is displayed. Inaddition to the Cmd field and the Column Name field, the panelincludes:

Disp Specifies whether the column is included or omittedwhen the Access Definition is used for Point-and-Shoot. Use the DISPLAY command to set allcolumns for display, ON, or no columns for display,OFF. At least one column must be displayed.

Acc Specifies whether the data in this column is displayonly or can be modified using Access for DB2. IfAccess for DB2 is not installed, this field is notdisplayed. Regardless, it has no impact on MOVEprocessing. For information about this field see theAccess for DB2 User Manual.

Sort Specifies the sort criteria for displaying the data fora Point-and-Shoot session. If values are notspecified, the order in which rows are displayed isundetermined.

Columns used to sort the data do not have to beassigned a DISP value of Y.

Sort specifications are composed of two values:

Lvl A numeric value indicating the order of priorityof this column in sorting the rows. The valuecan be from 1 though 64 inclusive with 1

Panel Fields

Page 88: Move for DB2 User Guide

3. Specify Access Definitions

74 Move for DB2

specifying the highest sort priority. The Lvlfields must contain unique and consecutivevalues starting with 1.

A/D Specify sort direction as (A)scending, thedefault, or (D)escending.

Heading Specifies the heading to be displayed with the column andthe position of the heading when the data is displayed forPoint-and-Shoot browsing. Valid heading values are:

NL

The column name. Default.The label defined in the DB2 Catalog.

The position of the heading is determined in relation tothe width of the data for a column. When the width ofthe data exceeds the width of the heading, this valuepositions the heading. However, if the width of theheading exceeds the width of the data, the data ispositioned based on this value. The valid values for theheading position are:

LRC

Left-justified.Right-justified.Centered. Default.

The display position of the data within the data fielddepends on the data type. Character data is left-justifiedand numeric data is right-justified.

Data Type Shows the data type and dimension of each column. Forthe most part, the DB2 data type format is displayed.For example, CHAR(15) and DECIMAL(10,2) aredisplayed as such. However, due to space limitations onthe panel, the following data type specifications aredisplayed in a shortened format:

DB2 Format

VARCHARLONG VARCHARFLOAT 4 byte lengthFLOAT 8 byte length

Field Format

VARCHRLVARCHRSINGLE FLOATDOUBLE FLOAT

This field is for display only.

Null Indicates whether the column is nullable. This field is fordisplay only. The possible values are:

YESNO

The column can contain NULL.The column cannot contain NULL.

Page 89: Move for DB2 User Guide

3. Specify Access Definitions

User Manual 75

Crit Indicates whether selection criteria have been specified onthe Selection Criteria for AD panel. The possiblevalues are:

YESNO

Criteria have been specified.Criteria have not been specified.

This field is for display only.

The primary commands available on the Describe Columns for ADpanel include:

BOTTOM COLUMNS RESET TOP BROWSE DOWN RIGHT UP CANCEL END SAVE ZOOM CAPS OPTIONS SQL

The EDIT command is available if Access for DB2 is also installed.

3.4.3 Zooming Column Information

To display all of the information for a single column on one panel ratherthan scrolling left and right to complete the specifications, use the ZOOMcommand. This command toggles between displaying the information ontwo panelsDescribe Columns for AD and Specify SelectionCriteriaand a one-panel single column display. ZOOM can beassigned to a program function key.

The Zoom line command can also be used to zoom the display for aspecific column by entering Z in the Cmd field of the column on theDescribe Columns for AD or the Specify Selection Criteria for ADpanels. Use the ZOOM primary command to return to the column listdisplay.

Available Commands

Zoom LineCommand

Page 90: Move for DB2 User Guide

3. Specify Access Definitions

76 Move for DB2

The zoomed display is shown in the following figure:

-- Describe Columns for AD: GRP.USER.ADSAMPLE -----------------------------Command ===> Scroll ===> CSR

Table Name: PSTDEMO.CUSTOMERS Col 1 of 9Combine All Column Criteria by ==> A (A-AND, O-OR)

Column Name : CUST_IDData Type : CHAR(5) NOT NULLUpdatable by DB2 : YES

Display This Column ===> Y (Y-Yes, N-No)Sort Level ===> __ (1-64 or blank)Ascending or Descending ===> _ (A, D or blank)Column Heading Position ===> C (L-Left, R-Right, C-Center)Column Heading ===> L (L-Use Label, N-Use Name)Access Rights ===> S (S-Select, U-Update)Criteria ===>

Figure 32. Zoomed Column Information

This panel prompts for the same information as the two panels,Describe Columns for AD and Specify Selection Criteria for AD.Notation is provided to the right of the Table Name to indicate therelative position of the currently displayed column and the totalnumber of columns in the table.

The prompt for Access Rights is only displayed when Access forDB2 is available.

Although Combine All Column Criteria is displayed with eachcolumn in zoom mode, it is a global setting and applies to the entiretable. Modifying the value when any column is displayed modifies thevalue for the table.

During a zoomed display, the scrolling commands UP, DOWN, TOP,and BOTTOM are available to display the previous, next, first, andlast column.

3.4.4 SQL WHERE Clause Specification

Sometimes the column selection criteria can not be adequatelyspecified on the Specify Selection Criteria for AD panel. Forexample, it may be necessary to specify a combination of OR andAND logical operators. For those situations, use the SQL WHEREClause panel to specify the WHERE clause for the SQL SELECTstatement.

From the Select Tables/Views for AD panel, specify SQL followedby the desired table name to display the SQL WHERE Clause panel.From the Specify Selection Criteria for AD or the Describe

AvailableCommands

SQL PrimaryCommand

Page 91: Move for DB2 User Guide

3. Specify Access Definitions

User Manual 77

Columns for AD panels, enter the SQL primary command with nooperands to display the panel for the current table.

You can display the SQL WHERE Clause panel for a specific tableon the Select Tables/Views for AD panel by typing SQL in the Cmdfield next to the desired name.

The SQL WHERE Clause panel is displayed as:

---------------- Enter an SQL WHERE Clause for a Table or View -----------------Command ===> Scroll ===> CSR

SELECT ... FROM PSTDEMO.ORDERS WHERECmd Correlation Name === > A WHERE 1 of 6--- ------------------------------------------------------------------------___ ****************************** TOP *************************************___ CURRENT DATE - A.ORDER_DATE < 15_______________ ***************************** BOTTOM *********************************** Line Commands: (I)nsert, (D)elete, (R)epeat, (M)ove, (C)opy Use the LIST COLUMNS command to add column names, if needed Use the SQLEdit command to invoke the ISPF editor with all of its facilities An optional correlation name can be entered to refer to the base table

Figure 33. Specify SQL WHERE Clause

For reference, the name of the table is provided in the SELECT FROMheading near the top of the panel. This heading includes an ellipsis, ...,following SELECT to indicate the column list will include all columnsbecause, generally, the list is too long to provide in the allocated space.

To simplify entering the table name in the SQL WHERE clause, you canspecify a 1–18 character string for the prompt Correlation Name andsubstitute that string for the fully qualified table name in the FROMclause.

This is especially useful for qualifying a column name when there aremultiple tables referenced in the SQL.

Specify the desired SQL in the data area of the panel. The data areadisplays the SQL in segments of six lines containing 72 positions. Amaximum of 200 lines is available for specifying the SQL and self-documenting comments. Standard DB2 conventions apply tocomments; each line must begin with two hyphens (--).

This area is scrollable. Notation in the upper right above the dataarea indicates the total number of lines and the relative position of thefirst displayed line.

Specify the desired SQL WHERE Clause using standard DB2 SQLformat. To facilitate editing, a Cmd field is provided for each line.

SQL LineCommand

Correlation Name

Data area

Editing SQLWHERE Clause

Page 92: Move for DB2 User Guide

3. Specify Access Definitions

78 Move for DB2

Page 93: Move for DB2 User Guide

3. Specify Access Definitions

User Manual 79

Several functions can be performed using line commands. Thefunctions and the line commands are:

Copy Cn, CC Delete Dn, DD Insert In Move Mn, MM Repeat Rn, RR

For Copy and Move, use A or B to indicate the destination.

When you type the data, all leading and trailing spaces on each lineare maintained. Only the trailing spaces at the end of the last line ofthe SQL WHERE clause are deleted.

You can display a list of columns in the table using the LISTCOLUMNS primary command. This list can be scrolled andselections can be made directly from this list using the Select linecommand. When a column is selected, it is added to the end of thecurrent SQL WHERE clause text.

You can use the SQLEDIT command to invoke an ISPF edit sessionfor the current SQL WHERE clause. All of the standard ISPFfacilities are available. You can use the ISPF COPY command toinsert data from a file and edit as desired.

When you terminate the ISPF session using END, the Enter an SQLWHERE Clause for a Table or View panel is redisplayed. Theedited data is inserted into the panel.

The SQL WHERE clause is deleted when all lines are blank. Thiscan be accomplished by overtyping the WHERE Clause with blanksor pressing the Erase EOF key for each line of text.

The following primary commands are available:

BROWSE CANCEL COLUMNS

END LIST COLUMNS

OPTIONS SAVE

SEL CRIT SQLEDIT

The EDIT command is available when Access for DB2 is installed.

After you have completed specifying the SQL WHERE clause, useEND to save the current specifications and terminate editing.

Use the SAVE command to save the current specifications andcontinue editing. You may want to use SAVE periodically to validatethe SQL WHERE.

When you use END or SAVE, the SQL WHERE clause is validated.The clause must be 200 lines or less and the clause must beacceptable to DB2. In either case, a message is displayed detailing

LIST COLUMNS

SQLEDIT

Delete WHEREClause

AvailableCommands

SpecificationComplete

Page 94: Move for DB2 User Guide

3. Specify Access Definitions

80 Move for DB2

the error. Errors must be resolved before you can save the SQLWHERE clause and exit this panel.

When the SQL WHERE Clause is valid, the panel that waspreviously displayed is redisplayed.

When the Select Tables/Views for AD panel is redisplayed, theStatus field in the panel will contain SQL to indicate that an SQLWHERE clause has been specified for the selected table.

In the following figure, an SQL WHERE clause has been specifiedfor the ORDERS table.

-- Select Tables/Views for AD: GRP.USER.ADSAMPLE -----------------------------Command ===> Scroll ===> CSR

Primary: COL, SEL, SQL, REL, POINT, GROUP, GET TABLES RELATED, INDENT, ARC Line: COL, SEL, SQL, ALL, GR(A), GP(A), GC(A), EXP, ARC

Default Creator ID ===> PSTDEMO Table 1 of 4 <<MOREStart Table ===> CUSTOMERSStart Table Options : None R D --Extract Parms--Cmd Status (CreatorID.)Table/View Name F A EveryNth RowLimit Type--- ---------- ------------------------------- --- -------- -------- --------*** ********************************** TOP ***********************************___ COL/SEL CUSTOMERS N ____ ________ TABLE___ SQL ORDERS N N ____ ________ TABLE___ ITEMS N N ____ ________ TABLE___ DETAILS N N ____ ________ TABLE*** ********************************* BOTTOM *********************************

Figure 34. SQL WHERE Clause Indicated

When selection criteria has been specified on both the SpecifySelection Criteria for AD panel and the SQL WHERE Clausepanel, the two are logically ANDed. The presence of both is indicatedby SEL/SQL in the Status field of the Select Tables/Views for ADpanel.

Archive criteria determine the columns that are indexed in the PSTDirectory and limit the set of rows archived from each table. Archivecriteria can be specified for one or more columns and are combinedwith selection and other criteria in an Archive Process. Thiscommand is only available if Archive for DB2 is installed.

3.4.5 Table Status Indicated

When selection criteria and column specifications for the current tableare completed, use END to return to the Select Tables/Views for ADpanel. The Status field in the Select Tables/Views for AD panel willcontain COL when specifications have been made for the columns ofthe selected table. The Status field will contain SEL when selection

Selection Criteriaand SQL WHEREClause

Archive Criteria

Page 95: Move for DB2 User Guide

3. Specify Access Definitions

User Manual 81

criteria has been specified. However, if the default column settingshave not been modified and selection criteria has not been specified,COL and SEL are not displayed in the Status field. In the followingfigure, column specifications and selection criteria have been definedfor the CUSTOMERS table.

-- Select Tables/Views for AD: GRP.USER.ADSAMPLE -----------------------------Command ====> Scroll ===> CSR

Primary: COL, SEL, SQL, REL, POINT, GROUP, GET TABLES RELATED, INDENT, ARC Line: COL, SEL, SQL, ALL, GR(A), GP(A), GC(A), EXP, ARC

Default Creator ID ===> PSTDEMO Table 1 of 4 <<MOREStart Table ===> CUSTOMERSStart Table Options : None R D --Extract Parms--Cmd Status (CreatorID.)Table/View Name F A EveryNth RowLimit Type--- ---------- -------------------------------- --- -------- -------- -------*** ********************************* TOP ***********************************___ COL/SEL CUSTOMERS N ____ ________ TABLE___ ORDERS N N ____ ________ TABLE___ ITEMS N N ____ ________ TABLE___ DETAILS N N ____ ________ TABLE*** ******************************** BOTTOM *********************************

Figure 35. Column Specifications Indicated

Page 96: Move for DB2 User Guide

3. Specify Access Definitions

82 Move for DB2

3.5 Using the Point-and-Shoot Facility

MOVE provides the Point-and-Shoot facility to enable you to selectspecific rows from the Start Table. These selected rows are used tostart an Extract Process. If selection criteria have also been definedfor the Start Table, you can specify whether the Point-and-Shoot listoverrides the criteria or is used to supplement the selection criteria.(The Extract Parameter, Every Nth, is always ignored if a Point-and-Shoot list is used.)

The specific rows you select from the Start Table in a Point-and-Shoot session are identified by the primary key values, therefore, theStart Table must have a primary key.

The primary key values are stored in a sequential or partitioned dataset that you specify. If the data set does not exist, MOVE promptsfor the required information and allocates it for you. (See AppendixB. Allocating External Files for more information.) Once saved,these values can be used and modified as needed.

The Point-and-Shoot facility can be invoked from the SelectTables/Views for AD panel when defining an Access Definition orwhen specifying an Extract Process. Specifications made whiledefining an Access Definition must be permanent so they can be usedin a future Extract Process request. The Point-and-Shootspecifications made when defining an Extract Process can be storedpermanently or used only for the current request. A temporary RowList can be specified for the current Extract Process only through theTABLES option on the Extract Process menu.

Primary Key

Value Stored

Permanent orTemporary

Page 97: Move for DB2 User Guide

3. Specify Access Definitions

User Manual 83

Use the POINT command on the Select Tables/Views for AD panelto invoke the Point-and-Shoot facility. MOVE prompts for the nameof an Input DSN. The Input DSN is a data set that containspreviously specified primary key values for the Start Table.

-- Select Tables/Views for AD: GRP.USER.ADSAMPLE ---------------------------- Command ===> Scroll ===> CSR

Primary: COL, SEL, SQL, REL, POINT, GROUP, GET TABLES RELATED, INDENT, ARC Line: COL, SEL, SQL, ALL, GR(A), GP(A), GC(A), EXP, ARC <<MORE Default Creator ID ===> PSTDEMO St +----------------- Start Table Row List Processing -------------------+ | | | Specify Input DSN If You Want to Use Previously Saved Row List | | Input DSN ===> | | | | Press ENTER to Start Point-and-Shoot Session | | Enter END Command to Return to Table List | | Enter CANCEL Command to Cancel POINT Command | | | | Special Line Commands Available for Row Selection: | | SR, SSR - Select Start Table Row and All Related Rows | | UR, UUR - UnSelect Start Table Row and All Related Rows | +---------------------------------------------------------------------+

Figure 36. Start Table Row Selection Prompt

The field on the panel is:

Input DSN The Input DSN. If this is a new AccessDefinition or an Input DSN has not beenpreviously specified for this AccessDefinition, the field is blank. You can use apreviously saved row list by specifying thename of an input data set containing the rowlist to be used.

If an Input DSN has been previouslyspecified for the selected Access Definition,the name is supplied by MOVE. Overtypethe name to use another Input DSN.

To stop using the named input data set, erasethe field.

How the values in the Input DSN field are handled is based onwhether you use ENTER, END, or CANCEL as listed on the panel.

ENTER The Point-and-Shoot session begins.

If an Input DSN is supplied, the previouslyselected rows are identified on the display. Ifthe Input DSN field is blank, there are no

POINT Command

Panel Field

Page 98: Move for DB2 User Guide

3. Specify Access Definitions

84 Move for DB2

previous selections.

END The display returns to the SelectTables/Views for AD panel.

If an Input DSN is supplied, the primary keyvalues in the named input data set are to beused. Thus, you can use the primary keyvalues from an existing input data setwithout entering a Point-and-Shoot session.

If the Input DSN field is blank, there are noprimary key values to be used.

You can erase the Input DSN name and useEND to drop a previously specified InputDSN. This does not delete the data set, butdiscontinues its use for this AccessDefinition.

CANCEL The display returns to the SelectTables/Views for AD panel and any dataentered on the prompt is disregarded.

Changes may have been made between the time the primary keyvalues were originally selected and stored, and the current Point-and-Shoot session. Due to these changes, MOVE may be unable to findrows for primary key values saved in the Point-and-Shoot file becausethe rows were deleted or changed in the database. If this occurs,MOVE displays a prompt notifying you of the situation. The numberof rows previously saved in the Point-and-Shoot file are alsodisplayed. The following options are provided:

• Press ENTER to proceed.

• Use END to remove non-matching rows from the Point-and-Shootfile.

• Enter the CANCEL command to terminate the Point-and-Shootsession without modifying the file.

The following sections discuss the facilities that are available during aPoint-and-Shoot session. For more information about the primary andline commands discussed in these sections, see the Relational ToolsCommand Reference Manual.

InterveningChanges

Page 99: Move for DB2 User Guide

3. Specify Access Definitions

User Manual 85

3.5.1 Initial Display for Point-and-Shoot

The initial display for a Point-and-Shoot session is determined by theStart Table defined on the Select Tables/Views for AD panel, anyselection criteria that have been defined for the Start Table, and theBegin Table Display With field on the Access DefinitionParameters panel. The following options are available for the BeginTable Display With field (see Figure 89. Access DefinitionParameters).

D DataBegin with data from the named Start Table and allsubsequent tables. This is the default.

If selection criteria and an SQL WHERE Clause have beenspecified, they are used to limit the data display. Forexample, if you defined selection criteria to select only thecustomers in the state of Massachusetts, only those customersare displayed in the Point-and-Shoot session.

S Criteria for Start Table OnlyBegin with a selection criteria prompt for the named StartTable. All other tables begin with the data display.

A Criteria for All TablesDisplay the selection criteria prompt for the named StartTable and for each table added to the display via the JOINcommand before displaying the data for that table during aPoint-and-Shoot session.

The SELECTION CRITERIA command can be used to display theSpecify Selection Criteria for Table panel at any time during aPoint-and-Shoot session. You can use it to respecify the selectioncriteria for any currently displayed table. The criteria specifiedduring the Point-and-Shoot session is used for the session only and isnot saved permanently in the Access Definition.

The Specify Selection Criteria for Table panel is displayed toprompt for selection criteria. All of the facilities for the SpecifySelection Criteria for AD panel when defining an Access Definitionare available. (For details on this panel see Section 3.4 SpecifyingCriteria.) After specifying the desired selection criteria, use ENTERor END to display the data.

If the selection criteria for the Start Table are changed such that theset of rows in the Point-and-Shoot file are not appropriate, MOVEwill prompt you to specify whether to continue with the session or toretain or discard the previously selected rows.

SELECTIONCRITERIACommand

Selection CriteriaPrompt

Page 100: Move for DB2 User Guide

3. Specify Access Definitions

86 Move for DB2

3.5.2 Point-and-Shoot Basics

A Point-and-Shoot session is very similar to an ISPF/PDF browsesession. However, the ability to select specific rows (and therefore theprimary key values) while browsing DB2 data requires additionalscreen elements and facilities. This section discusses Point-and-Shootscreen elements, commands, and display modes.

There are two basic display formats: columnar and sidelabels.Columnar format is the default format. In columnar format thecolumn headings are displayed across the top of the panel and the datais displayed in columns beneath the headings. Many rows from thetable are displayed:

CUST_ID CUSTNAME ADDRESS CITY STATE ------- -------------------- ==================== ------------ ----- 07053 Replay Video 9032 Dickerson St Amherst MA 07101 Movie Mania 571 Front St Auburn MA 07103 Video Edge 400 Pittsfield Rd Lenox MA

In sidelabels format, the column headings are displayed down the leftside of the panel and the data is displayed to the right of the headings.The display is focused on a single row, however, more columns aredisplayed for that row:

CUST_ID : 07053CUSTNAME : Replay VideoADDRESS : 9032 Dickerson StCITY : AmherstSTATE : MAZIP : 01002YTD_SALES : 123.00SALESMAN_ID : RP0013PHONE_NUMBER : 5171234567

You can toggle between the two display formats by using theSIDELABELS primary command or the SID line command.

Most of the screen examples throughout this manual are shown incolumnar format.

Display Format

Page 101: Move for DB2 User Guide

3. Specify Access Definitions

User Manual 87

3.5.2.1 Screen Elements

The screen elements provided by columnar and sidelabels format arethe same; only the positioning is different.

The following figure highlights some key screen elements displayedduring a typical columnar format edit session.

------------------ Relational Tools: Point-and-Shoot ------- 3 ROWS SELECTEDCommand ===> Scroll ===> CSR

Cmd F == Table: PSTDEMO.CUSTOMERS(T1) ================ 1 OF 20 ===== MORE>> CUST_ID CUSTNAME ADDRESS CITY STATE ------- -------------------- ==================== ------------ -----*** ********************************** TOP ********************************___ S 07053 Replay Video 9032 Dickerson St Amherst MA___ 07101 Movie Mania 571 Front St Auburn MA___ 07103 Video Edge 400 Pittsfield Rd Lenox MA___ S 07118 Movie Store 752 State Rd Menemsha MA___ 07123 Video Way 112 South Moreland A Groton MA___ 07126 Movie Rentals 101 Munson St Greenfield MA___ 07140 Showcase 1150 Indiana Terr Beverly MA___ 07141 Showcase II 57 Rock Hollow Salem MA___ 07156 Prime Tyme 982 Upper State St Marion MA___ S 07160 Reely Great Videos 590 Frontage Rd Amherst MA

Figure 37. Columnar Screen Elements

The same screen elements are displayed when using sidelabels format,however, the location may differ.

------------------ Relational Tools: Point-and-Shoot -------- 3 ROWS SELECTEDCommand ===> Scroll ===> CSR

== Table: PSTDEMO.CUSTOMERS(T1) ================== ROW 1 OF 20 ========== LineCmd ==> ___ Row Status: S COLUMN 1 OF 9

CUST_ID : 07053CUSTNAME : Replay VideoADDRESS = 9032 Dickerson StCITY : AmherstSTATE : MAZIP : 01002YTD_SALES : 123.00SALESMAN_ID : RP0013PHONE_NUMBER : 5171234567

Figure 38. Sidelabels Screen Elements

Columnar Format

Sidelabels Format

Page 102: Move for DB2 User Guide

3. Specify Access Definitions

88 Move for DB2

These elements are:

Column Headings By default, the DB2 column names aredisplayed as the column headings. You canspecify that the DB2 column labels are to beused on the Describe Columns panel. (SeeSection 3.4 Specifying Criteria)

Line Command Field Line command entry field.

Status Flag Field Status flag field identifies which rows havebeen selected by displaying an S in this fieldfor each selected row. In Figure 37.Columnar Screen Elements, three rows havebeen selected.

Table Name The name of the table or view, including theCreator ID, currently displayed. The tablename may be truncated if the combined lengthof the Creator ID and table name exceeds 22characters.

Short Name A short name or identifier for each table (Tn)or view (Vn), where n uniquely identifies thetable or view. For example, in a multi-tabledisplay, T1 identifies the first table, T2 thesecond table, and so on. The Tn or Vn valuecan be used as a command operand in placeof the table name.

Truncated ColumnIndicator

In columnar format, the maximum displaywidth of columns can be in the range of 15 to70 characters. In sidelabels format, themaximum display width can be in the range of50 to 32767. These values are controlled byeditor options and apply to all displayedcolumns. When the width of a column exceedsthis value, the data from that column istruncated. In columnar format, this isindicated by equal signs, =, underlining thecolumn heading. In sidelabels format, an equalsign is displayed to the right of the columnheading. The complete data in these columnscan be displayed using the EXPAND command(see page 98 for details).

Row Count Indicates the current position within the totalset of rows. The total row count includes theline the 'Excluded Lines' message is on but

Page 103: Move for DB2 User Guide

3. Specify Access Definitions

User Manual 89

not the excluded lines themselves.

Horizontal ScrollIndicator

(Displayed in columnar format only.)Indicates that more data is displayed to theleft, <<MORE, or right, MORE>>. Usethe LEFT and RIGHT commands, usuallyassigned to PF10 and PF11, to scroll thedisplay horizontally. (For more informationon scrolling see Section 3.5.4 ScrollingData.)

Column Count Displayed in sidelabels format only.Indicates the current position within thetotal set of columns.

The number of rows selected from the Start Table to be used for anExtract Process is always displayed in the upper right-hand corner ofthe screen. In Figure 37. Columnar Screen Elements, three rowshave been selected.

When the number of rows to be displayed exceeds the availablenumber of lines on the screen, the rows can be scrolled verticallyusing the UP and DOWN commands (usually assigned to PF7 andPF8). When all of the columns do not fit on the screen, the displaycan be scrolled horizontally using the RIGHT and LEFT commands(usually assigned to PF10 and PF11). These commands perform thesame functions in both columnar and sidelabels format.

In columnar format, sufficient screen space must be available toaccommodate the display width of a column. When the specifieddisplay width of the column exceeds the available space, the column isnot displayed on the current screen. Scroll left or right as appropriate.For example, if the display width of a column is 20 characters butonly 10 spaces are available, that column is omitted from the display.The column can be displayed by scrolling right.

In sidelabels format, if insufficient space is available, partial columnsmay be displayed.

When the Maximum Fetch Limit is less than the total number of rowsthat satisfy the criteria, a message displays indicating that all possiblerows have not been retrieved. You can use the COUNT command todisplay the total number of rows in a named table that satisfies thesearch criteria. You can respecify the selection criteria to retrievefewer rows.

To view all the rows that satisfy the current search criteria, you canincrease the maximum number of retrieved rows using the MAXROWS command. For example, if your Maximum Fetch Limit is 200

Screen SizeConsiderations

COUNT Command

MAX ROWSCommand

Page 104: Move for DB2 User Guide

3. Specify Access Definitions

90 Move for DB2

rows, and the COUNT command shows that there are 300 rows thatsatisfy the criteria, you can use the MAX ROWS command to changethe Maximum Fetch Limit to 300. Specify MAX ROWS 300 andrefetch. This command only affects the current session. To increasethe maximum number of fetch rows for all of your sessions, use theMaximum Fetch Rows option on the Editor and Display Optionspanel.

3.5.2.2 Displaying Column Attributes

When selecting rows to be extracted, it may be helpful to display theattributes of the columns. During a Point-and-Shoot session, you can usethe ATTRIBUTES command to specify whether column attributes aredisplayed. Alternatively, you can set the option Display ColumnAttributes on the Editor and Display Options panel. The columnattributes include the data type, length, and nullability of the column.They are displayed directly beneath the column name.

----------------- Relational Tools: Point-and-Shoot -------- 3 ROWS SELECTED Command ===> Scroll ===> CSR

Cmd F == Table: PSTDEMO.CUSTOMERS(T1) =================== 1 OF 20 === MORE>> CUST_ID CUSTNAME ADDRESS CITY STATE -CH(5)- -------CH(20)------- ======VCH(50)====== ---VCH(15)--- -CH(2)- *** ********************************* TOP ********************************** ___ S 07053 Replay Video 9032 Dickerson St Amherst MA ___ 07101 Movie Mania 571 Front St Auburn MA

Figure 39. Column Attributes Displayed

The format of the attribute information is type(n.n):N, where type is thedata type and n.n is the length of the column. The presence of :Nindicates nullability. To conserve space on the screen, certain data typesare abbreviated. The data type indicators and the DB2 data types thatthey represent are listed below.

Indicator

CHVCHLVRDECINTSMALLINTDATETIMETIMESTAMPSNGL FLOATDBL FLOAT

DB2 Data Type

CHARVARCHARLONG VARCHARDECIMALINTEGERSMALLINTDATETIMETIMESTAMPSINGLE FLOATDOUBLE FLOAT

Page 105: Move for DB2 User Guide

3. Specify Access Definitions

User Manual 91

When the attributes mode is activated, attributes are displayed regardlessof the display mode in effect (columnar, sidelabels, or hex mode).

To remove the column attributes from the display, use theATTRIBUTES OFF command or use the ATTRIBUTES commandwith no operand to toggle between displaying and not displayingcolumn attributes.

3.5.2.3 Available Commands

Both primary and line commands are available. Many of thesecommands are introduced in the following sections. Detailedinformation about each command is provided in the Relational ToolsCommand Reference Manual.

The following is a list of primary commands available during a Point-and-Shoot session.

ANCHORATTRIBUTESBOTTOMCANCELCAPSCOLUMNSCOUNTDOWNENDEXCLUDEEXPANDFINDHEX

JOIN LEFT LIST LOCK MAX FETCH ROWS ONLY OPTIONS REPORT RESET RESORT RFIND RIGHT SEL CRITERIA

SELECT RELATED SHOW SHOW SQL SIDELABELS SORT SQL START TOP UNJOIN UNLOCK UNSELECT RELATED UP ZOOM

The JOIN, UNJOIN, and START commands are not available whenusing sidelabels format.

The following line commands are available during a Point-and-Shootsession.

Function Line Command

Exclude X, Xn, XX First F, Fn Join J Last L, Ln Select Related SR, SSR Show S, SS Sidelabels SID Unselect Related UR, UUR Unjoin UNJ

PrimaryCommands

Line Commands

Page 106: Move for DB2 User Guide

3. Specify Access Definitions

92 Move for DB2

Zoom Z

The J and UNJ line commands are not available when using sidelabelsformat.

3.5.3 Selecting Rows

Rows are selected from the Start Table using the Select Related linecommands or the SELECT RELATED primary command. Forexample, in the following figure rows are selected by specifying theSR and SSR line commands.

------------------- Relational Tools: Point-and-Shoot -------- 3 ROWS SELECTEDCommand ===> Scroll ===> CSR

Cmd F == Table: PSTDEMO.CUSTOMERS(T1) ================= 1 OF 20 ===== MORE>> CUST_ID CUSTNAME ADDRESS CITY STATE ------- -------------------- ==================== ------------ -----*** *********************************** TOP ********************************___ S 07053 Replay Video 9032 Dickerson St Amherst MAsr_ 07101 Movie Mania 571 Front St Auburn MA___ 07103 Video Edge 400 Pittsfield Rd Lenox MA___ S 07118 Movie Store 752 State Rd Menemsha MA___ 07123 Video Way 112 South Moreland A Groton MAssr 07126 Movie Rentals 101 Munson St Greenfield MA___ 07140 Showcase 1150 Indiana Terr Beverly MA___ 07141 Showcase II 57 Rock Hollow Salem MAssr 07156 Prime Tyme 982 Upper State St Marion MA___ S 07160 Reely Great Videos 590 Frontage Rd Amherst MA

Figure 40. Selecting Primary Key Values

Rows can also be selected using the SELECT RELATED primarycommand. For example, to select all customers in the city ofAmherst, the command can be entered as:

SELECT RELATED IN CITY ALL AMHERST

Individual rows that have been selected can be unselected using theUnselect Related line command or the UNSELECT RELATEDprimary command. In the following figure, the last selected row,Reely Great Videos is unselected.

Page 107: Move for DB2 User Guide

3. Specify Access Definitions

User Manual 93

------------------- Relational Tools: Point-and-Shoot -------- 8 ROWS SELECTEDCommand ===> Scroll ===> CSR

Cmd F == Table: PSTDEMO.CUSTOMERS(T1) ================= 1 OF 20 ===== MORE>> CUST_ID CUSTNAME ADDRESS CITY STATE ------- -------------------- ==================== ------------ -----*** *********************************** TOP ********************************___ S 07053 Replay Video 9032 Dickerson St Amherst MA___ S 07101 Movie Mania 571 Front St Auburn MA___ 07103 Video Edge 400 Pittsfield Rd Lenox MA___ S 07118 Movie Store 752 State Rd Menemsha MA___ 07123 Video Way 112 South Moreland A Groton MA___ S 07126 Movie Rentals 101 Munson St Greenfield MA___ S 07140 Showcase 1150 Indiana Terr Beverly MA___ S 07141 Showcase II 57 Rock Hollow Salem MA___ S 07156 Prime Tyme 982 Upper State St Marion MAUR_ S 07160 Reely Great Videos 590 Frontage Rd Amherst MA

Figure 41. Unselecting Primary Key Values

Only rows in the Start Table can be directly selected and unselected.However, the related rows from the other tables included in theExtract Process will also be extracted if the related Start Table row isextracted.

3.5.4 Scrolling Data

Several commands are available to scroll the data. You can scrollvertically when the number of rows to display exceeds the number oflines available on the screen. You can scroll horizontally when thewidth of the data exceeds the width of the screen.

3.5.4.1 Vertical Scrolling

The scrolling commands UP, DOWN, TOP, and BOTTOM may beentered on the command line or assigned to program function keys.The ISPF SCROLL field values, CSR, PAGE, DATA, HALF, MAX,and n (where n is the number of lines to scroll) are supported.

When a single table is displayed, vertical scrolling works identicallyto vertical scrolling in ISPF. Scrolling a multi-table display isdiscussed in Section 3.5.11.2 Coordinated Scroll.

3.5.4.2 Horizontal Scrolling

During a Point-and-Shoot session, the columns to be displayed maynot all fit on the screen. When the combined width of the columnsexceeds the width of the screen, the scroll indicator, MORE and anappropriate direction arrow, are displayed on the information line forthe table.

Page 108: Move for DB2 User Guide

3. Specify Access Definitions

94 Move for DB2

You can scroll horizontally using LEFT and RIGHT to display theremaining columns. Operands for these commands enable you toscroll by column name, numeric value, or cursor position.

When multiple tables are displayed, indicate which table to scroll byspecifying a table name or identifier with the column name (forexample, T2.CUST_ID) or by cursor position. If a table is notindicated, the lowest level table is scrolled.

3.5.4.3 Locking Columns for Horizontal Scrolling

The LOCK and UNLOCK commands can be used to retain specifiedcolumns on the screen when scrolling left and right. The LOCKcommand repositions the named column to the left of the screen andretains the column in that position when a horizontal scroll isperformed. Multiple columns may be locked. The UNLOCKcommand unlocks the named locked column and returns it to theoriginal position.

For example, assume that the combined width of the displayed columndata for the CUSTOMERS table exceeds the width of the screen,therefore the display must be scrolled left and right to view all of thedata. By locking the column named CUSTNAME, the remainingcolumns in the CUSTOMERS table can be scrolled left or right, butCUSTNAME will always remain on the screen.

Assume that the LOCK command has been entered to retain theCUSTNAME column on the display. The column is repositioned tothe left of the display and is retained in that position regardless of leftand right scrolling.

------------------ Relational Tools: Point-and-Shoot --------- 7 ROWS SELECTED Command ===> Scroll ===> CSR

Cmd F == Table: PSTDEMO.CUSTOMERS(T1) ==================== 1 OF 20 === MORE>> CUSTNAME CUST_ID ADDRESS CITY STATE ++++++++++++++++++++ ------- ==================== --------------- ----- *** ********************************* TOP *********************************** ___ S Replay Video 07053 9032 Dickerson St Amherst MA ___ S Movie Mania 07101 571 Front St Auburn MA ___ Video Edge 07103 400 Pittsfield Rd Lenox MA ___ S Movie Store 07118 752 State Rd Menemsha MA ___ Video Way 07123 112 South Moreland A Groton MA ___ S Movie Rentals 07126 101 Munson St Greenfield MA ___ S Showcase 07140 1150 Indiana Terr Beverly MA ___ S Showcase II 07141 57 Rock Hollow Salem MA ___ S Prime Tyme 07156 982 Upper State St Marion MA ___ Reely Great Videos 07160 590 Frontage Rd Amherst MA

Figure 42. Repositioned Locked Column

Page 109: Move for DB2 User Guide

3. Specify Access Definitions

User Manual 95

The locked column is identified by a series of plus signs, +, under thecolumn heading. The first locked column is placed in the left-mostposition. Each succeeding locked column is positioned to the right ofthe previously locked columns.

When the length of a column exceeds the maximum column displaywidth, that column is indicated by equal signs, =, under the columnheading. If that column is also locked, it is identified by a series ofdots under the column heading to distinguish it from the lockedcolumns that are not truncated. (For more information on handlingthis truncated data, see Section 3.5.7 Expanding Truncated Data.)

Any series of columns may be locked as long as enough space remainsto display the widest column that is not locked yet in addition to thelocked columns. The reserved area is determined by the user-definedmaximum display width for any column. For example, if the user-defined maximum display width is 20 characters, then the right-most21 character positions on the screen are reserved for unlockedcolumns. This ensures that at least one unlocked column is alwaysdisplayed. More columns may be displayed if they fit, in theirentirety, in the remaining area.

Use LOCK KEY to lock all of the columns that compose the primarykey in a single command execution.

The UNLOCK command with no operands unlocks all of the lockedcolumns. Specify the name of the column with the command tounlock only that column.

If it is desirable to rearrange the display order of the columns, use theCOLUMNS command to modify the column display attributes. TheCOLUMNS command displays the Describe Columns panel,discussed in Section 3.4 Specifying Criteria.

3.5.5 Excluding Rows

When a large number of rows are displayed, it can be very useful toexclude some of those rows from the display leaving a moremanageable set. The EXCLUDE primary command and the Excludeline commands can be used to remove any lines from the display.These rows are retained in the table, but are not displayed. In thefollowing figure the Exclude line command is used.

Identifying LockedColumns

Locking MultipleColumns

UnlockingColumns

Page 110: Move for DB2 User Guide

3. Specify Access Definitions

96 Move for DB2

------------------- Relational Tools: Point-and-Shoot ------- 7 ROWS SELECTEDCommand ===> Scroll ===> CSR

Cmd F == Table: PSTDEMO.CUSTOMERS(T1) ==================== 1 OF 20 == MORE>> CUST_ID CUSTNAME ADDRESS CITY STATE ------- -------------------- ==================== ----------- -----*** ********************************** TOP **********************************___ S 07053 Replay Video 9032 Dickerson St Amherst MA___ S 07101 Movie Mania 572 Front St Auburn MA___ 07103 Video Edge 400 Pittsfield Rd Lenox MA___ S 07118 Movie Store 752 State Rd Menemsha MA___ 07123 Video Way 112 South Moreland A Groton MA___ S 07126 Movie Rentals 101 Munson St Greenfield MA___ S 07140 Showcase 1150 Indiana Terr Beverly MA___ S 07141 Showcase II 57 Rock Hollow Salem MAxx_ S 07156 Prime Tyme 982 Upper State St Marion MA___ 07160 Reely Great Videos 590 Frontage Rd Amherst MAxx_ 07189 Showtime 322 Rt 28 Hyannis MA___ 07191 Popcorn 15 Crystal Park Lenox MA___ 07198 Video-tron Inc. 100 West Street Brookline MA

Figure 43. Excluding Rows

The excluded rows are replaced with a message indicating the locationand number of excluded rows.

-------------------- Relational Tools: Point-and-Shoot ------ 7 ROWS SELECTEDCommand ===> Scroll ===> CSR

Cmd F == Table: PSTDEMO.CUSTOMERS(T1) ================== 1 OF 18 == MORE>> CUST_ID CUSTNAME ADDRESS CITY STATE ------- -------------------- ==================== ----------- -----*** ********************************** TOP **********************************___ S 07053 Replay Video 9032 Dickerson St Amherst MA___ S 07101 Movie Mania 572 Front St Auburn MA___ 07103 Video Edge 400 Pittsfield Rd Lenox MA___ S 07118 Movie Store 752 State Rd Menemsha MA___ 07123 Video Way 112 South Moreland A Groton MA___ S 07126 Movie Rentals 101 Munson St Greenfield MA___ S 07140 Showcase 1150 Indiana Terr Beverly MA___ S 07141 Showcase II 57 Rock Hollow Salem MA___ --------------------------------------------------- 3 LINE(S) EXCLUDED___ 07191 Popcorn 15 Crystal Park Lenox MA___ 07198 Video-tron Inc. 100 West Street Brookline MA___ 07201 Movie Buff 400 Merrimac Ave Concord MA___ 07203 Movies-R-Us 1772 Bridge St Bourne MA

Figure 44. Excluded Rows Message

Note that the row count changes to reflect the excluded lines. Theexcluded lines message counts as one line.

The EXCLUDE primary command can be used to exclude rowsglobally based on a variety of criteria.

The excluded rows can be redisplayed with the SHOW primarycommand or the Show (S), First (F), or Last (L) line commands.

Page 111: Move for DB2 User Guide

3. Specify Access Definitions

User Manual 97

3.5.6 Finding Specific Data

The FIND command and the ONLY command are available to locatespecific data.

The FIND command locates a row containing a specified value andpositions the cursor to that row. If the row is not currently displayed,it is scrolled to the top of the display in the window of the searchedtable. In a multiple table display, any lower level tables that aredisplayed are automatically scrolled appropriately.

A variety of operands are available for the FIND command to specifywhere the search should begin and whether the search should includeexcluded rows. The FIND command is similar to the ISPF FINDcommand. However, the MOVE FIND command has been extendedto support DB2 data. For example, to locate the first occurrence ofthe string MA in the STATE column, enter:

FIND FIRST MA IN STATE

If the column name is omitted, all columns with an appropriate datatype as the search string are searched. A table name should beentered if the column name is present in more than one displayedtable. Otherwise, the lowest level displayed table is searched.

In the previous example, the search string, MA, will match MA, ma,Ma, and mA. To ensure a case-sensitive search, enclose the string inapostrophes preceded by a C as in, C'MA'.

To include blanks or embedded apostrophes in the search string,enclose the string in quotation marks as in "M' A". If the searchstring includes quotation marks, use apostrophes as in 'M"A'.

The FIND ALL command is useful when issued after excluding allrows, to display all occurrences of the specified character string. Forexample, to display all rows containing "AMHERST" specify:

EXCLUDE ALLFIND ALL AMHERST

The only command provides in one command the results obtainedfrom executing EXCLUDE ALL followed by FIND ALL. Forexample, to display all rows containing "AMHERST" specify:

ONLY AMHERST

You can limit the search to a specific column. For example, to limitthe search to the CITY column specify:

ONLY AMHERST IN CITY

FIND Command

FIND ALL

ONLY Command

Page 112: Move for DB2 User Guide

3. Specify Access Definitions

98 Move for DB2

As with EXCLUDE and FIND, use the SHOW command to displayexcluded rows.

3.5.7 Expanding Truncated Data

When the actual column width exceeds the user-specified maximumcolumn display width, the data in that column is truncated. Suchcolumns are identified by a series of equal signs, =, under the columnheading or, in sidelabels format, by an equal sign to the right of thecolumn name. For example, the ADDRESS column is defined toDB2 as 50 characters. This exceeds the maximum display width of20 characters defined in the editor options. To display all of the datain the column, you can change the column display width or expand thecolumn.

The maximum column display width can be changed on the Editorand Display Options panel. The maximum display width must begreater than or equal to 15 and less than or equal to 70 characters forcolumnar display. (The value specified for sidelabels display must begreater than or equal to 50 and less than or equal to 32767.) Use theOPTIONS EDITOR command to display the Editor and DisplayOptions panel.

When the maximum width does not provide sufficient display spacefor a specific column or changing the maximum display width isundesirable, the EXPAND primary command can be used to displayall of the data in that column. This command can be used on datatypes of CHAR, VARCHAR, and LONG VARCHAR, even if thelength of the data does not exceed the maximum display width. Thiscommand can be used on data types of TIMESTAMP and DECIMALonly if the data exceeds the maximum display width.

------------------- Relational Tools: Point-and-Shoot ------- 7 ROWS SELECTEDCommand ===> EXPAND Scroll ===> CSR

Cmd F == Table: PSTDEMO.CUSTOMERS(T1) ==================== 1 OF 20 === MORE>> CUST_ID CUSTNAME ADDRESS CITY STATE ------- -------------------- ==================== --------------- -----*** ********************************** TOP **********************************___ S 07053 Replay Video 9032 Dickerson St Amherst MA___ S 07101 Movie Mania 571 Front St Auburn MA___ 07103 Video Edge 400 Pittsfield Rd Lenox MA___ S 07118 Movie Store 752 State Rd Menemsha MA___ 07123 Video Way 112 South Moreland A Groton MA___ S 07126 Movie Rentals 101 Munson St Greenfield MA___ S 07140 Showcase 1150 Indiana Terr Beverly MA___ S 07141 Showcase II 57 Rock Hollow Salem MA___ S 07156 Prime Tyme 982 Upper State St Marion MA___ 07160 Reely Great Videos 590 Frontage Rd Amherst MA

Figure 45. Expanding When Length Exceeds Display Width

Page 113: Move for DB2 User Guide

3. Specify Access Definitions

User Manual 99

The EXPAND command is cursor sensitive. You can type theEXPAND command on the command line as shown above, positionthe cursor to the column in the row to be expanded, and pressENTER. You can also assign EXPAND to a program function key.

If the EXPAND command is entered in the command field and thecursor is positioned on the ADDRESS column of the customer namedVideo Way, the following pop-up is displayed.

------------------ Relational Tools: Point-and-Shoot --------- 7 ROWS SELECTEDCommand ===> Scroll ===> PAGE

Cmd F == Table: PSTDEMO.CUSTOMERS(T1) ===================== 1 OF 20 === MORE>> CUST_ID CUSTNAME ADDRESS CITY STATE ------- ------------------- ==================== ----------------- -----*** ********************************** TOP ***********************************___ S 07053 Replay Video 9032 Dickerson St Amherst MA___ S 07101 Movie Mania 571 Front St Auburn MA___ 0 MA___ S +-Cmd-F-----------------(ADDRESS) Width: 50-----------------5 of 20-+ MA___ | | MA___ S | ___ ----+----1----+----2----+----3----+----4----+----5 | MA___ S | ___ 112 South Moreland Avenue | MA___ S | | MA___ S +Col 1 ----------------------------------------------------- Col 50-+ MA___ MA

Figure 46. Expanded Column Display

The column name and the actual length are displayed on the topborderline. The row count indicator is also displayed.

When the column length exceeds the width of the expanded display,66 characters, the data can be scrolled horizontally using the LEFTand RIGHT commands. The starting and ending column positionscurrently displayed are indicated on the bottom border of the window.

The following line commands can be used to scroll left and right:

>nn+nn<nn-nn

Scroll right nn spacesScroll right nn spaces.Scroll left nn spacesScroll left nn spaces

Use the UP and DOWN commands to scroll the data in the expandedwindow by row. The row counter displayed on the top border of thewindow indicates which row is currently displayed.

When you have finished viewing the expanded data, use END toterminate the expanded display.

Scrolling

Page 114: Move for DB2 User Guide

3. Specify Access Definitions

100 Move for DB2

3.5.8 Displaying Hexadecimal Data

Under certain circumstances, you may find it necessary to display thehexadecimal (or hex) value of data. Use the HEX primary commandto display each line of data in the standard text format and itshexadecimal representation. Note that the hexadecimal representationis displayed only for character data type columns. The hex displayremains in effect until explicitly terminated by specifying HEX again.

When data is displayed in hex mode, each row of data uses three lineson the display. The first line is the text representation of the data.The second and third lines are the same data displayed in hex format.The two digits making up the hex representation of each EBCDICcharacter are displayed directly under that character, as shown in thefollowing figure.

-------------------- Relational Tools: Point-and-Shoot ------- 7 ROWS SELECTED Command ===> Scroll ===> CSR

Cmd F == Table: PSTDEMO.CUSTOMERS(T1) ==================== 1 OF 20 === MORE>> CUST_ID CUSTNAME ADDRESS CITY STATE ------- -------------------- ==================== --------------- ----- *** ********************************** TOP ********************************** ___ 07053 Replay Video 9032 Dickerson St Amherst MA FFFFF D8998A4E888944444444 FFFF4C88989A994EA000 C9889AA00000000 DC 07053 95731805945600000000 90320493259265023000 148592300000000 41 ___ 07101 Movie Mania 571 Front St Auburn MA FFFFF D9A884D8988444444444 FFF4C999A4EA00000000 CA8A99000000000 DC 07101 46595041591000000000 57106965302300000000 142495000000000 41 ___ 07103 Video Edge 400 Pittsfield Rd Lenox MA FFFFF E88894C8884444444444 FFF4D8AAA888984D8000 D899A0000000000 DC 07103 59456054750000000000 40007933269534094000 355670000000000 41 ___ 07118 Movie Store 752 State Rd Menemsha MA FFFFF D9A884EA998444444444 FFF4EA8A84D800000000 D8989A880000000 DC 07118 46595023695000000000 75202313509400000000 455542810000000 41 ___ 07123 Video Way 112 South Moreland A Groton MA FFFFF E88894E8A44444444444 FFF4E9AA84D99898984C C99A99000000000 DC 07123 59456061800000000000 11202643804695315401 796365000000000 41

Figure 47. Hexadecimal Values Displayed

The same line commands and primary commands that are available instandard display mode are available in hex mode. Some commands,such as the FIND command, have operands specifically for hex mode.

To locate a specific hex value anywhere in the data, use the FINDcommand with the HEX operand. This is useful when you want tolocate a non-displayable value. For example, to locate the firstoccurrence of the hex value 00, enter FIND HEX 00.

To locate the next occurrence of the search value, 00 in this case, usethe RFIND command (usually assigned to PF5).

FIND Command

Page 115: Move for DB2 User Guide

3. Specify Access Definitions

User Manual 101

Trailing blanks in CHAR columns are stored in the database asblanks. They are displayed in hex mode as the hex value 40. Trailingblanks in VARCHAR columns are not stored in the database. Theyare displayed in hex mode as the hex value 00.

3.5.9 Using Sidelabels Format

When browsing tables that contain many columns or wide columns,you may find it useful to use the sidelabels format instead of thestandard columnar format. The sidelabels format displays columnheadings vertically at the left of the panel, followed by the data foreach column. Generally, this format displays more columns per paneland more data per row. However, only a single row in a single tableis displayed at one time.

You can change from columnar format to sidelabels format byentering the SIDELABELS primary command, SID line command, orby specifying sidelabels format on the Editor and Display Optionspanel. The SIDELABELS command acts as a toggle between the twodisplay formats. Once you specify sidelabels format, whether by thecommand or from the options panel, it remains in effect until yourespecify the format.

A sample sidelabels display is shown in the following figure.

------------------ Relational Tools: Point-and-Shoot -------- 0 ROWS SELECTEDCommand ===> Scroll ===> CSR

== Table: PSTDEMO.SHIP_INSTR(T1) =================== ROW 13 OF 120 ========== LineCmd ==> ___ Row Status: COLUMN 1 OF 4

SHIP_ID : 106SHIP_INSTR_ID : 10013ORDER_SHIP_INSTR = Federal Express. This is the third time this orde (51 - 100) = r has been sent. Customer claims that first two orSHIP_UPDATED : 1999-03-09-11.04.27.000000********************************** BOTTOM ************************************

Figure 48. Sidelabels Display

3.5.9.1 Scrolling

Use UP or DOWN (usually assigned to PF7 and PF8) to scroll to theprevious or next row in the table. When all of the columns in the rowdo not fit on a single screen, use LEFT or RIGHT (usually assignedto PF10 and PF11) to scroll up or down to display the remainingcolumns in the same row.

Trailing Blanksand Nulls

Page 116: Move for DB2 User Guide

3. Specify Access Definitions

102 Move for DB2

You can lock one or more columns using the LOCK command. Thelocked columns are positioned to the beginning of the display andremain in that position when the display is scrolled. For example, ifLOCK SHIP_UPDATED is entered on the command line, theSHIP_UPDATED column is positioned to the beginning of thedisplay and is marked with a plus sign, +, as shown in the followingfigure.

-------------------- Relational Tools: Point-and-Shoot ------- 0 ROWS SELECTED Command ===> Scroll ===> CSR

== Table: PSTDEMO.SHIP_INSTR(T1) =================== ROW 13 OF 120 ======= == LineCmd ==> ___ Row Status: COLUMN 1 OF 4

SHIP_UPDATED + 1999-03-09-11.04.27.000000 SHIP_ID : 106 SHIP_INSTR_ID : 10013 ORDER_SHIP_INSTR = Federal Express. This is the third time this orde (51 - 100) = r has been sent. Customer claims that first two or*********************************** BOTTOM ***********************************

Figure 49. Locked SHIP_UPDATED Column

The UNLOCK command with no operands unlocks all of the lockedcolumns. Specify the name of a column with the command to unlockonly that column.

3.5.9.2 Displaying Wide Data

When the maximum display width permits, wide rows areautomatically wrapped for the width of the column. For example, inFigure 48. Sidelabels Display, the ORDER_SHIP_INSTR columncontains more characters than fit on one line. The data is divided into50-character segments and presented on multiple lines. Although, thecolumn ORDER_SHIP_INSTR is 254 characters long, only 100characters (the maximum display width in this example), aredisplayed. The truncated data indicator, =, is shown.

The maximum column display width is specified by the SidelabelsMax Display Width option on the Editor and Display Optionspanel. You can use the OPTIONS EDITOR command to display thispanel. The minimum is 50 characters; the maximum is 32767characters.

Locking a Column

Column DisplayWidth Option

Page 117: Move for DB2 User Guide

3. Specify Access Definitions

User Manual 103

Assuming the maximum display width value is changed to 254, thedata in the ORDER_SHIP_INSTR column is no longer truncated asindicated by the colon replacing the equal sign in the following figure.

--------------------- Relational Tools: Point-and-Shoot ------ 0 ROWS SELECTEDCommand ===> Scroll ===> CSR

== Table: PSTDEMO.SHIP_INSTR(T1) ==================== ROW 13 OF 120 ========= LineCmd ==> ___ Row Status: COLUMN 1 OF 4

SHIP_ID : 106SHIP_INSTR_ID : 10013ORDER_SHIP_INSTR : Federal Express. This is the third time this orde (51 - 100) : r has been sent. Customer claims that first two or (101 - 150) : ders never arrived at store. Make sure customer s (151 - 200) : igns for package. (201 - 250) : (251 - 254) :SHIP_UPDATED : 1999-03-09-11.04.27.000000************************************ BOTTOM **********************************

Figure 50. Column Wrapping

The column data begins to the right of the column name andcontinues, in 50-character segments, on the next five lines. Thebeginning and ending character positions of each segment aredisplayed under the column heading.

For VARCHAR columns, the entire column is displayed regardless ofthe actual length of the data. However, when a table has several widecolumns that do not contain correspondingly long data, you mayprefer to decrease the maximum display width so that more columnsfrom the table are displayed per screen.

Instead of changing the maximum display width to display all of thedata in the column, you can use the EXPAND command to displaythe column in an expanded window. Type the EXPAND command atthe command prompt, place the cursor anywhere in the column to beexpanded, and press ENTER.

EXPANDCommand

Page 118: Move for DB2 User Guide

3. Specify Access Definitions

104 Move for DB2

The displayed data is dependent upon the cursor location when thecommand is entered. In the following example, the cursor waspositioned at the beginning of the first line of data in the column or inthe column name field of the column ORDER_SHIP_INSTR whenthe EXPAND command was entered.

-------------------- Relational Tools: Point-and-Shoot ------- 0 ROWS SELECTEDCommand ===>===> Scroll ===> CSR

== Table: PSTDEMO.SHIP_INSTR(T1) ==================== ROW 13 OF 120 ========= LineCmd ==> ___ Row Status: COLUMN 1 OF 4

SHIP_ID : 106SHIP_INSTR_ID : 10013ORDER_SHIP_INSTR = Federal Express. This is the third time this orde

+-Cmd-F-------------------(ORDER_SHIP_INSTR) Width: 254-----------13 of 120-+ | | | ----+----1----+----2----+----3----+----4----+----5----+----6----+- | | ___ Federal Express. This is the third time this order has been sent. | | | +Col: 1-------------------------------------------------------------Col: 66-+

Figure 51. Using EXPAND in Sidelabels Format

If you position the cursor on another line containing data from thecolumn, the expanded display begins with the data on that line. Forexample, if the cursor is positioned on the second line of a wrappedcolumn, the expanded display starts at position 51. When the widthof the column exceeds the width of the window, the beginning andending position of the expanded data is displayed on the bottom of theexpanded window.

Use RIGHT and LEFT to scroll the data within the column.

Use the UP and DOWN commands to scroll the data in the expandedwindow by row. The row counter on the top border of the windowindicates which row is currently displayed.

Use END or CANCEL to terminate the expanded window display.

3.5.9.3 Considerations When Using Sidelabels

For the most part, the facilities available for columnar display areavailable during sidelabels. However, several differences should benoted.

Page 119: Move for DB2 User Guide

3. Specify Access Definitions

User Manual 105

When the ATTRIBUTES command is used, the column attributes aredisplayed to the left of the column names. When there is insufficientspace available to display both the attributes and the full columnnames, column names are truncated.

------------------ Relational Tools: Point-and-Shoot --------- 0 ROWS SELECTEDCommand ===> Scroll ===> CSR

== Table: PSTDEMO.SHIP_INSTR(T1) =================== ROW 13 OF 120 ========== LineCmd ==> ___ Row Status: COLUMN 1 OF 4

SMALLINT:N SHIP_ID : 106DEC(5,0):N SHIP_INSTR_ID : 10013VCH(254):N ORDER_SHIP_INST = Federal Express. This is the third time this orde (51 - 100) = r has been sent. Customer claims that first two or (101 - 150): ders never arrived at store. Make sure customer s (151 - 200): igns for package. (201 - 250): (251 - 254):TIMESTAMP SHIP_UPDATED : 1999-03-09-11.04.27.000000*********************************** BOTTOM ************************************

Figure 52. Attributes in Sidelabels Format

For more information on attributes, see Section 3.5.2.2 DisplayingColumn Attributes.

The line commands available in columnar format are available insidelabels format. However, since only a single row is displayed at atime in sidelabels format, some line commands are better suited forstandard columnar format.

You cannot issue the JOIN command while in sidelabels format, sincethis format accommodates one table at a time. However, if multipletables are already joined in columnar format, you can specify anyjoined table as the target of the SIDELABELS command. If the tablename is omitted, the lowest level table is displayed in sidelabelsformat. You can specify the table name or short name (for example,T1). During the sidelabels display, the joined tables are retained andredisplayed when you return to columnar format.

You can display any currently joined table using the ZOOMcommand from the sidelabels display.

ATTRIBUTESCommand

Line Commands

Join Restricted

Zoom

Page 120: Move for DB2 User Guide

3. Specify Access Definitions

106 Move for DB2

3.5.10 Joining Tables

The Point-and-Shoot session begins with the specified set of rowsfrom the table defined as the Start Table. Additional tables in theAccess Definition may be added to the display through a joinoperation. The currently displayed table, or anchor table, is joined toa related table and the related rows from that table are displayed.Data from the newly joined table is displayed at the bottom of thescreen. This table is referred to as the lowest level displayed table. Ajoin is always performed with the lowest level displayed table.

To perform a join, MOVE requires the name of the table to join and arelationship between the named table and the anchor table. Therelationship may be defined in the DB2 Catalog or in the PrincetonSoftech Directory.

When joining tables, it does not matter which table is the parent andwhich is the child. You can join from the parent to the child or fromthe child to the parent.

The JOIN primary command or the Join line command is used to jointables. You can specify a table name with the JOIN command or omitthe table name to generate a selection list of related tables in theAccess Definition.

3.5.10.1 One Related Table

When the Access Definition contains only one table that is related tothe anchor table, you can enter the JOIN command with or withoutthat table name to automatically join to that table. For example, if anAccess Definition contains the CUSTOMERS table and the ORDERStable and these two tables are related, a join can be performed toinclude the ORDERS table on the display.

JoinRequirements

JOIN Command

Page 121: Move for DB2 User Guide

3. Specify Access Definitions

User Manual 107

In the following figure, the JOIN ORDERS command is entered onthe command line and the cursor is positioned on the row forCUST_ID 07118. The JOIN command could also have been enteredwithout the table name.

------------------- Relational Tools: Point-and-Shoot -------- 7 ROWS SELECTEDCommand ===> join orders Scroll ===> CSR

Cmd F == Table: PSTDEMO.CUSTOMERS(T1) ===================== 1 OF 20 === MORE>> CUST_ID CUSTNAME ADDRESS CITY STATE ------- -------------------- ==================== --------------- -----*** ********************************** TOP ***********************************___ S 07053 Replay Video 9032 Dickerson St Amherst MA___ S 07101 Movie Mania 571 Front St Auburn MA___ 07103 Video Edge 400 Pittsfield Rd Lenox MAnn__ S 07118 Movie Store 752 State Rd Menemsha MA___ 07123 Video Way 112 South Moreland A Groton MA___ S 07126 Movie Rentals 101 Munson St Greenfield MA___ S 07140 Showcase 1150 Indiana Terr Beverly MA___ S 07141 Showcase II 57 Rock Hollow Salem MA___ S 07156 Prime Tyme 982 Upper State St Marion MA___ 07160 Reely Great Videos 590 Frontage Rd Amherst MA___ 07189 Showtime 322 Rt 28 Hyannis MA___ 07191 Popcorn 15 Crystal Park Lenox MA___ 07198 Video-tron 100 West Street Brookline MA___ 07201 Movie Buff 400 Merrimac Ave Concord MA___ 07203 Movies-R-Us 1772 Bridge St Bourne MA___ 07235 Jack's Grafton Plaza Grafton MA___ 07242 Video Rental 523 Maple St Boston MA___ 07367 Movie Rentals 7853 Green St Amherst MA___ 07950 Sir Video Inc 11 Midstate Dr Auburn MA___ 07960 Top Hat Video 972 Vine St Boston MA*** ******************************** BOTTOM **********************************

Figure 53. Using JOIN Command

In this example, only one relationship is defined between theCUSTOMERS and ORDERS tables. The CUST_ID column is theprimary key in the CUSTOMERS table and the related column in theORDERS table.

Page 122: Move for DB2 User Guide

3. Specify Access Definitions

108 Move for DB2

When ENTER is pressed, the two tables are joined as shown in thefollowing figure. Since the join was specified for CUST_ID 07118,all of the rows in the ORDERS table having that CUST_ID aredisplayed:

------------------- Relational Tools: Point-and-Shoot -------- 7 ROWS SELECTEDCommand ===> Scroll ===> CSR

Cmd F == Table: PSTDEMO.CUSTOMERS(T1) ===================== 4 OF 20 === MORE>> CUST_ID CUSTNAME ADDRESS CITY STATE ------- -------------------- ==================== --------------- -----___ S 07118 Movie Store 752 State Rd Menemsha MA

Cmd F == Table: PSTDEMO.ORDERS(T2) ========================= 1 OF 3 === MORE>> ORDER_ID CUST_ID ORDER_DATE ORDER_TIME FREIGHT_CHARGES ORDER_SALESMAN -------- ------- ---------- ---------- --------------- --------------*** ********************************** TOP ***********************************___ S 1134 07118 10/14/1998 15.22.30 17.90 RP0013___ S 1123 07118 10/02/1998 14.27.30 35.42 RP0013___ S 1120 07118 09/24/1998 13.18.30 12.50 RP0013*** ******************************** BOTTOM **********************************

Figure 54. Result of Joining

The rows in the ORDERS table are identified as selected because therelated row in the Start Table has been selected.

This example uses cursor position to indicate the row on which toperform the join. However, positioning the cursor is optional. If thecursor is not positioned on a specific row, the first displayed row inthe CUSTOMERS table is assumed to be the anchor row.

For convenience, the JOIN command can be assigned to a functionkey. Then, you position the cursor on the desired anchor row andpress the function key.

Assign JOINto PF Key

Page 123: Move for DB2 User Guide

3. Specify Access Definitions

User Manual 109

3.5.10.2 Several Related Tables

When there are several related tables in the Access Definition and youare not sure of a table name, you can request a selection list of tables.If the JOIN command is entered without a table name or the J linecommand is used, a selection list of related tables is displayed.

------------------ Relational Tools: Point-and-Shoot --------- 7 ROWS SELECTEDCommand ===> Scroll ===> CSR

Cmd F == Table: PSTDEMO.CUSTOMERS(T1) ===================== 1 OF 20 === MORE>> CUST_ID CUSTNAME ADDRESS CITY STATE

*** ********** +---------Select One or More Related AD Tables---------+ ***___ S 07053 R | Cmd CreatorID.TableName From Type 1 OF 3 | MA___ S 07101 M | --- ----------------------------------------- | MA___ 07103 V | ******************** TOP ******************** | MAJ S 07118 M | ___ PSTDEMO.ORDERS BOTH CHILD | MA___ 07123 V | ___ PSTDEMO.SALES DB2 PARENT | MA___ S 07126 M | ___ PSTDEMO.SHIP_TO PST CHILD | MA___ S 07140 S | ****************** BOTTOM ******************* | MA___ S 07141 S +------------------------------------------------------+ MA___ S 07156 Prime Tyme 982 Upper State St Marion MA___ 07160 Reely Great Videos 590 Frontage Rd Amherst MA___ 07189 Showtime 322 Rt 28 Hyannis MA___ 07191 Popcorn 15 Crystal Park Lenox MA___ 07198 Video-tron 100 West Street Brookline MA___ 07201 Movie Buff 400 Merrimac Ave Concord MA___ 07203 Movies-R-Us 1772 Bridge St Bourne MA___ 07235 Jack's Grafton Plaza Grafton MA___ 07242 Video Rental 523 Maple St Boston MA___ 07367 Movie Rentals 7853 Green St Amherst MA___ 07950 Sir Video Inc 11 Midstate Dr Auburn MA___ 07960 Top Hat Video 972 Vine St Boston MA*** ********************************* BOTTOM *********************************

Figure 55. Table Selection List Prompt

The table names are listed on the left side of the prompt. The Fromcolumn indicates whether the table is related to the anchor table by aDB2 or PST relationship, or both. The Type column indicateswhether the table is a child or parent of the anchor table.

Use the S line command to select a table. Press ENTER or use ENDto terminate the selection list. If only one relationship exists betweenthe anchor table and the selected table, the tables are joined as shownin Figure 54.

The selection list includes all related tables in the Access Definitioneven those tables currently displayed. This enables you to browsecycles during Point-and-Shoot.

More than one table can be selected. For information about multi-way joining see Section 3.5.12 Special Considerations for Multi-way Joining.

Join to DisplayCycles

Multi-way Joining

Page 124: Move for DB2 User Guide

3. Specify Access Definitions

110 Move for DB2

3.5.10.3 No Related Tables

When there are no related tables in the Access Definition, a joincannot be performed during the Point-and-Shoot session. If yourequest a Join, MOVE displays a message.

You can terminate the Point-and-Shoot session. Then, add tables tothe Access Definition on the Select Tables/Views for AD panel and,if needed, create new relationships using the CREATERELATIONSHIP command to display the prompts to create arelationship. After completing these additional specifications, start anew Point-and-Shoot session.

3.5.10.4 More than One Relationship

There may be more than one relationship between the anchor tableand the selected table to join. In this situation, the following promptis displayed requesting you to select a relationship.

------------------- Relational Tools: Point-and-Shoot -------- 7 ROWS SELECTEDCommand ===> Scroll ===> CSR

Cmd F == Table: PSTDEMO.CUSTOMERS(T1) ===================== 1 OF 20 === MORE>> CUST_ID CUSTNAME ADDRESS CITY STATE ------- -------------------- ==================== --------------- -----*** ********************************** TOP ***********************************___ S 0705___ S 0710 +------------------Select One Relationship-------------------+___ 0710 | Cmd Relationship From Child Table Name 1 OF 3 |___ S 0711 | --- ----------------------------------------------- |___ 0712 | *********************** TOP *********************** |___ S 0712 | s__ RCO DB2 PSTDEMO.ORDERS |___ S 0714 | ___ RCO1 PST PSTDEMO.ORDERS |___ S 0714 | ___ RCO2 PST PSTDEMO.ORDERS |___ S 0715 | ********************* BOTTOM ********************** |___ 0716 +------------------------------------------------------------+___ 07189 Showtime 322 Rt 28 Hyannis MA___ 07191 Popcorn 15 Crystal Park Lenox MA___ 07198 Video-tron 100 West Street Brookline MA___ 07201 Movie Buff 400 Merrimac Ave Concord MA___ 07203 Movies-R-Us 1772 Bridge St Bourne MA___ 07235 Jack's Grafton Plaza Grafton MA___ 07242 Video Rental 523 Maple St Boston MA___ 07367 Movie Rentals 7853 Green St Amherst MA___ 07950 Sir Video Inc 11 Midstate Dr Auburn MA___ 07960 Top Hat Video 972 Vine St Boston MA*** ******************************** BOTTOM **********************************

Figure 56. Relationship Selection List Prompt

Use the S line command to select a relationship. Press ENTER or useEND to terminate the selection list and display the joined tables asshown in Figure 54.

Page 125: Move for DB2 User Guide

3. Specify Access Definitions

User Manual 111

3.5.11 Handling Multiple Tables

As new tables are joined, the row on which the join is anchored isdisplayed along with the related data from the joined table. Alldisplayed tables can be scrolled. Additional tables can be joined andunjoined. This section discusses:

• Displaying multiple tables

• Scrolling a multiple table display

• Switching from a multiple table display to a single table display

• Removing or unjoining tables

3.5.11.1 Multiple Table Display

After tables are joined, the resulting display shows multiple tables.For example, assume the ORDERS table has been joined to theCUSTOMERS table and the DETAILS table has been joined to theORDERS table. These tables are displayed as follows:

------------------ Relational Tools: Point-and-Shoot --------- 7 ROWS SELECTEDCommand ===> Scroll ===> CSR

Cmd F == Table: PSTDEMO.CUSTOMERS(T1) ===================== 4 OF 20 === MORE>> CUST_ID CUSTNAME ADDRESS CITY STATE ------- -------------------- ==================== --------------- -----___ S 07118 Movie Store 752 State Rd Menemsha MA

Cmd F == Table: PSTDEMO.ORDERS(T2) ========================= 1 OF 3 === MORE>> ORDER_ID CUST_ID ORDER_DATE ORDER_TIME FREIGHT_CHARGES ORDER_SALESMAN -------- ------- ---------- ---------- --------------- --------------___ S 1134 07118 10/14/1998 15.22.30 17.90 RP0013

Cmd F == Table: PSTDEMO.DETAILS(T3) ======================== 1 OF 3 ========== ORDER_ID ITEM_ID ITEM_QUANTITY DETAIL_UNIT_PRICE -------- ------- ------------- -----------------*** ********************************** TOP ***********************************___ S 1134 CH007 1 34.00___ S 1134 CM021 10 9.00___ S 1134 DR012 1 19.00*** ******************************** BOTTOM **********************************

Figure 57. Sample Multiple Table Display

An information line is provided for each table. This line contains thename of the table, the identifier supplied by MOVE, the relative rownumber and the total number of rows selected for display. The statusflag field contains S for the lower level tables when the Start Tablerow is selected.

Page 126: Move for DB2 User Guide

3. Specify Access Definitions

112 Move for DB2

The TOP marker, before the first line, and the BOTTOM marker,after the last line, are displayed only for the lowest level table, theDETAILS table in the figure. These markers indicate the first andlast selected rows of the table.

The maximum number of tables or levels that can be displayeddepends on the size of the physical screen being used. This maximumis computed by subtracting three header lines (title line, commandline, and long message line) from the total number of lines on thescreen, and then dividing that value by five (the minimum number oflines required for any table display). The result of this division,regardless of the remainder, is used as the maximum number ofdisplay levels for the current screen. When hexadecimal mode isactivated (requiring three lines to represent each row of data), themaximum number of display levels for the current screen is reduced.

Although the screen size limits the number of displayed levels, the joinfunction itself is limited to 64 tables. When the screen cannot fitanother table and a join is requested, the highest level table is removedfrom the display, and all lower level tables are repositioned toaccommodate the newly joined table.

The START command can be used to change which table is currentlydisplayed as the highest level table. This is useful when:

• Multiple tables are joined and you want to display more rows thanare currently displayed from the lowest level table.

• Changing from split screen to full screen processing and you wantto display a higher level table in the additional space.

Any currently active table may be specified with the STARTcommand provided space is available to display at least one row fromthe current lowest level table.

3.5.11.2 Coordinated Scroll

In a multiple table display, scrolling a table automatically scrolls thelower level joined tables. For example, scrolling the CUSTOMERStable automatically scrolls the ORDERS table to the orders for thedisplayed customer and also scrolls the DETAILS table accordingly.

MOVE uses all of the familiar ISPF commands for scrolling,including BOTTOM, DOWN, LEFT, RIGHT, UP, and TOP.

You can indicate the table to be scrolled by including its name oridentifier on the command or by cursor position. For example, UP T2causes the table identified as T2 to be scrolled backward. If the

Display Levels

Changing HighestDisplay Levels

Page 127: Move for DB2 User Guide

3. Specify Access Definitions

User Manual 113

cursor is not positioned in any window and no operands are given onthe scroll command, the lowest level displayed table is scrolled.

You can also scroll by positioning the cursor to a specific row in anyof the tables and pressing one of the PF keys assigned to scroll. Alllower level tables are scrolled accordingly.

3.5.11.3 Zooming a Joined Table Display

At times it is desirable to view more rows of a specific table than canbe displayed during a multi-table display. The Zoom line command,Z, or the ZOOM primary command toggles from a multi-table displayto a single table display without impacting the currently joined tables.

To switch a multi-table display to focus on a single table, the Zoomline command is entered in the Cmd field of a displayed row of thetable to be zoomed. To return to a multi-table display, enter theZoom line command in the Cmd field of any displayed row. The rowon which the command is entered becomes the first row displayed forthe table.

The ZOOM primary command can be specified with the name of atable to change the display to a single table display including only therows from the named table. The ZOOM command with no operandsacts as a toggle between multi-table and single-table displays.

The ZOOM command is cursor sensitive. Thus, if the cursor is in thewindow of a table, the table name operand is not necessary. Inaddition, if the cursor is positioned on a data line for that table, thezoom will cause that row to be the first displayed line of data.Similarly, if the cursor is positioned in the window on a data line inthe zoomed display, when ZOOM is requested again, the linecontaining the cursor will be scrolled to the first position. If thecursor is not positioned on a data line, the first displayed row isassumed.

All joined tables are retained when zoom is used. The single-tablezoomed display can be scrolled and edited. If the table is scrolled duringa zoomed display, any lower level joined tables are logically scrolled.When the multi-table display is restored, the scrolled data is displayed.

Zoom LineCommand

ZOOM PrimaryCommand

Impact on JoinedTables

Page 128: Move for DB2 User Guide

3. Specify Access Definitions

114 Move for DB2

The following example uses ZOOM to change the display from amulti-table display to a display of the CUSTOMERS table. Theprimary command can be entered as ZOOM CUSTOMERS orZOOM T1.

-------------------- Relational Tools: Point-and-Shoot ------- 7 ROWS SELECTEDCommand ===> ZOOM T1 Scroll ===> CSR

Cmd F == Table: PSTDEMO.CUSTOMERS(T1) ====================== 4 OF 20 == MORE>> CUST_ID CUSTNAME ADDRESS CITY STATE ------- -------------------- ==================== ----------- -----___ S 07118 Movie Store 752 State Rd Menemsha MA

Cmd F == Table: PSTDEMO.ORDERS(T2) ========================= 1 OF 3 === MORE>> ORDER_ID CUST_ID ORDER_DATE ORDER_TIME FREIGHT_CHARGES ORDER_SALESMAN -------- ------- ---------- ---------- --------------- --------------___ S 1134 07118 10/14/1998 15.22.30 17.90 RP0013___ S 1123 07118 10/02/1998 14.27.30 35.42 RP0013___ S 1120 07118 09/24/1998 13.18.30 12.50 RP0013*** ******************************** BOTTOM **********************************

Figure 58. Zoom Multi-Table Display

-------------------- Relational Tools: Point-and-Shoot ------- 7 ROWS SELECTEDCommand ===> Scroll ===> CSR

Cmd F == Table: PSTDEMO.CUSTOMERS(T1) =======ZOOMED========= 4 OF 20 == MORE>> CUST_ID CUSTNAME ADDRESS CITY STATE ------- -------------------- ==================== ----------- -----___ S 07118 Movie Store 752 State Rd Menemsha MA___ 07123 Video Way 112 South Moreland A Groton MA___ S 07126 Movie Rentals 101 Munson St Greenfield MA___ S 07140 Showcase 1150 Indiana Terr Beverly MA___ S 07141 Showcase II 57 Rock Hollow Salem MA___ S 07156 Prime Tyme 982 Upper State St Marion MA___ 07160 Reely Great Videos 590 Frontage Rd Amherst MA___ 07189 Showtime 322 Rt 28 Hyannis MA___ 07191 Popcorn 15 Crystal Park Lenox MA___ 07198 Video-tron 100 West Street Brookline MA___ 07201 Movie Buff 400 Merrimac Ave Concord MA___ 07203 Movies-R-Us 1772 Bridge St Bourne MA___ 07235 Jack's Grafton Plaza Grafton MA___ 07242 Video Rental 523 Maple St Boston MA___ 07367 Reely Great Videos 590 Frontage Rd Amherst MA___ 07950 Sir Video Inc 11 Midstate Dr Auburn MA___ 07960 Top Hat Video 972 Vine St Boston MA

Figure 59. Result of Zooming Display

The first displayed line in the CUSTOMERS table is the row that wasdisplayed when the zoom was requested. If the zoomed display isscrolled, the first currently displayed row will be the row displayed forthe table when the multi-table display is redisplayed.

Use the UNZOOM primary command to return to the multiple tabledisplay. Specify a row other than the first displayed row by cursorposition. Also, you can use the Z line command. The row on which thecursor is positioned is scrolled to the top of the window for that table.

Page 129: Move for DB2 User Guide

3. Specify Access Definitions

User Manual 115

3.5.11.4 Unjoining Tables

The UNJOIN command severs the join between the tables and removesthe unjoined tables from the display. The display is then adjusted toinclude additional lines from the new lowest level table if space isavailable. Any higher level table not currently displayed is repositionedat the top of the panel, in the order of lowest to highest, with eachsuccessive execution of the UNJOIN command.

The UNJOIN command can be specified to sever the relationshipbetween any two tables by positioning the cursor on the desired table,regardless of level, or by specifying that table as an operand. This alsosevers the relationships between all of the tables lower than the unjoinrequest table. All unjoined tables are removed from the display.

The UNJoin line command can also be used. Type UNJ in the Cmdfield of the highest level table to unjoin. All lower level tables are alsounjoined.

3.5.12 Special Considerations for Multi-way Joining

Most tables are related to more than one other table. When multipletables are related, several navigational paths are available for joiningwhen browsing the data. You may find it useful to display the relateddata obtained by traversing more than one of these paths. Use multi-way joining to access more than one related table without losing anyof the paths through the data.

Consider the following example. A database contains the followingrelated tables:

You can start a Point-and-Shoot session with CUSTOMERS andrequest a selection list of tables to join. The selection list displaysORDERS, SALES and SHIP_TO. You can select all of these tables.All selected tables are joined and active. Although all tables areactive, only one table is displayed. The other tables are “hidden”.

Page 130: Move for DB2 User Guide

3. Specify Access Definitions

116 Move for DB2

When multiple tables are joined to a single table, the multiple tablesare “stacked” in the order in which they were joined. The mostrecently joined table is on top of the second most recent, the second ontop of the third and so on. The table on the top of the stack isdisplayed; the other tables are “hidden”. You can display any tablefrom the stack. Stack handling is “wrapped”.

For example, assume ORDERS, SALES, and SHIP_TO are joined toCUSTOMERS in that order. As each table is joined, it is placed atthe top of the stack. Therefore, the stack contains:

SHIP_TOSALESORDERS

The SHIP_TO table, the table at the top of the stack, is displayed. Ifyou display SALES, SHIP_TO is placed at the bottom of the stackand SALES is pushed up. The order in the stack is:

SALESORDERSSHIP_TO

Then, if ORDERS is displayed, SALES is placed at the bottom of thestack, and ORDERS is pushed up.

ORDERSSHIP_TOSALES

You can stack multiple tables at any display level of the current session.If tables are joined below the stacked table, these lower level tables arehidden when the stacked table is hidden.

3.5.12.1 Using Join

Use the Join facility to request a multi-way join when browsing data.The request can be directed to any display level.

For example, assume only CUSTOMERS is displayed. It is thelowest level table. Three tables, ORDERS, SALES, and SHIP_TO,are related to CUSTOMERS. You can request a join either by theJoin line command or by the JOIN primary command. More than onetable is related to CUSTOMERS so the JOIN Selection List Promptis displayed. The selection list for all related tables contains the threetables ORDERS, SALES, and SHIP_TO in that order. You canselect any or all of the tables on the list.

Assuming all three tables are selected, the SHIP-TO table, the lasttable on the selection list, is displayed. (The stack is created such that

Joining to theLowest Level

Page 131: Move for DB2 User Guide

3. Specify Access Definitions

User Manual 117

the last selected table is on the top of the stack and the first selectedtable is on the bottom.)

You can stack multiple tables at any display level; therefore, you canrequest a join to a table other than the lowest level table.

For example, assume ORDERS is the lowest level table and is theonly table joined to CUSTOMERS. You can join a different table toCUSTOMERS without unjoining ORDERS. To join SHIP_TO toCUSTOMERS, specify:

JOIN SHIP_TO FROM CUSTOMERS

SHIP_TO is positioned on the top of the stack and displayed.ORDERS is pushed down on the stack.

You can also use DB2 LIKE syntax to display a selection list ofpossible tables to join at any level. For example, assume onlyORDERS is joined to CUSTOMERS. To display a selection list tojoin additional tables to CUSTOMERS, specify:

JOIN S% FROM CUSTOMERS

All tables that begin with “S” are included on the list. You can selectone or all listed tables.

You can use the level indicator to specify the target for the FROMoperand. For example, the CUSTOMERS table is assigned T1. Youcan specify the JOIN command as:

JOIN S% FROM T1

You can use the cursor position to indicate the target table. For example,rather than include FROM CUSTOMERS or FROM T1 on thecommand, you can position the cursor on the CUSTOMERS table andenter the JOIN command.

Joining to AnotherLevel

Page 132: Move for DB2 User Guide

3. Specify Access Definitions

118 Move for DB2

In the following figure, multiple tables are joined to the CUSTOMERStable. The ORDERS table, one of the tables in the stack, is displayed.The STACKED indicator is displayed after the table name.

------------------- Relational Tools: Edit -----------------------------------Command ===> Scroll ===> CSR

Cmd F == Table: PSTDEMO.CUSTOMERS(T1) ===================== 4 OF 20 === MORE>> CUST_ID CUSTNAME ADDRESS CITY STATE ------- -------------------- ==================== --------------- -----___ 07118 Movie Store 752 State Rd Menemsha MA

Cmd F == Table: PSTDEMO.ORDERS(T2) ====== STACKED ========== 1 OF 3 === MORE>> ORDER_ID CUST_ID ORDER_DATE ORDER_TIME FREIGHT_CHARGES ORDER_SALESMAN -------- ------- ---------- ---------- --------------- --------------*** ********************************** TOP ***********************************___ 1134 07118 10/14/1998 15.22.30 17.90 RP0013___ 1123 07118 10/02/1998 14.27.30 35.42 RP0013___ 1120 07118 09/24/1998 13.18.30 12.50 RP0013*** ******************************** BOTTOM **********************************

Figure 60. Sample Multiple Table Display

3.5.12.2 Scrolling

By default, when a parent table is scrolled, the currently displayedchild table is also scrolled. Sometimes when scrolling, the child tablehas no related rows to display.

You can set the Editor and Display Option, AutoSwitch Mode, suchthat when the parent table is scrolled and the currently displayed childtable has no related rows, AutoSwitch automatically displays the firstchild table in the stack that has at least one related row.

For more information about the AutoSwitch Mode, see Section 6.2Editor and Display Options.

You can display any “hidden” table in the stack using the SWITCHcommand.

By default, the SWITCH command operates on the lowest level. If morethan one other table is joined, SWITCH displays a selection list. If onlyone other table is joined, that table is displayed and the previous table ishidden. If no other tables are joined, a message is displayed.

Use the operands on the SWITCH command to display a specifictable at a specific level stack. For example, to display the next tablein the stack on the second level, specify:

SWITCH T2 NEXT

You can also specify the name of a table. To display the ORDERStable in the stack on the second level, specify:

SWITCH T2 ORDERS

Example

Switching theDisplayed Table

Page 133: Move for DB2 User Guide

3. Specify Access Definitions

User Manual 119

In addition to specifying NEXT and a specific table name, you canuse the keyword ALL on the command for the default process. Thatis, you can display a selection list of all of the tables in a stack. Todisplay a list of joined tables for the stack at the second level:

SWITCH T2 ALL

A selection list is provided if multiple tables are joined at the targetlevel. If only one other table is joined, that table is displayedautomatically.

You can also use cursor position to indicate the target level.

You may find it useful to assign the SWITCH command to a PF keyand use the cursor position for the target level.

Related lower level tables

Any table in the stack can be joined to lower level tables. However,only related data is displayed. When the table in the stack is notdisplayed, all joined lower levels are not displayed also. If you switchthe display from one table to another, the joined related tables areincluded in the switching.

3.5.12.3 Displaying Traversal Paths

With multi-way joining the Point-and-Shoot session can become verycomplex. In addition to keeping track of all the tables in a stack, youmay have joined to tables on lower levels for one or more tableswithin the stack and you may have nested stacks. You can obtain alist of all active tables in the session and select a table on that list toswitch the displayed tables.

Use the INDENT command to display an indented list of the activetables in the session on the Indented Table Display panel. Theformat of this list identifies the display level hierarchy of all the tablesand all the stacks. (This command is available regardless of whetheryou have stacked joined tables; however, since it is especially usefulwhen tables are stacked, it is discussed in this section.)

Page 134: Move for DB2 User Guide

3. Specify Access Definitions

120 Move for DB2

A sample of the panel is shown in the following figure.CUSTOMERS is the Start Table. All active tables are listed.Asterisks indicate the currently displayed tables. The levels of thetables are indicated on the left. All tables in a stack are on the samelevel. All tables in the stack, other than the active table, are indicatedby the (STACKED) notation to the right of the name.

----------------------------- Indented Table Display -------------------------Command ===> Scroll ===> CSR

Default Creator ID: PSTDEMO 1 OF 7

Cmd Lvl Table Name Relation Type--- --- ------------------------------------------------------ -------- ----*** *** *********************** TOP ************************** ******** ****___ 1* CUSTOMERS START TABLE___ 2* C:ORDERS RCO DB2___ 3* C:DETAILS ROD DB2___ 4* P:ITEMS RID DB2___ 2 C:SALES (STACKED) RSC DB2___ 2 C:SHIP_TO (STACKED) RCST DB2___ 3 C:SHIP_INSTR RSTSI DB2*** *** ********************** BOTTOM ************************ ******** ****

Line Commands: (S)elect - Switch to Specified Table

Figure 61. Indented Table Display

The fields on the panel include:

Default Creator ID Default Creator ID as specified on the SelectTables/Views for AD panel.

x OF y Relative number of the first displayed table (x)and the total number of active tables (y).

Lvl Display level of the table.

Table Name Name of the table. If the Creator ID is not thesame as the default Creator ID it is included withthe name.

The Start Table is listed first followed by theother tables ordered and formatted to reflect theedit session. Tables in a stack are listed in stackorder.

Special notation is included with the table name toprovide information about the relationships. Thisnotation includes:

Parent/Child IndicatorsExcept for the Start Table, the table name isprefixed to indicate whether it is the parent or thechild in the relationship defined between thenamed table and the table under which it is

Panel Fields

Page 135: Move for DB2 User Guide

3. Specify Access Definitions

User Manual 121

indented.

The prefix is either:

C:P:

ChildParent

Relation Name of the relationship between the higher leveltable and this table. START TABLE is alwaysspecified for the Start Table.

Type Identifier to denote whether the relationship isdefined in the DB2 Catalog, DB2, or in thePrinceton Softech Directory, PST.

On the Indented Table Display panel you can select any table in thestack to be the displayed table using the Select line command. Thecommand can be specified for any table joined to a table in a stack aswell as the stack table. For example, in the figure SHIP_INSTR isjoined to SHIP_TO. SHIP_TO is a table in a stack. You can selecteither SHIP_TO or SHIP_INSTR.

Use END on the Indented Table Display panel to return to the editsession.

3.5.12.4 Unjoining

You can unjoin any table in the stack using the UNJOIN command.When you unjoin a table in the stack, all lower level tables joined to thetarget table are unjoined.

By default, the UNJOIN command unjoins the lowest level. If there arestacked tables for that level, the displayed table is unjoined, removedfrom the stack and the next table on the stack is displayed.

You can use the operands on the UNJOIN command to unjoin aspecific table or all tables in a specific stack.

For example, to unjoin all tables in a stack at the lowest display level,specify:

UNJOIN ALL

By default, the lowest display level is the target. If there is no stack atthat level, the ALL operand is ignored and the table at the lowest displaylevel is unjoined.

To unjoin a specific table, in this example ORDERS, in the stack atthe lowest display level, specify:

UNJOIN ORDERS

Selecting anothertable in the stack

Page 136: Move for DB2 User Guide

3. Specify Access Definitions

122 Move for DB2

If there is no stack at the lowest display level, UNJOIN searches for adisplayed table named ORDERS.

When you have created multiple stacks, you can specify the targetstack using the level indicator, either Tn or Vn as displayed on thepanel. For example, to unjoin all tables in the second level stack,specify:

UNJOIN T2 ALL

You can use cursor position to indicate the target level.

3.5.13 Displaying SQL

During a Point-and-Shoot session, use the SHOW SQL command todisplay a generalized form of the SQL that was used to fetch the rowsfrom any of the displayed tables. By default, the SQL for the lowestlevel table is displayed. To display the SQL for another table, eithersupply the table name or identifier with the command or position thecursor to the desired table. For example, to display the SQL for thehighest level table, enter:

SHOW SQL T1

The table name is shown in the window heading. The generated SQLmay contain three parts:

• Host variables are declared if the corresponding columns havedifferent data types or dimensions.

• Pseudo code is generated to populate the host variables if they aredeclared.

• The "generalized" SELECT statement, which incorporates thehost variables.

Page 137: Move for DB2 User Guide

3. Specify Access Definitions

User Manual 123

Assume the CUSTOMERS table and the ORDERS table aredisplayed. The SHOW SQL command is entered to display the SQLused to fetch the rows from the ORDERS table. The SQL statementis displayed as:

------------------ Relational Tools: Point-and-Shoot --------- 7 ROWS SELECTEDCommand ===> Scroll ===> CSR

Cmd F == Table: PSTDEMO.CUSTOMERS(T1) ===================== 1 OF 20 === MORE>> CUST_ID CUSTNAME ADDRESS CITY STATE

+------------------------------SQL Text Display---------------------------+ | | | Generated SQL for: PSTDEMO.ORDERS | > | | | | | SELECT ORDER_ID, CUST_ID, ORDER_DATE, ORDER_TIME, FREIGHT_CHARGES, | * | ORDER_SALESMAN, ORDER_POSTED_DATE FROM PSTDEMO.ORDERS WHERE (CUST_ID = | | CUSTOMERS.CUST_ID) | | | | | | Enter UP and DOWN Commands to Scroll the Statement | | Enter OUTPUT Command to Save the Statement | | Enter END Command to Return | | | +-------------------------------------------------------------------------+

Figure 62. Text Display of Generated SQL

The actual SQL generated by MOVE contains the specific data valuesfor columns defined in the relationship. Therefore, the SQL in theprevious figure contained a value for CUST_ID as in:

SELECT ...FROM PSTDEMO.ORDERS WHERE CUST_ID = '17053'

However, this SQL would not be as useful to the user as thegeneralized form that is shown:

SELECT ...FROM PSTDEMO.ORDERS WHERE CUST_ID = CUSTOMERS.CUST_ID

The right hand side of the predicate in the SQL statement is providedwith a meaningful name that represents the processing.

GeneralizedWHERE Clause

Page 138: Move for DB2 User Guide

3. Specify Access Definitions

124 Move for DB2

You can save or print the output of the SHOW SQL command byusing the OUTPUT command. When you enter the OUTPUTcommand, the Output Data Options panel is displayed as shown inthe following figure.

--------------------- Relational Tools: Point-and-Shoot ----- 7 ROWS SELECTED Command ===> Scroll ===> CSR

Cmd F == Table: PSTDEMO.CUSTOMERS(T1) ==================== 1 OF 20 === MORE>> +------------------------Output Data Options----------------------------+ | |-+ | Output Parameters: | | | | | | Output Type ===> d D-Dataset, S-SYSOUT | | | | | | If Dataset: | | | DSN ===> 'pstdemo.sql.output.pds(ddljoin)' | | | Disposition ===> M-Mod, O-Old | | | | | | If SYSOUT: | | | SYSOUT Class ===> A - Z, 0 - 9, * | | | Destination ===> | | | Hold ===> Y-Yes, N-No | | +-----------------------------------------------------------------------+ | +-----------------------------------------------------------------------+

Figure 63. Output Data Options Panel

The fields on this panel are:

Output Type Specify whether the SQL is to be saved in a datasetor as a SYSOUT class for printing.

If Dataset:

DSN Specify the name of a new or existing dataset. Thedataset must be either a sequential file, with a recordformat of fixed or fixed block, or a Partitioned DataSet (PDS) with a member name enclosed inparentheses.

The dataset name is automatically prefixed unless itis enclosed in apostrophes. The prefix is determinedby the Data Set Prefix user option (see Section 6.Specify Options for details).

Alternatively, you may specify an asterisk, *, or theDB2 LIKE character, %, at the end of the DSNspecification to generate a selection list. Forexample:

'PSTDEMO.DDL*' or 'PSTDEMO.DDL%'

Both generate a selection list of all datasets having aDSN beginning with PSTDEMO.DDL and having a

Saving the SHOWSQL Output

Panel Fields

Page 139: Move for DB2 User Guide

3. Specify Access Definitions

User Manual 125

valid format (that is, PDS or sequential file with arecord format of fixed or fixed block).

If the specified dataset does not exist, MOVEdisplays the Allocate Dataset panel (see AppendixB. Allocating External Files for details).

Disposition For an existing, sequential dataset only. Specify oneof the following:

M MOD. The SQL data is appended to thedataset.

O OLD. The contents of the file are replacedwith the SQL data.

If SYSOUT:

You can direct the output to a SYSOUT class and use an outputprocessor, such as SDSF, to print it.

SYSOUTClass

Specify the output class to which the printed outputbelongs. This can be a character in the range Athrough Z, 0 through 9, or an asterisk, *.

Destination Specify a valid SYSOUT destination. Thedestination can be a local or remote terminal, a nodein the JES network, a local or remote printer orworkstation, or a TSO user ID.

Hold Specify whether the output is to be held or not.

Y Output is held until released or deleted by anoperator.

N Output is not held.

When you have entered all the desired information on this panel, pressENTER to continue processing. To return to the previous panelwithout specifying output data options, use END or CANCEL.

3.5.14 Reporting

At any time during a Point-and-Shoot or browse session, you canproduce a report about the contents of the session. Use the reportingfacility to generate a report that includes some or all of the retrievedrows in a variety of formats. To invoke the report facility, use the

Page 140: Move for DB2 User Guide

3. Specify Access Definitions

126 Move for DB2

REPORT command. MOVE prompts for the report specifications onthe following panel:

-------------------- Relational Tools: Point-and-Shoot ----------------------- Command ===> Scroll ===> PAGE

Cmd F == Table: PSDTDEMO.CUSTOMERS(T1) ==================== 1 OF 3 === MORE>>

+--------------------------Specify Report Options-------------------------+ ¦ ¦ ¦ All rows are printed for the named table. If 'All' is selected, one ¦ ¦ row is printed for each table above and all rows for each table below. ¦ > ¦ Leave 'Table Name' blank for a selection list. Use HELP for more ¦ E ¦ information. Press ENTER to continue, END or CANCEL to exit report. ¦ - ¦ ¦ ¦ Table Name, Tn, or LAST ===> CUSTOMERS ¦ ¦ Process All Tables or One ===> A A-All, N-Named Table Only ¦ >> ¦ Report Title ===> ¦ ¦ Output Type ===> D-Dataset, S-SYSOUT ¦ ¦ If Dataset: DSN ===> ¦ ** ¦ If SYSOUT: SYSOUT Class ===> A - Z, 0 - 9, * ¦ ¦ Destination ===> ¦ ¦ Hold ===> Y-Yes, N-No ¦ ¦ Display Report Parameters ===> N Y-Yes, N-No ¦ ** +------------------------------------------------------------------------+

Figure 64. Specify Report Options

The fields on the panel are:

Table Name, Tnor LAST

Specify the table for which all rows are selected.

You can specify any active table in the session.Specify the name by explicit name, assigned Tn orVn, or the word LAST (for the lowest leveldisplayed table). This value combined with thespecification for Process All Tables or Onedetermines the set of data that is displayed.

For more information about how this specificationaffects the report contents refer to the discussion,Determining Report Contents on page 127.

Process AllTables or One

Specify whether one or all tables are to be includedin the report. Specify:

A All tablesN Only the named table

Report Title Specify a title to be included in the heading for thereport. Any characters, including upper case andlower case letters, can be specified.

Output Type Specify the output type as either:

D Dataset

Panel Fields

Page 141: Move for DB2 User Guide

3. Specify Access Definitions

User Manual 127

S SYSOUT

If Dataset Specify the dataset name if the Output Type is D.If the dataset does not exist, MOVE prompts forallocation information and allocates the file beforegenerating the report.

If SYSOUT Specify SYSOUT parameters if the Output Type isS. The parameters are:

SYSOUT ClassDestinationHold

Display ReportParameters

Specify whether you want to review the prompts forreport parameters. Specify:

Y Yes to review promptsN No to not review prompts.

Determining Report Contents

The combination of your specifications for table name and one or alltables determines the actual contents of the report. For example,assume you are currently editing four tables joined for display in thefollowing order:

CUSTOMERSORDERSDETAILSITEMS

1. To report on all the rows from a single table, specify the tablename and “N” for the prompt Process All Tables or One toinclude only one table. For example, to include only all theDETAILS rows in the report, specify:

Table Name, Tn, or LAST ===> DETAILS Process All Tables or One ===> N

All the rows in the DETAILS table, regardless of whichORDERS rows (the next highest table) are displayed, areincluded in the report. No other tables are included in this report.

2. To limit the report to a specific level, specify the name of thetable for which all rows on the current level are included. Forreference, the current rows in all next higher level tables areincluded. The lower level tables are always included with thisspecification.

Page 142: Move for DB2 User Guide

3. Specify Access Definitions

128 Move for DB2

For example, to report on the DETAILS rows for the currentlydisplayed ORDERS row and the related ITEMS for each of theDETAILS, specify:

Table Name, Tn, or LAST ===> DETAILS Process All Tables or One ===> A

The report lists the displayed the single row for theCUSTOMERS and ORDERS table and each DETAILS row, oneat a time, along with the related ITEMS rows for each of theDETAILS.

3. To include all the rows from all the tables in the current session,specify the name of the Start Table and “A” for the prompt ProcessAll Table or One. For example, assume the CUSTOMERS table isthe Start Table, specify:

Table Name, Tn, or LAST ===> CUSTOMERS Process All Tables or One ===> A

If you want to include all of the information for a singleCUSTOMERS row, specify ORDERS as the table name. Then, thecurrent CUSTOMERS row is included along with all of the currentORDERS rows, related DETAILS and ITEMS rows.

The format of the rows in the report conforms to the display format in theeditor. A header identifies the table, column headings are presentedabove the columns, and the row(s) of data are provided beneath theheadings. You can specify the parameters for the report format.

When there are multiple lower level tables, the data display is handledsimilarly to the editor.

• For each table that is not the lowest level table, only one row isdisplayed.

• For the lowest level table, all rows are displayed.

• When there are multiple rows for a table that is not the lowestlevel table, each row is displayed in order along with the lowerlevel related rows.

Report Format Parameters

When you specify Y to the Display Report Parameters, prompts aredisplayed. Normally, you set these parameters once, and use themconsistently for all reporting.

Format

Page 143: Move for DB2 User Guide

3. Specify Access Definitions

User Manual 129

--------------------- Relational Tools: Point-and-Shoot ----------------------Command ===> Scroll ===> CSR

Cmd F == Table: PSTDEMO.CUSTOMERS(T1) ==================== 1 OF 102 === MORE>>

+------------------------Report Format Parameters-----------------------+ ¦ ¦ ** ¦ Lines per Page ===> 57 0-No Titles, 20-999 ¦ ¦ Maximum Report Rows per Table ===> blank-Editor Max Fetch Rows¦ ¦ Report Line Width ===> 132 80-n, Blank-Maximum ¦ ¦ Oversized Lines ===> W T-Truncate, W-Wrap Data ¦ ¦ Maximum Character Column Width ===> Blank-Maximum Display Width¦ ¦ New Page per Start Table Row ===> N Y-Yes, N-No ¦ ¦ Blank Lines between Levels ===> 1 0 - 3 ¦ ¦ Blank Lines between Rows ===> 0 0 - 3 ¦ ¦ Blanks between Columns ===> 1 0 - 20 ¦ ¦ Indent for Subordinate Tables ===> 2 0 - 40 ¦ ¦ Omit Table Name Heading Line ===> N Y-Yes, N-No ¦ ¦ Omit Subordinate Table Headings ===> N Y-Yes, N-No ¦ ¦ Omit Redundant Table Headings ===> N Y-Yes, N-No ¦ ¦ Show Inactive Multi-Way Tables ===> Y Y-Yes, N-No ¦ ¦ ¦ ¦ Press ENTER to continue, END or CANCEL to exit report. ¦ +-----------------------------------------------------------------------+

Figure 65. Report Format Parameters

The following fields are displayed on this panel:

Lines per Page Specifies the maximum number of lines to be printedon a page. Normally, this is the number of physicallines that fit on a page minus the number of lines forthe top and bottom margins. The default is 57.Specify:

0 Print the title line at the start of the reportand do not insert page breaks. Use 0 if youare writing to a dataset and do not wantpage breaks.

20-999 Print the specified number of lines perpage. When the number of lines have beenprinted, insert a page break, print the titleat the top of the new page and incrementthe page number by 1.

Maximum ReportRows per Table

Specify the maximum number of rows fetched for eachtable in the report. The value must be from 1 throughthe value specified by site management. Leave thefield blank to use the value specified for Max FetchRows in the Editor and Display Options.

Panel Fields

Page 144: Move for DB2 User Guide

3. Specify Access Definitions

130 Move for DB2

Report Line Width Specify the maximum number of characters on a line inthe report. If the row length exceeds this value, it iswrapped or truncated as specified for the OversizedLines option on this panel.

To set the line width value to the largest row of anytable in the report, leave the field blank.

The minimum value is 80. If less than 80, the value isreset to 80. Use 80 if the report is directed to a dataset for browsing on the screen.

If the report is directed to a printer, this value is theline length of the printer (132 for most printers). Thecarriage control byte in the first position of the line isNOT included in the value.

Oversized Lines Specify how lines that exceed the maximum widthshould be handled. Specify:

T Data is truncated. Columns that do not fit intheir entirety on the line are omitted from thereport.

W Data is wrapped. Each row occupies as manylines as is necessary to include the entire row.Line breaks occur between columns unless thecolumn width exceeds the line width.

MaximumCharacter ColumnWidth

Specify the maximum number of characters that can beincluded for CHAR and VARCHAR columns. Leavethe field blank to use the value specified for ColumnarMax Display Width on the Edit and Display Optionspanel.

New Page per StartTable Row

Specify whether each Start Table row should beprinted at the top of a new page. Specify:

YN

Print on a new page.Continue printing on the current page.

If the report is for a single table, this is ignored.

Blank Linesbetween Levels

Specify the number of blank lines that are to beinserted between levels. Specify a value between 0 and3.

Page 145: Move for DB2 User Guide

3. Specify Access Definitions

User Manual 131

Blank Linesbetween Rows

Specify the number of blank lines that are to beinserted between rows. This parameter applies only tothe tables for which all relevant rows are included; onlya single line is included for other tables. Specify avalue between 0 and 3.

Blank betweenColumns

Specify the number of blanks that are to be insertedbetween columns. Specify a value between 0 and 20.

This value is the minimum number of blanks betweenany two columns. The report may display more blanksbetween some columns depending on the contents ofthe column and the justification of that data.

Indent forSubordinate Tables

Specify the number of positions to indent a subordinatetable to distinguish it from the immediately precedingtable. Use this to present a clear visual representationof the display levels.

The value specified for this parameter is subtractedfrom the Report Line Width to determine the actualnumber of characters in the indented table that can fiton a line.

Specify a value between 0 and 40.

Omit Table NameHeading Line

Specify whether or not the line containing the tablename and level number for each level is included in thereport.

YN

Include headingDo not include heading

Omit SubordinateTable Headings

Specify whether or not all header lines forall tables other than the Start Table areincluded in the report.

Sometimes including the column titlesand table names is unnecessary. Forthose reports, use this option to eliminatesuch unnecessary clutter.

YN

Include headingDo not include heading

Omit RedundantTable Headings

Specify whether or not the table headings areincluded more than once on a page. That is, if a tableis included on a page more than once, the headingsare included with only the first occurrence.

Page 146: Move for DB2 User Guide

3. Specify Access Definitions

132 Move for DB2

YN

Omit redundant table headings.Include table headings for all occurrences of atable on a page.

Show InactiveMulti-Way Tables

Specify whether all joined tables involved in a multi-way join are included. Although all tables cannot becurrently active, all must have been displayed duringthe session.

YN

Include all tables in a multi-way joinInclude only the currently displayed table in amulti-way join.

The following notes apply to reports:

• Excluded rows are included in the report. When you return to thesession after generating a report, the excluded rows are redisplayed.

• If a multi-way join is in effect for subordinate levels, the ShowInactive Multi-way Tables option determines whether the hiddentables are included.

• If you specify a table that is involved in a multi-way join and onlyone table is to be printed, only the active table is included. Thehidden tables on that level are not printed regardless of the ShowInactive Multi-way Tables option.

• All locked column specifications are respected. Therefore, lockedcolumns are positioned as in the edit session.

• The specifications on the Describe Columns panel for columnand label handling are used in formatting the report lines.

• The REPORT command is not available during a ZOOMeddisplay.

Additional Notes

Page 147: Move for DB2 User Guide

3. Specify Access Definitions

User Manual 133

3.5.15 Terminating a Session

When you have completed your selections, use END to return to theSelect Tables/Views for AD panel. A prompt is displayed.

------------------- Relational Tools: Point-and-Shoot -------- 7 ROWS SELECTEDCommand ===> Scroll ===> CSR

Cmd F == Table: PSTDEMO.CUSTOMERS(T1) ====================== 1 OF 20 == MORE>> CUST_ID CUSTNAME ADDRESS CITY STATE ------- ------------------- ==================== ------------ -----*** ********************************** TOP ********************************___ S 07053 Replay Video 9032 Dickerson St Amherst MA___ S 07101 Movie Mania 572 Front St Auburn MA__ +------------------------ Confirm Row List Processing ----------------+__ | |__ | Specify Output DSN to Permanently Save Modified Row List |__ | |__ | Output DSN===> |__ +---------------------------------------------------------------------+___ 07189 Showtime 322 Rt 28 Hyannis MA___ 07191 Popcorn 15 Crystal Park Lenox MA

Figure 66. Point-and-Shoot Confirmation Prompt

If an Input DSN was supplied, the name is shown in the Output DSNfield. Press ENTER to update the named data set. You can overtypethe name to create a new data set or update a different existing dataset. This name is saved with the Access Definition and replaces anyprevious data set name.

If you have entered Point-and-Shoot from within an Extract Processrequest, the Confirm Row List Processing prompt is displayed as:

+-------------------- Confirm Row List Processing -------------------+| || Specify Output DSN to Permanently Save Modified Row List || If Left Blank, Changes are Temporary (for this Extract Only) || || Output DSN===> |+--------------------------------------------------------------------+

Figure 67. Confirm Temporary Point-and-Shoot Values

Leave the Output DSN field blank to use the Point-and-Shoot RowList for the current Extract Process only.

Output DSN Name

Extract ProcessNote

Page 148: Move for DB2 User Guide

3. Specify Access Definitions

134 Move for DB2

You can re-enter a Point-and-Shoot session to modify the Start Tableprimary key values that were saved. When the POINT command isentered for a subsequent request during the same session and thechanges were to be temporary, the following is displayed to confirmthat temporary selection is still in effect:

+------------------- Confirm Row List Processing --------------------+ | | | Currently Using a Temporary Start Table Row List | | | |Press ENTER to Continue Using List and Start Point-and-Shoot Session| |Enter END Command to Drop Temporary List and Return to Table List | |Enter CANCEL Command to Cancel POINT Command | +--------------------------------------------------------------------+

Figure 68. Reconfirm Temporary Point-and-Shoot Values

If you change the Start Table and rows had been specified, MOVEnotifies you that the Start Table specifications including Point-and-Shoot values and group selection specifications may be dropped sincethey may no longer be appropriate for the new Start Table.

+------- Drop Start Table Options Confirmation -------------------------+ | | | Start Table Options will be Dropped due to Change of Start Table Name | | | | Press ENTER Key to Confirm Drop of Start Table Options | | Enter END Command to Keep Start Table Options | +-----------------------------------------------------------------------+

Figure 69. Confirm Drop Start Table Options

SubsequentRequests

Changing theStart Table

Page 149: Move for DB2 User Guide

3. Specify Access Definitions

User Manual 135

3.5.16 Row List Status Indicated

After you terminate the Point-and-Shoot session, the SelectTables/Views for AD panel is redisplayed. The Start TableOptions field contains a value indicating whether or not a Row Listhas been defined for the current Access Definition. Assume apermanent Row List has been defined for the Access Definition. TheSelect Tables/Views for AD panel is displayed as:

-- Select Tables/Views for AD: GRP.USER.ADSAMPLE -----------------------------Command ===> Scroll ===> CSR

Primary : COL, SEL, SQL, REL, POINT, GROUP, GET TABLES RELATED, INDENT, ARC Line : COL, SEL, SQL, ALL, GR(A), GP(A), GC(A), EXP, ARC

Default Creator ID ===> PSTDEMO Table 1 of 4 <<MOREStart Table ===> CUSTOMERSStart Table Options : Row List (POINT) R D --Extract Parms--Cmd Status (CreatorID.)Table/View Name F A EveryNth RowLimit Type--- ---------- -------------------------------- --- -------- -------- --------*** ********************************** TOP ***********************************___ COL/SEL CUSTOMERS N ____ ________ TABLE___ SQL ORDERS N N ____ ________ TABLE___ ITEMS N N ____ ________ TABLE___ DETAILS N N ____ ________ TABLE*** ********************************* BOTTOM *********************************

Figure 70. Row List Indicated

Page 150: Move for DB2 User Guide

3. Specify Access Definitions

136 Move for DB2

3.6 Group Selection Processing

MOVE provides group selection processing to enable you to specify asample set of rows from the Start Table with which to start an ExtractProcess. This is especially useful when you want to extract arepresentative sample set of related data for specific data groups.Although other options on the Select Tables/Views for AD panel enableyou to qualify the data to be extracted (i.e., Point-and-Shoot to selectspecific rows, selection criteria, extract every nth row, and so forth),group selection processing enables you to specify that the selected rowsare limited to some number of different values in a specific column andthat a maximum number of rows can be extracted for each value. Forexample, you can specify that five rows from each of ten states are to beextracted from the Start Table.

Group selection processing can be used in combination with most of theother selection criteria. The EveryNth specification and group selectionprocessing are mutually exclusive. For the other types of selectioncriteria, the other criteria is applied first and then the group processing isapplied to the result.

For group selection processing, enter the GROUP command on the SelectTables/Views for AD panel. The following prompt is displayed.

-- Select Tables/Views for AD: GRP.USER.ADSAMPLE -----------------------------Command ===> Scroll ===> CSR

Primary : COL, SEL, SQL, REL, POINT, GROUP, GET TABLES RELATED, INDENT, ARC

+-------------------Start Table Group Selection Processing -----------------+ | | | To select a set of up to ‘N’ rows from each of up to ‘N’ distinct values | | for a specific column, provide the following information: | | | | Column Name to be used for Group ===> | | Number of distinct values to use (M) ===> (1-99999999, *=NO LIMIT) | | Number of rows with each value (N) ===> (1-99999999, *=NO LIMIT) | | | | NOTE: To eliminate Group processing, clear the column name and press ENTER| | Use the LIST command to get a selection list of column names | | A limit must be specified for ‘M’, ‘N’, or both | +---------------------------------------------------------------------------+

Figure 71. Start Table Group Selection Processing

To use group selection processing, you must specify the name of thecolumn in the Start Table to be used for forming groups. Enter this atthe prompt, Column Name to be used for Group. If you are notsure of the names of the columns in the Start Table, use the LISTcommand to display a selection list of the names. When the list isdisplayed, use S to select one.

Column Name

Page 151: Move for DB2 User Guide

3. Specify Access Definitions

User Manual 137

To eliminate group selection processing, clear the Column Name tobe used for Group field.

To simplify the discussion of the prompts for Number of distinctvalues to use and Number of rows with each value, assume theCUSTOMERS table is the Start Table and the STATE column isspecified as the Column Name to be used for Group.

The criteria for selecting the rows can be based on distinct values in theSTATE column. That is, you can specify that a group of rows for somenumber of different states in the STATE column are to be selected. Thestates are selected randomly. However, if you want to define whichstates are to be used, specify them on the Specify Selection Criteriapanel or on the Specify SQL WHERE Clause panel. Since the selectioncriteria is processed first, you can be sure to select rows from only thestates you specified. For example:

• To extract rows for customers from ten different states, specify "10"for the Number of distinct values to use.

You can specify individual state names, a range of names(BETWEEN), and so forth using the other panels for specifyingcriteria. If you specify more than ten names with this other criteria,only ten are used as specified for Number of distinct values to use,but it is indeterminate which of the ten are selected.

• To extract five rows for each of the ten states, specify “5” in theNumber of rows for each value field.

You can use an asterisk to specify that MOVE is to use all rowsfound. For example, specify an asterisk for Number of rows foreach value to obtain all of the rows for each included state.Alternatively, specify an asterisk for Number of distinct values toobtain a specific number of rows from all included states. You canspecify an asterisk for either Number of distinct values or Numberof rows for each value, but not both.

After you have specified the group selection processing options, useENTER or END to return to the Select Tables/Views for AD panel.The status of the group selection processing is displayed in the StartTable Options field.

Distinct ValuesLimit and Numberof Rows for Each

Page 152: Move for DB2 User Guide

3. Specify Access Definitions

138 Move for DB2

In the following figure, group selection processing has been specifiedin addition to a Row List.

-- Select Tables/Views for AD: GRP.USER.ADSAMPLE -----------------------------Command ===> Scroll ===> CSR

Primary: COL, SEL, SQL, REL, POINT, GROUP, GET TABLES RELATED, INDENT, ARC Line: COL, SEL, SQL, ALL, GR(A), GP(A), GC(A), EXP, ARC

Default Creator ID ===> PSTDEMO Table 1 of 4 <<MOREStart Table ===> CUSTOMERSStart Table Options : Row List (POINT), Group Selection (Group) R D --Extract Parms--Cmd Status (CreatorID.)Table/View Name F A EveryNth RowLimit Type--- ---------- -------------------------------- --- -------- -------- --------*** ********************************** TOP ***********************************___ COL/SEL CUSTOMERS N ____ ________ TABLE___ SQL ORDERS N N ____ ________ TABLE___ ITEMS N N ____ ________ TABLE___ DETAILS N N ____ ________ TABLE*** ********************************* BOTTOM *********************************

Figure 72. Group Processing Indicated

Page 153: Move for DB2 User Guide

3. Specify Access Definitions

User Manual 139

3.7 Selecting Relationships

MOVE uses the relationships between the tables specified on theAccess Definition table list to determine the paths by which to extractdata. By default, all of the relationships are used. You can controlwhich relationships are used to extract the data on the SpecifyRelationship Usage panel. On that panel, you can also specify howRI rules influence which rows are extracted based on the parent-to-child and child-to-parent extraction sequence.

These specifications impact only the data to be extracted. Whenrelationship definitions are to be extracted, all relationships, includingunselected relationships and relationships for reference tables, areextracted.

The Specify Relationship Usage panel provides a list of allrelationships between tables on the table list, except tables marked asreference tables. You display this panel by specifying the RELprimary command on the Select Tables/Views for AD panel orselecting PATHS on the EXTRACT Process panel. Relationshipsdefined to the PST Directory are displayed along with the DB2relationships as shown in the following panel:

------------------------ Specify Relationship Usage --------------------------Command ===> Scroll ===> CSR

For Each Relationship Indicate: Rel 1 of 5

Q1: If a Child Row is Included, Include its Parent Row to Satisfy the RI Rule?Q2: If a Parent Row is Included to Satisfy any RI Rule, Include All Child Rows?

Q Q Child --Relation--Cmd Status 1 2 Limit Parent Table Child Table Name Type--- ------ - - ----- ---------------------- ---------------------- -------- --- *********************************** TOP ***********************************___ NEW Y N *CUSTOMERS ORDERS RCO DB2___ NEW Y N *CUSTOMERS ORDERS RTCOR PST___ NEW Y N ORDERS DETAILS ROD DB2___ NEW Y N *DETAILS ITEMS RID DB2___ NEW Y N *DETAILS ITEMS RTDI PST ********************************** BOTTOM *********************************

Figure 73. Specify Relationship Usage Panel

The fields on the panel are:

Cmd Field for line commands. The available linecommands:

SUDI

Select a relationshipUnselect a relationshipDelete an unknown relationshipDisplay information about a relationship

Data only

SpecifyRelationshipUsage Panel

Panel Fields

Page 154: Move for DB2 User Guide

3. Specify Access Definitions

140 Move for DB2

STATUS Indicates the status of the relationship. The possiblevalues:

NEW This relationship is new to the list.Either a new table has been added tothe list or a new relationship has beendefined since this panel was lastdisplayed, or this is the initial displayof the list.

SELECT This relationship is to be used whenextracting data. Any number ofrelationships can be selected.

UNSEL This relationship is not to be usedwhen extracting data.

UNKNWN This relationship is not defined for thelisted tables. This can occur when thedefault Creator ID has been changedand one or more tables listed on thetable list are not fully qualified. As aresult, a relationship that was validwith the previous default Creator ID,is not now valid or was deleted.

The relationships are always groupedby status on the display. The order ofthe possible statuses is NEW,SELECT, UNSEL, and UNKNWN.

The order of the relationships withineach status is determined by the orderin which the parent table is includedon the list of tables on the SelectTables/Views for AD panel.

Q1 Specifies whether the parent row of a selected childrow should be extracted to satisfy RI rules. Specify:

Y Extract all parent rows. Default.

N Do not extract all parent rows. This optionis provided to ensure the referentialintegrity of the retrieved rows, thereforeselection criteria is not applied.

Q2 Specifies whether all children of a parent rowpreviously extracted to satisfy RI rules should be

Page 155: Move for DB2 User Guide

3. Specify Access Definitions

User Manual 141

extracted. This option is only relevant when Q1 isspecified as Y for any relationship where the parenttable in this relationship is the parent.

Y Extract all children

N Do not extract all children. Default.

Sample scenarios to help in clarifying specificationsfor Q1 and Q2 are provided later in this section.

Child Limit Specifies a maximum number of child rows toextract for each parent using a specific relationship.(e.g., Extract five ORDERS for each CUSTOMERSrow using the relationship RCO.)

Specify 0 to direct MOVE to not use the relationshipto extract any child rows for a specific parent. Thisis useful when you include a relationship to preventorphans (extract parents for children) but do notwant to extract additional children.

Do not confuse this specification with the Row Limitparameter on the Select Tables/Views for AD panel.The Row Limit parameter specifies a total number ofrows extracted from the table regardless ofrelationship traversal.

Parent The name of the parent table in the relationship. Thename is listed exactly as specified on the SelectTables/Views for AD panel. The Creator ID isincluded with the table name only when it is includedon the Select Tables/Views for AD panel.

If more than one relationship is defined between twotables with the same parent and child designation, anasterisk, *, is displayed prior to the name of theparent table of each occurrence.

Child The name of the child table in the relationship. Thename is listed exactly as specified on the SelectTables/Views for AD panel. The Creator ID isincluded with the table name only when it is includedon the Select Tables/Views for AD panel.

Relation The name of the relationship.

Page 156: Move for DB2 User Guide

3. Specify Access Definitions

142 Move for DB2

Type The type of relationship. This indicates whether therelationship is defined in the DB2 Catalog or in thePST Directory noted as:

DB2

PST

DB2 Catalog

Directory

The commands QUES1 and QUES2 can be used to change thespecification for Q1 and Q2 respectively to either YES or NO for alllisted relationships. This is useful, for example, when there are manyrelationships and you want to override the default setting for most ofthem or, after making several changes, you want to reset thespecifications to the default.

If necessary, you can create additional relationships using theCREATE RELATIONSHIP command on the Specify RelationshipUsage panel. This displays the panels used to define relationshipsstored in the Princeton Softech Directory. (The Definitions option onthe Main Menu also displays these panels. The information aboutdefining relationships is discussed in Section 4.2 Relationships.)

When you signal that you have completed defining the relationshipusing END or CANCEL, you are returned to the SpecifyRelationship Usage panel. The new relationships that you havedefined between tables on the table list are included in the list ofrelationships and assigned the NEW status.

The following commands are available when the SpecifyRelationship Usage panel is displayed:

BOTTOM INDENT SHOW STEPS CANCEL OPTIONS TOP CREATE PRIMARY KEY OUTPUT UNSELECT CREATE RELATIONSHIP QUES1 UP DELETE QUES2 USE DOWN RESET END SAVE

QUES1/QUES2

CREATERELATIONSHIP

AvailableCommands

Page 157: Move for DB2 User Guide

3. Specify Access Definitions

User Manual 143

3.7.1 Displaying Information

You can display information about a relationship to help in decidingwhich relationships to select. Use the Info line command, I, in theCmd field next to the desired relationship.

In the following figure, information about the relationship RCO isdisplayed in the pop-up window format.

+----------------------- Browse Relationship ------------------------+| || Browse Only Display of DB2 Relationship RCO || || Parent: PSTDEMO.CUSTOMERS Child: PSTDEMO.ORDERS || 1 OF 1 || Column Name Data Type Column Name Data Type || --------------------- ---------- ---------------------- ----------|| ********************************* TOP *****************************|| CUST_ID CH(5) CUST_ID CH(5) ||******************************** BOTTOM ****************************|+--------------------------------------------------------------------+

Figure 74. Relationship Information

The fields on this panel are:

Parent Fully qualified name of the parent table.

Child Fully qualified name of the child table.

Column Name Name of the column or an expression that is to beused in the relationship. Column Name field isprovided for a table under the table name.

Data Type Data type of the columns. In addition to thestandard DB2 data types, this field can containEXPR indicating that the value specified for thecolumn name is an expression whose data type isdetermined when the relationship is used.

Use END or ENTER to return to the Specify Relationship Usagepanel.

Panel Fields

Page 158: Move for DB2 User Guide

3. Specify Access Definitions

144 Move for DB2

3.7.2 Relationship Status

When the Specify Relationship Usage panel is first displayed, therelationships are listed in the order in which the parent tables arelisted on the Select Tables/Views for AD panel. The names of thetables are shown exactly as entered on the Select Tables/Views forAD panel.

The first time a relationship is listed, it is assigned the NEW status asshown in Figure 75. Selecting Relationships for MOVE Functions.

On the relationship list, you can select and unselect relationships to beused for the Extract Process. Use the S line command to select arelationship and U to unselect a relationship.

Any relationship assigned the NEW status that is not explicitlyselected or unselected is automatically assigned a value based on yourresponse to the Use NEW Relationship prompt on the AccessDefinition Parameters panel. If YES is specified for the prompt,NEW relationships are selected and automatically included in theExtract Process. If NO, NEW relationships are not selected.

In Figure 75. Selecting Relationships for MOVE Functions, the firstand third relationships are selected, the second is unselected, and thelast two are not explicitly selected or unselected. Assume theresponse to the prompt Use NEW Relationships is YES. (Thisprompt is displayed on the Access Definitions Parameters panelavailable from the Select Tables/Views for AD panel by entering thePARAMETERS command.)

------------------------ Specify Relationship Usage --------------------------Command ===> Scroll ===> CSR

For Each Relationship Indicate: Rel 1 of 5

Q1: If a Child Row is Included, Include its Parent Row to Satisfy the RI Rule?Q2: If a Parent Row is Included to Satisfy any RI Rule, Include All Child Rows?

Q Q Child --Relation--Cmd Status 1 2 Limit Parent Table Child Table Name Type--- ------ - - ----- ---------------------- ---------------------- -------- --- *********************************** TOP ***********************************s__ NEW Y N *CUSTOMERS ORDERS RCO DB2u__ NEW Y N *CUSTOMERS ORDERS RTCOR PSTs__ NEW Y N ORDERS DETAILS ROD DB2___ NEW Y N *DETAILS ITEMS RID DB2___ NEW Y N *DETAILS ITEMS RTDI PST ******************************** BOTTOM **********************************

Figure 75. Selecting Relationships for MOVE Functions

If the REL command is used again on the Select Tables/Views forAD panel to redisplay the Specify Relationship Usage panel for thisset of tables, the status is revised as shown in the following figure.

NEW Status

Select andUnselect

Revised Status

Page 159: Move for DB2 User Guide

3. Specify Access Definitions

User Manual 145

------------------------ Specify Relationship Usage ---------------------------Command ===> Scroll ===> CSR

For Each Relationship Indicate: Rel 1 of 5

Q1: If a Child Row is Included, Include its Parent Row to Satisfy the RI Rule?Q2: If a Parent Row is Included to Satisfy any RI Rule, Include All Child Rows?

Q Q Child --Relation--Cmd Status 1 2 Limit Parent Table Child Table Name Type--- ------ - - ----- ---------------------- ---------------------- -------- --- *********************************** TOP ***********************************___ SELECT Y N *CUSTOMERS ORDERS RCO DB2___ SELECT Y N ORDERS DETAILS ROD DB2___ SELECT Y N *DETAILS ITEMS RID DB2___ SELECT Y N *DETAILS ITEMS RTDI PST___ UNSEL Y N *CUSTOMERS ORDERS RTCOR PST ******************************** BOTTOM ***********************************

Figure 76. Status Revised

The revised status is shown in the STATUS field and in the positionof the relationship on the list. Selected relationships have theSELECT status; unselected relationships have the UNSEL status.Those relationships that were not specifically selected or unselected,have the SELECT status based on the response to the Use NEWRelationships prompt.

Relationships are added and deleted from the list by changes made onthe Select Tables/Views panel and by changes to the relationshipdefinitions.

Additional relationships may be included on the list when:

• Tables are added on the Select Tables/Views for AD panel.

• New relationships are created.

• The Default Creator ID is changed.

Any relationship that is added to the list is automatically assigned theNEW status and placed at the beginning of the list.

New relationships are included on the list when the SpecifyRelationship Usage panel is displayed or the Extract Process isinvoked. The Extract Process can be invoked without displaying thepanel and selecting or unselecting the new relationships. A warningmessage is displayed, but the Extract Process can proceed.

Since this default action may not be what you intended, you shoulddisplay the Specify Relationship Usage panel to handle changes tothe relationship list. In fact, it is recommended that you display theSpecify Relationship Usage panel any time you modify the tablenames or Creator ID of one or more tables on the Select

Page 160: Move for DB2 User Guide

3. Specify Access Definitions

146 Move for DB2

Tables/Views for AD panel to ensure that the desired relationshipsand traversal paths are used.

Assume the Select Tables/Views for AD panel is redisplayed and theSALES table is added to the list. When the REL command is entered,the list is revised to include any additional relationships pertinent tothe added table. In the following figure, all relationships with a NEWstatus are listed first, followed by the SELECT status, and then theUNSEL status.

------------------------ Specify Relationship Usage ---------------------------Command ===> Scroll ===> CSR

For Each Relationship Indicate: Rel 1 of 7

Q1: If a Child Row is Included, Include its Parent Row to Satisfy the RI Rule?Q2: If a Parent Row is Included to Satisfy any RI Rule, Include All Child Rows?

Q Q Child --Relation--Cmd Status 1 2 Limit Parent Table Child Table Name Type--- ------ - - ----- ---------------------- ---------------------- -------- --- *********************************** TOP ***********************************___ NEW Y N CUSTOMERS SALES RCS DB2___ NEW Y N ORDERS SALES RTOS PST___ SELECT Y N *CUSTOMERS ORDERS RCO DB2___ SELECT Y N ORDERS DETAILS ROD DB2___ SELECT Y N *DETAILS ITEMS RID DB2___ SELECT Y N *DETAILS ITEMS RTDI PST___ UNSEL Y N *CUSTOMERS ORDERS RTCOR PST ********************************** BOTTOM ********************************

Figure 77. Specify Relationship Usage Panel Redisplayed

All NEW relationships are automatically assigned a status based onthe response to the prompt Use NEW Relationship.

Relationships that are defined between displays of the SpecifyRelationship Usage panel are handled in the same manner asrelationships added to the list because a new table has been included.

You can specify the USE NEW command to change all relationshipswith the NEW status to the SELECT status. You can specify USEALL, to change all relationships with either the NEW status or theUNSEL status to the SELECT status.

Changing the Default Creator ID on the Select Tables/Views for ADpanel can have an impact on the relationship list. The Default CreatorID affects all of the tables that are not explicitly qualified with aCreator ID.

Frequently, sets of tables that differ only by Creator ID use comparablerelationships with the same names. In those instances, MOVE identifiesthe same names and maintains the assigned status. However, when asame-name relationship is not defined for both sets, any previously listed

Add a TableAn Example

New Relationships

USE Command

Creator IDChanged

UNKNWN Status

Page 161: Move for DB2 User Guide

3. Specify Access Definitions

User Manual 147

relationships are assigned the UNKNWN status and any newrelationships are assigned the NEW status.

Note that when you change the Creator ID of individual tables,MOVE handles this as if the original name was deleted and a newtable name has been supplied.

Assume the Default Creator ID has been changed causing two newrelationships to be added and an existing relationship to becomeunknown. The other relationships are the same. In the followingfigure, the two new relationships are added at the top of the list. Theunknown relationship is placed at the bottom of the list. The otherrelationships maintain their previous status.

------------------------ Specify Relationship Usage ---------------------------Command ===> Scroll ===> CSR

For Each Relationship Indicate: Rel 1 of 9

Q1: If a Child Row is Included, Include its Parent Row to Satisfy the RI Rule?Q2: If a Parent Row is Included to Satisfy any RI Rule, Include All Child Rows?

Q Q Child --Relation--Cmd Status 1 2 Limit Parent Table Child Table Name Type--- ------ - - ----- ---------------------- ---------------------- -------- --- *********************************** TOP ***********************************___ NEW Y N *ORDERS DETAILS RTOD PST___ NEW Y N *ORDERS SALES RTOSI PST___ SELECT Y N *CUSTOMERS ORDERS RCO DB2___ SELECT Y N CUSTOMERS SALES RCS DB2___ SELECT Y N *ORDERS DETAILS ROD DB2___ SELECT Y N *DETAILS ITEMS RID DB2___ SELECT Y N *DETAILS ITEMS RTDI PST___ UNSEL Y N *CUSTOMERS ORDERS RTCOR PST___ UNKNWN Y N *ORDERS SALES RTOS PST ********************************* BOTTOM **********************************

Figure 78. Unknown Relationship

You can use the Delete line command, D, to delete any relationshipfrom the list that is UNKNWN. However, since you can use the sameAccess Definition for similar sets of tables with different Creator ID's,you may decide to retain the unknown relationships on the list. Thatminimizes your efforts if you intend to use the same Access Definitionmultiple times and change only the Creator ID. MOVE retains theoriginal status of all relationships that are unknown and reapplies thatstatus when the Creator ID is modified such that the relationship isapplicable.

This does not impact the performance of MOVE processing.Unknown relationships are ignored.

If tables are added, new relationships are created, or the Creator ID ismodified, the list of relationships is not automatically revised and thechanges are not immediately incorporated into the Access Definition.

Change DefaultCreator IDAn Example

Delete UNKNOWN

Important Note

Page 162: Move for DB2 User Guide

3. Specify Access Definitions

148 Move for DB2

These changes are incorporated when the REL command is executedor the Extract Process is invoked.

These changes can result in NEW and UNKNWN relationships. Ifthey are not handled explicitly on the Specify Relationship Usagepanel, warning messages are issued when the Extract Process isperformed. (For more information about the Extract Process, seeSection 5.2.3 Perform the Extract Process.)

The Start Table is always included in the MOVE process. To includeother tables, a relationship is required. A table included in the AccessDefinition is not traversed if it is not part of a selected relationship.In fact, if you unselect all of the relationships, only rows from theStart Table are extracted. Any number of relationships can beselected or unselected.

You can use the OUTPUT command to direct the contents of thedisplayed text to an output file or SYSOUT. (If you want the report toinclude traversal information, use SHOW STEPS discussed below.)

3.7.3 Displaying Traversal Information

After you have completed the Specify Relationships Usage panel,you can request information about how the extract will be performedusing the SHOW STEPS command. This information is used toensure that the extracted data and the traversal paths used to extractthe data are as you expect.

The SHOW STEPS command evaluates the specified tables andrelationships and displays the series of steps that will be performed toaccomplish an Extract Process.

Assume data is to be extracted from three tables, CUSTOMERS,ORDERS, and DETAILS. The CUSTOMERS table is the StartTable. The ORDERS table is a child of CUSTOMERS, andDETAILS is a child of ORDERS. The SHOW STEPS text isdisplayed as:

Step 1: Extract Rows from Start Table PSTDEMO.CUSTOMERS. Row List is usedand Determines the Rows Selected.

Step 2: Extract Rows from PSTDEMO.ORDERS which are Children of RowsPreviously Extracted from PSTDEMO.CUSTOMERS in Step 1 usingRelationship RCO.

Step 3: Extract Rows from PSTDEMO.DETAILS which are Children of RowsPreviously Extracted from PSTDEMO.ORDERS in Step 2 usingRelationship ROD.

OUTPUTcommand

SHOW STEPSCommand

SHOW STEPSExample

Page 163: Move for DB2 User Guide

3. Specify Access Definitions

User Manual 149

The text for the first step, extracting from the Start Table, variesdepending on the specifications for the Extract Process.

• When a Point-and-Shoot list is used (as shown in the example):

Row List is used and Determines the Rows Selected.

• When Selection Criteria and/or Statistical Controls are usedwithout a Point-and-Shoot list:

Selection Criteria and/or Statistical Controls are used and Determine the RowsSelected.

• When there is no selection criteria, statistical controls, or Point-and-Shoot list, all rows are extracted from the Start Table:

No Row List, Selection Criteria or Statistical Controls used, therefore StartTable does not need to be Revisited, even if part of a Cycle.

This simple example does not reflect the potential complexity.Extract steps can be repeated any number of times based onrelationships and specifications on the Specify Relationship Usagepanel. A single step can extract rows from more than one table orextract rows from one table to satisfy more than one relationship. Forexample, if the DETAILS table is related to both the CUSTOMERStable and the ORDERS table, Step 3 is:

Step 3: Extract Rows from PSTDEMO.DETAILS which are Children of RowsPreviously Extracted from PSTDEMO.CUSTOMERS in Step 1 usingRelationship RCD.--AND--Extract Rows from PSTDEMO.DETAILS which are Children of RowsPreviously Extracted from PSTDEMO.ORDERS in Step 2 using RelationshipROD.

Any table may be revisited multiple times in successive steps. Cyclesmay be involved causing a set of tables to be traversed iteratively untila complete pass through the cycle does not result in extracting anyadditional rows.

Based on the information provided by SHOW STEPS, you canrespecify the relationship usage and execute the SHOW STEPScommand again.

All of the standard ISPF scrolling commands are available whiledisplaying the SHOW STEPS text.

Also, you may use the OUTPUT command to direct the contents ofthe SHOW STEPS display and the Specify Relationship Usage panelto an output file or SYSOUT. You are prompted for the outputparameters and, based on your responses, MOVE writes the output tothe specified destination.

Use END to return to the Specify Relationship Usage panel.

Handling the Text

Page 164: Move for DB2 User Guide

3. Specify Access Definitions

150 Move for DB2

On the Specify Relationship Usage panel, use the END command toreturn to the Select Tables/Views for AD panel. Use the CANCELcommand to remove all changes made on the current panel and returnto the Select Tables/Views for AD panel.

3.7.4 Generating a Relationship Usage Report

In addition to displaying how the extract is to be performed, you mayneed to report on the specifications on the Relationship Usage panel.This is especially helpful when troubleshooting.

Use the OUTPUT command to request the report. MOVE copies theinformation on the Relationship Usage panel and displays promptsfor the information to direct the output to a destination of your choice.The output is formatted similarly to the presentation on the panel.(For details on the OUTPUT command, see the Relational ToolsCommand Reference Manual.)

END and CANCELCommands

Page 165: Move for DB2 User Guide

3. Specify Access Definitions

User Manual 151

3.8 Using Relationships

MOVE uses the relationships between tables to determine thetraversal path for extracting data. You specify which relationshipsare traversed from table to table and how those relationships are usedon the Specify Relationship Usage panel.

3.8.1 Sample Scenarios

A simple database structure is used throughout the examples in thissection to explain the specifications on the Specify RelationshipUsage panel. This structure includes four tables: CUSTOMERS,ORDERS, DETAILS, and ITEMS. CUSTOMERS is the parent ofORDERS, ORDERS, and ITEMS are parents of DETAILS.

The most common traversal is to begin at the Start Table and proceedthrough the data model traversing all relationships from parent tochild. For example, if the Start Table is CUSTOMERS, MOVEautomatically traverses down to ORDERS and DETAILS.

Using the Specify Relationship Usage panel, you can alter thetraversal path by unselecting and selecting relationships. In addition,there are two specifications that you can use to expand the traversalpath. These are designated Q1 and Q2 on the panel shown in Figure79. Default Specifications for Q1 and Q2.

These specifications are relevant when:

• The Start Table is a child table. For example, when theORDERS table is the Start Table, these specifications determinewhether the related CUSTOMERS rows are extracted.

• A table has more than one parent table. For example, when theITEMS table is the Start Table, rows are extracted from theDETAILS table automatically because it is a child of the ITEMS

Basic TraversalPath

Alter TraversalPath

Page 166: Move for DB2 User Guide

3. Specify Access Definitions

152 Move for DB2

table. However, since the ORDERS table is also a parent of theDETAILS table, you specify whether the related ORDERS rowsare extracted by traversing from child to parent.

The first question, Q1, determines whether MOVE follows arelationship from child to parent to extract data. By default, Q1 is Yor Yes, MOVE should follow the relationship from child to parent.This default behavior ensures the relational integrity of the extracteddata. A parent row is extracted for every child row.

In the following figure, the default for Q1, Yes, is shown for all threerelationships.

------------------------ Specify Relationship Usage ---------------------------Command ===> Scroll ===> CSR

For Each Relationship Indicate: Rel 1 of 3

Q1: If a Child Row is Included, Include its Parent Row to Satisfy the RI Rule?Q2: If a Parent Row is Included to Satisfy any RI Rule, Include All Child Rows?

Q Q Child --Relation--Cmd Status 1 2 Limit Parent Table Child Table Name Type--- ------ - - ----- ---------------------- ---------------------- -------- --- *********************************** TOP ***********************************___ SELECT Y N CUSTOMERS ORDERS RCO DB2___ SELECT Y N ORDERS DETAILS ROD DB2___ SELECT Y N ITEMS DETAILS RID DB2 ********************************* BOTTOM **********************************

Figure 79. Default Specifications for Q1 and Q2

Assume you need to extract all of the related ORDERS, DETAILS,and ITEMS rows for a specific set of customers. You can:

1. Specify CUSTOMERS as the Start Table.

2. Specify selection criteria for the desired set of CUSTOMERS.

3. Set Q1 for relationship RID between ITEMS, and DETAILS toYes.

MOVE extracts the selected CUSTOMERS rows, then follows therelationship RCO to extract the related child rows in the ORDERStable. Next, MOVE follows the relationship ROD between ORDERSand DETAILS to extract the child rows in the DETAILS table. Sincethe ITEMS table is a parent to the DETAILS table, Q1 must be Yesto direct MOVE to follow the relationship RID from child to parentand obtain the ITEMS related to the extracted DETAILS.

The second question, Q2, determines whether additional child rowsare extracted if a parent row has been extracted because of Q1. Inother words, if MOVE has followed a relationship from child to

Q1

Multiple ParentTables

Q2

Page 167: Move for DB2 User Guide

3. Specify Access Definitions

User Manual 153

parent and extracted a parent row, additional children of that parentare extracted when Q2 is Yes.

Assume you need to extract a set of CUSTOMERS and all of theirORDERS beginning with specific criteria for the ORDERS. Youcan:

1. Specify ORDERS as the Start Table.

2. Specify selection criteria for the desired set of ORDERS.

3. Set Q1 and Q2 for relationship RCO to Yes as shown in thefollowing figure.

------------------------ Specify Relationship Usage ---------------------------Command ===> Scroll ===> CSR

For Each Relationship Indicate: Rel 1 of 1

Q1: If a Child Row is Included, Include its Parent Row to Satisfy the RI Rule?Q2: If a Parent Row is Included to Satisfy any RI Rule, Include All Child Rows?

Q Q Child --Relation--Cmd Status 1 2 Limit Parent Table Child Table Name Type--- ------ - - ----- ---------------------- ---------------------- -------- --- *********************************** TOP ***********************************___ SELECT Y Y CUSTOMERS ORDERS RCO DB2 ********************************* BOTTOM **********************************

Figure 80. Both Q1 and Q2 Set to Yes

Consider the following example. Customer B has three orders: 1, 2,and 3. Using Point-and-Shoot, with the ORDERS table as the StartTable, only the row for order 2 is selected. Q1 and Q2 are YES forthe relationship RCO between CUSTOMERS and ORDERS.

The rows are extracted in the sequence shown in the following figure.

STEPS

1. The ORDERS row 2is extracted based onthe Point-and-Shootselection.

1. The CUSTOMERSrow is extractedbecause of Q1.

2. ORDERS rows 1 and3 are extractedbecause of Q2.

Since Q2 is Yes, MOVE also extracts the other ORDERS rows thatare children of the extracted CUSTOMERS rows.

Child as StartTable

Page 168: Move for DB2 User Guide

3. Specify Access Definitions

154 Move for DB2

Note any rows extracted from a table because of Q2 must meet theselection criteria specified for that table. In addition, they are subjectto the statistical controls.

Consider another example. Orders are shipped only when all itemsare available. If any one of the ordered items is out of stock, the orderis not shipped to the customer.

Assume you need to determine which orders are outstanding becauseof a specific out-of-stock item. The set of extracted data shouldcontain the full details of all of the orders. To obtain completeinformation, data is to be extracted from the CUSTOMERS,ORDERS, DETAILS, and ITEMS tables.

1. Specify the ITEMS table as the Start Table.

2. Specify the selection criteria that extracts the out-of-stock ITEMSrow. (Extract the item with a quantity of 0.)

3. Specify the Specify Relationship Usage panel as shown in thefollowing figure. Note that Q2 is YES for only the relationshipROD.

------------------------ Specify Relationship Usage ---------------------------Command ===> Scroll ===> CSR

For Each Relationship Indicate: Rel 1 of 3

Q1: If a Child Row is Included, Include its Parent Row to Satisfy the RI Rule?Q2: If a Parent Row is Included to Satisfy any RI Rule, Include All Child Rows?

Q Q Child --Relation--Cmd Status 1 2 Limit Parent Table Child Table Name Type--- ------ - - ----- ---------------------- ---------------------- -------- --- *********************************** TOP ***********************************___ SELECT Y N CUSTOMERS ORDERS RCO DB2___ SELECT Y Y ORDERS DETAILS ROD DB2___ SELECT Y N ITEMS DETAILS RID DB2 ********************************* BOTTOM **********************************

Figure 81. Set Q2 to Yes for One Relationship

The extract process proceeds as follows:

Child to parent formultiplerelationships

Page 169: Move for DB2 User Guide

3. Specify Access Definitions

User Manual 155

After the specified ITEMS rows are selected, the related DETAILSare extracted by traversing the relationship RID from parent to child.

STEPS

1. The single ITEMS rowwith a quantity of zerois extracted based onthe selection criteria.

2. The DETAILS rowscontaining the item areextracted because ofthe parent to childtraversal ofrelationship RID.

The ORDERS related to the DETAILS are extracted, followed by theCUSTOMERS related to the ORDERS.

3. The ORDERS that arerelated to theseDETAILS are extractedby traversing therelationship ROD fromchild to parent becauseQ1 is Yes.

4. The CUSTOMERSthat placed theseORDERS are extractedby traversing therelationship RCO fromchild to parent becauseQ1 is Yes.

The additional DETAILS related to these ORDERS are extracted.

5. The other DETAILS thatare part of the ORDERSare extracted because Q2is Yes for the relationshipbetween ORDERS andDETAILS.

The ITEMS for the additional extracted DETAILS are extracted.

ITEMS to DETAILS

DETAILS toORDERS

ORDERS toCUSTOMERS

ORDERS toDETAILS

Page 170: Move for DB2 User Guide

3. Specify Access Definitions

156 Move for DB2

6. The ITEMS for theadditional DETAILS areextracted because Q1is Yes for therelationship betweenITEMS and DETAILS.

Only the ORDERS for the selected ITEMS are extracted. AdditionalORDERS for the extracted CUSTOMERS are not obtained becauseQ2 is No for the relationship RCO between CUSTOMERS andORDERS.

Q2 allows you to direct MOVE to extract additional children. Thatis, if parent rows are extracted to satisfy Q1 (make the set ofextracted data referentially-intact), the additional children to thoseparents are also extracted.

There are tables that are parent to more than one child table. Thespecifications for Q1 and Q2 are applied only to each pair of tablesthat have a relationship between them.

For example, if a row of the CUSTOMERS table is extracted becauseQ1 is Yes for the relationship between CUSTOMERS and ORDERS,then Q2 for that relationship only applies to related rows from theORDERS table. To extract data from other child tables, Q2 wouldhave to be set to Yes for those relationships.

Assume the SHIP_TO and the ORDERS tables are children of theCUSTOMERS table. To obtain the shipping information for specificorders, you can:

1. Specify the ORDERS table as the Start Table.

2. Specify the selection criteria for the desired set of ORDERS.

3. Set Q1 and Q2 on the Specify Relationship Usage panel asshown in the following figure.

------------------------ Specify Relationship Usage ---------------------------Command ===> Scroll ===> CSR

For Each Relationship Indicate: Rel 1 of 2

Q1: If a Child Row is Included, Include its Parent Row to Satisfy the RI Rule?Q2: If a Parent Row is Included to Satisfy any RI Rule, Include All Child Rows?

Q Q Child --Relation--Cmd Status 1 2 Limit Parent Table Child Table Name Type--- ------ - - ----- ---------------------- ---------------------- -------- --- *********************************** TOP ***********************************___ SELECT Y N CUSTOMERS ORDERS RCO DB2___ SELECT Y Y CUSTOMERS SHIP_TO RCST PST *********************************** BOTTOM ********************************

Figure 82. Set Q1 and Q2 for Multiple Children

DETAILS to ITEMS

No AdditionalORDERS

Summary

Multiple Children

Page 171: Move for DB2 User Guide

3. Specify Access Definitions

User Manual 157

The extract process proceeds as follows:

STEPS

1. A single ORDERS rowis extracted based on theselection criteria.

2. The CUSTOMERS rowis extracted because Q1 isYes for the relationshipRCO betweenCUSTOMERS andORDERS.

3. The SHIP_TO row isextracted because Q2 isYes for the relationshipRCST betweenCUSTOMERS andSHIP_TO.

3.8.2 Traversal Cycles

MOVE can be directed to cycle through tables to extract the data.These "traversal cycles" depend on the specifications for eachrelationship.

Extending the example on page 154 for extracting all of the relateddata about orders for out-of-stock item, a traversal cycle results byextracting all of the items with a quantity of zero that have beenordered and then traversing as noted by the following steps to obtain acomplete set of orders.

ORDERS toCUSTOMERS toSHIP_TO

Page 172: Move for DB2 User Guide

3. Specify Access Definitions

158 Move for DB2

ITEMS is the Start Table. (Note, the CUSTOMERS table is not usedin this example. The relationship between CUSTOMERS andORDERS, RCO, is unselected.) The Specify Relationship Usagepanel is defined as shown in the following figure:

------------------------ Specify Relationship Usage ---------------------------Command ===> Scroll ===> CSR

For Each Relationship Indicate: Rel 1 of 3

Q1: If a Child Row is Included, Include its Parent Row to Satisfy the RI Rule?Q2: If a Parent Row is Included to Satisfy any RI Rule, Include All Child Rows?

Q Q Child --Relation--Cmd Status 1 2 Limit Parent Table Child Table Name Type--- ------ - - ----- ---------------------- ---------------------- -------- --- *********************************** TOP ***********************************___ UNSEL Y N CUSTOMERS ORDERS RCO DB2___ SELECT Y Y ORDERS DETAILS ROD DB2___ SELECT Y N ITEMS DETAILS RID DB2 ********************************** BOTTOM *********************************

Figure 83. Set Q1 and Q2 for Multiple Relationships

The following steps are performed for this traversal cycle:

1. Extract the ITEMS with a quantity of zero.

2. Extract the DETAILS related to those ITEMS by traversingthe relationship RID from parent to child.

3. Extract the ORDERS related to the DETAILS by traversingthe relationship ROD from child to parent. (Q1 is YES.)

4. Extract the additional DETAILS for those ORDERS bytraversing the relationship ROD from parent to child. (Q2 isYES.)

5. Extract the ITEMS related to the additional DETAILS bytraversing the relationship RID from child to parent. (Q1 isYES.)

One complete cycle is made. MOVE began with the ITEMS tableand ended at the ITEMS table.

MOVE can also process multiple traversal cycles. Although unlikely,the previous example can be extended to show multiple traversalcycles.

After extracting the ITEMS rows for the additional items in Step 5,you may want to extract the ORDERS and DETAILS for theseITEMS. To accomplish this, Q2 for the relationship RID is set toYES. After Step 5 in the example, MOVE traverses the relationship

Multiple TraversalCycles

Page 173: Move for DB2 User Guide

3. Specify Access Definitions

User Manual 159

RID from parent to child to extract the remaining DETAILS relatedto these additional ITEMS. Then Steps 3, 4, and 5 are repeated toextract additional ORDERS, the DETAILS related to thoseORDERS, the ITEMS related to those DETAILS, and so on.

3.8.3 Referential Cycles

MOVE can extract data from tables that are related to each other byreferential cycles. With a referential cycle, you start at one table andreturn to it after traversing a series of one or more relationships. (Incontrast, many DB2 databases are defined as hierarchies or networks.To extract data, you proceed up or down through the hierarchy or thenetwork and never return to the Start Table.)

For this discussion, assume there are two tablesDEPARTMENTand EMPLOYEE. The tables are defined as:

DEPT_ID is the primary key of the DEPARTMENT table; EMP_IDis the primary key of the EMPLOYEE table.

The relationships are shown in the following figure:

Two Tables

Relationship

Page 174: Move for DB2 User Guide

3. Specify Access Definitions

160 Move for DB2

The data in each table is as follows:

The following is a sample company organization chart with pertinentvalues in the tables.

In the following pages a sample query is used to demonstrate how tohandle cyclic relationships through the specifications for Q1 and Q2.Changing these specifications changes the set of data extracted fromthese tables.

Page 175: Move for DB2 User Guide

3. Specify Access Definitions

User Manual 161

Extract all of the employees in the Development Department,including those employees that are members of subordinatedepartments.

The DEPARTMENT table is the Start Table. The Point-and-Shootfacility is used to select the appropriate row in the DEPARTMENTtable. Since MOVE needs to follow the existing relationships onlyfrom parent to child, specifications for Q1 and Q2 are set to No asshown in the following figure:

------------------------ Specify Relationship Usage ---------------------------Command ===> Scroll ===> CSR

For Each Relationship Indicate: Rel 1 of 2

Q1: If a Child Row is Included, Include its Parent Row to Satisfy the RI Rule?Q2: If a Parent Row is Included to Satisfy any RI Rule, Include All Child Rows?

Q Q Child --Relation--Cmd Status 1 2 Limit Parent Table Child Table Name Type--- ------ - - ----- ---------------------- ---------------------- -------- --- *********************************** TOP ***********************************___ SELECT N N DEPARTMENT EMPLOYEE MEMBER DB2___ SELECT N N EMPLOYEE DEPARTMENT MANAGER DB2 *********************************** BOTTOM ********************************

Figure 84. Set Q1 and Q2 to NO

The following steps are performed by MOVE to extract the data:

1. Extract the row containing the Development Department,Dept_ID=‘D’, from the DEPARTMENT table.

2. Using the relationship MEMBER, search the EMPLOYEES tablefor all employees in the Development Department,EMPLOYEE.DEPT_ID=‘D’. Three EMPLOYEE rows areextracted:

EMP_ID = 9EMP_ID = 10EMP_ID = 11

3. The relationship MANAGER is used to search theDEPARTMENT table to determine if any of the extractedemployees are managers. The employee with EMP_ID = 9,Meghan, is a manager of the Support Department, DEPT_ID =‘F’. This row is extracted from the DEPARTMENT table.

4. The relationship MEMBER is used to search the EMPLOYEEtable to extract all employees that belong to the SupportDepartment, DEPT_ID = ‘F’.

Example 1

Page 176: Move for DB2 User Guide

3. Specify Access Definitions

162 Move for DB2

Two EMPLOYEE rows are extracted:

EMP_ID = 14EMP_ID = 15

5. The relationship MANAGER is used to search theDEPARTMENT table to determine if either of the two extractedrows in step 4 are managers. They are not. MOVE does notextract any more rows.

Two rows are extracted from the DEPARTMENT table:

DEPT_ID = 'D'DEPT_ID = 'F'

Five rows are extracted from the EMPLOYEE table:

EMP_ID = 9EMP_ID = 10EMP_ID = 11EMP_ID = 14EMP_ID = 15

In addition to all of the employees in the Development Departmentand subordinate departments, extract the manager of the DevelopmentDepartment.

As with Example 1, the DEPARTMENT table is the Start Table andthe row in the DEPARTMENT table where DEPT_ID = ‘D’ isselected during Point-and-Shoot. To extract the manager of theDevelopment Department, the relationship MANAGER must betraversed from child to parent. Q1 for the relationship MANAGER ischanged to Yes as shown in the following figure:

------------------------ Specify Relationship Usage ---------------------------Command ===> Scroll ===> CSR

For Each Relationship Indicate: Rel 1 of 2

Q1: If a Child Row is Included, Include its Parent Row to Satisfy the RI Rule?Q2: If a Parent Row is Included to Satisfy any RI Rule, Include All Child Rows?

Q Q Child --Relation--Cmd Status 1 2 Limit Parent Table Child Table Name Type--- ------ - - ----- ---------------------- ---------------------- -------- --- *********************************** TOP ***********************************___ SELECT N N DEPARTMENT EMPLOYEE MEMBER DB2___ SELECT Y N EMPLOYEE DEPARTMENT MANAGER DB2 ********************************** BOTTOM *********************************

Figure 85. Set Q1 to Extract Parent

Summary

Example 2

Page 177: Move for DB2 User Guide

3. Specify Access Definitions

User Manual 163

The steps shown for Example 1 are performed by MOVE to extractthe data. In addition, Step 2 will also traverse the relationshipMANAGER from child, EMPLOYEE, to parent, DEPARTMENT.Thus, MOVE extracts the manager of the Development Department,Laurie. An additional row from the EMPLOYEE table is extracted,EMP_ID = 4.

In addition to all of the employees in the Development Departmentand the manager of the Development Department, extract any otherdepartments this manager manages.

To obtain these other departments, both Q1 and Q2 for therelationship MANAGER are set to Yes as shown in the followingfigure:

------------------------ Specify Relationship Usage ---------------------------Command ===> Scroll ===> CSR

For Each Relationship Indicate: Rel 1 of 2

Q1: If a Child Row is Included, Include its Parent Row to Satisfy the RI Rule?Q2: If a Parent Row is Included to Satisfy any RI Rule, Include All Child Rows?

Q Q Child --Relation--Cmd Status 1 2 Limit Parent Table Child Table Name Type--- ------ - - ----- ---------------------- ---------------------- -------- --- *********************************** TOP ***********************************___ SELECT N N DEPARTMENT EMPLOYEE MEMBER DB2___ SELECT Y Y EMPLOYEE DEPARTMENT MANAGER DB2 ********************************** BOTTOM *********************************

Figure 86. Set Q1 and Q2 to YES

In this example, after MOVE has extracted Laurie from theEMPLOYEE table, it follows the MANAGER relationship fromparent to childfrom EMPLOYEE to DEPARTMENT. MOVEchecks the DEPARTMENT table to determine whether Laurie ismanager of any other department. Based on the sample employeehierarchy used for these examples, no additional rows are extracted.Laurie manages only one department.

Example 3

Page 178: Move for DB2 User Guide

3. Specify Access Definitions

164 Move for DB2

In addition to all of the employees in the Development Department,the manager of the Development Department, and any otherdepartments these extracted managers manage, extract any otherdepartments of which the manager is a member.

To obtain the other departments to which the manager is a member,Q1 for the relationship MEMBER is set to Yes as shown in thefollowing figure:

------------------------ Specify Relationship Usage ---------------------------Command ===> Scroll ===> CSR

For Each Relationship Indicate: Rel 1 of 2

Q1: If a Child Row is Included, Include its Parent Row to Satisfy the RI Rule?Q2: If a Parent Row is Included to Satisfy any RI Rule, Include All Child Rows?

Q Q Child --Relation--Cmd Status 1 2 Limit Parent Table Child Table Name Type--- ------ - - ----- ---------------------- ---------------------- -------- --- *********************************** TOP ***********************************___ SELECT Y N DEPARTMENT EMPLOYEE MEMBER DB2___ SELECT Y Y EMPLOYEE DEPARTMENT MANAGER DB2 ********************************** BOTTOM *********************************

Figure 87. Set Q1 to YES

In this example, after MOVE has extracted Laurie from theEMPLOYEE table, it follows the MEMBER relationship from childto parent, from EMPLOYEE to DEPARTMENT. MOVE checks theDEPARTMENT table to determine whether Laurie is a member ofany other department. Laurie is a member of the ExecutiveDepartment. An additional row from the DEPARTMENT table isextracted, DEPT_ID = ‘A’.

Since Q1 is Yes for the MANAGER relationship, MOVE follows thisrelationship from child to parent, from DEPARTMENT toEMPLOYEE, and extracts the manager of the Executive Department,Fred. An additional row from the EMPLOYEE table is extracted,EMP_ID = 1.

Example 4

Page 179: Move for DB2 User Guide

3. Specify Access Definitions

User Manual 165

Extract only the employees that are members of the DevelopmentDepartment. Unlike Example 1, do not extract employees insubordinate departments.

To obtain only the employees in the Development Department, Q1and Q2 are set to No for the relationship MEMBER. In addition, therelationship MANAGER is unselected. This relationship is not to betraversed as shown in the following figure:

------------------------ Specify Relationship Usage ---------------------------Command ===> Scroll ===> CSR

For Each Relationship Indicate: Rel 1 of 2

Q1: If a Child Row is Included, Include its Parent Row to Satisfy the RI Rule?Q2: If a Parent Row is Included to Satisfy any RI Rule, Include All Child Rows?

Q Q Child --Relation--Cmd Status 1 2 Limit Parent Table Child Table Name Type--- ------ - - ----- ---------------------- ---------------------- -------- --- *********************************** TOP ***********************************___ SELECT N N DEPARTMENT EMPLOYEE MEMBER DB2___ UNSEL N N EMPLOYEE DEPARTMENT MANAGER DB2 *********************************** BOTTOM ********************************

Figure 88. Unselect to Disable RI Cycle

This disables the RI cycle. MOVE extracts the DEPARTMENT rowfor the Development Department. Then, using the relationshipMEMBER, traverses from parent to child to extract the threeemployees in the department. Since the MANAGER relationship isunselected, it is not traversed. The extract is complete.

Example 5

Disabling RICycles

Page 180: Move for DB2 User Guide

3. Specify Access Definitions

166 Move for DB2

3.9 Dynamically Defining the Access Definition

You can define several of the specifications for the Access Definitiondynamically when you invoke the editor from the Main Menu optionor the Definitions Menu option. Using the BROWSE command, youinvoke a browse session for the set of data defined by the AccessDefinition. During this session you can "join" to tables not includedin the Access Definition and specify sort and selection criteria for anyof the tables as you display the data.

This dynamic capability provides another means of defining anAccess Definition. Rather than respond to the prompts, you can viewthe set of data you want to define to ensure the correct definition.However, these dynamic specifications are saved in the AccessDefinition only if you are editing the definition from the Main Menuoption or the Definitions Menu option. If you browse while editingan Access Definition from the Extract option on the MigrationMenu, the dynamic specifications are not saved in the AccessDefinition. (Also, any dynamic specifications you make during aPoint-and-Shoot session are not saved.)

For the most part, the facilities available when browsing are the sameas those provided during a Point-and-Shoot session and are notdiscussed here. Based on the Access Definition parameters, thefollowing facilities are also available when editing the AccessDefinition from the Main Menu option or the Definitions Menuoption.

• The NEW operand is available on the JOIN command enablingusers to specify the name of a table not currently in the AccessDefinition. The new, joined table and any pertinent relationshipsare automatically included in the Access Definition. (Only thetables in the Access Definition may be displayed during Point-and-Shoot or when browse is invoked from the Extract Process.)

• All specifications for sort and selection criteria are included in theAccess Definition. (These are not included when specified from aPoint-and-Shoot session or when the editor is invoked from theExtract Process.)

The Group Selection Processing and random factors are ignored whenobtaining the set of data for browsing or for Point-and-Shoot becausethe set of selected rows is arbitrary and may vary for each session.

Page 181: Move for DB2 User Guide

3. Specify Access Definitions

User Manual 167

3.10 Database Changes

An Access Definition can be affected by changes to the database. Theextent of the effect is determined by what is changed and whether ornot it is directly referenced in the Access Definition. The followinglists the possible changes and the potential impact.

When a column is added to a table included in an Access Definition,that column is automatically included in the Extract Process.

Any columns added to a table referred to as the source table in aColumn Map are included in the list of unused columns in the map. Ifthe column is added to the destination table, MOVE attempts toassign a matching source column to the new column and if none isavailable applies the defined column default. (For information onColumn Maps see Section 4.3 Column Maps.)

When a column is deleted from a table and that table is included in anAccess Definition, you should be aware of the impact. If you quit andaccess the affected table you will either receive:

Error You will receive an error message if the column isreferenced. A column is referenced if it is:

• Included in an SQL predicate.

• Part of the primary key.

You must remove any explicit references to the column inthe Access Definition.

Warning You will receive a warning message if the deleted columnis not explicitly referenced. Although a warning messageis issued, the Extract, Insert, and Delete processes can beperformed.

Any column that is deleted from the table cannot be explicitlydesignated in a Column Map.

If the characteristics of a column have changed since the AccessDefinition was last modified, a warning message is issued when anExtract, Insert, or Delete process is attempted.

For example, if the column length or the data type changes, this hasan impact on how the data is handled by an Insert or Delete Process ifthe column participates in the process. An appropriate warning

Column Added

Column Deleted

Column Modified

Page 182: Move for DB2 User Guide

3. Specify Access Definitions

168 Move for DB2

message is issued. You should check to ensure that the desired datawill be processed.

Adding a table to the database has no direct impact on the AccessDefinition or any of the processes.

If a table in an Access Definition is deleted from the database, thetable is labeled as UNKNOWN in the Access Definition. The AccessDefinition can be used, but the deleted table can not be the StartTable.

MOVE issues a warning message for this table when an ExtractProcess is requested.

When relationships are added or deleted, they directly impact thespecifications on the Specify Relationship Usage panel for MOVE.Deleted relationships are placed at the bottom of the list and assignedthe UNKNOWN status. New relationships are included at the top ofthe list and assigned the NEW status. If the Specify RelationshipUsage panel is not displayed, all NEW relationships are included inthe Extract Process by default and a warning message is displayed toinform the user of this situation. You specify NO on the Use NEWRelationship prompt on the Access Definitions Parameter panel toprevent these NEW relationships from being traversed.

Modified relationships are handled like newly specified relationships.

Table Added

Table Deleted

RelationshipsAdded, Deleted, orModified

Page 183: Move for DB2 User Guide

3. Specify Access Definitions

User Manual 169

3.11 Access Definition Parameters

You can specify a variety of parameters for the Access Definitionusing the Access Definition Parameters panel. You can display thispanel by specifying the PARAMETERS primary command on theSelect Tables/Views for AD panel.

----------- Access Definition Parameters: GRP.USER.ADSAMPLE --------------Command ===>

Dynamically Add Tables ===> Y (Y-Yes, N-No)

Modify Selection Criteria ===> Y (Y-Yes, N-No)

Begin Table Display with ===> D (D-Data, S-Criteria for Start Table only, A-Criteria for All Tables)

Changes to AD During Edit ===> P (P-Permanent, T-Temporary)

Use NEW Relationships ===> Y (Y-Yes, N-No)

Figure 89. Access Definition Parameters

The fields on the panel are:

DynamicallyAdd Tables

Specifies whether tables that are not included inthe Access Definition can be accessed via a JOINcommand. This applies when defining an AccessDefinition and a Browse session is invoked or forAccess for DB2 only when a browse or editsession is invoked from a menu option. Specify:

Y New tables can be added. Default.

N New tables cannot be added.

ModifySelectionCriteria

Specifies whether selection criteria can bespecified or modified when browsing data whiledefining an Access Definition (for all RelationalTools), when editing data (for Access for DB2),or during a Point-and-Shoot session (for MOVEand Compare for DB2). Specify:

Y Criteria can be specified or modified.Default.

N Criteria can not be specified or modified.

Panel Fields

Page 184: Move for DB2 User Guide

3. Specify Access Definitions

170 Move for DB2

Begin TableDisplay with

Specifies what the first display will be if anAccess Definition is used to browse data from theAccess Definition panels (for all RelationalTools), to browse and edit data at any time (forAccess for DB2), or to invoke a Point-and Shootsession (for MOVE). Specify:

D DataDisplay begins with data from named StartTable. Default.

S Criteria for Start Table OnlyDisplay begins with a selection criteriaprompt for the named Start Table.

A Criteria for All TablesDisplay begins with a selection criteriaprompt for the named Start Table and allsubsequently joined tables.

Changes to ADDuring Edit

Specifies whether changes to an Access Definitionduring the edit or browse session are to apply onlyto the current session or saved for future use.Editing is available with Access for DB2 only.All Relational Tools enable users to browse thedata while defining an Access Definition.

Use NewRelationships

Specifies whether relationships that are NEW andhave not been specifically selected or unselectedare to be traversed by the Extract Process.Specify:

Y Traverse NEW relationships. Default.

N Do not traverse NEW relationships.

The following primary commands are available when the AccessDefinition Parameters panel is displayed.

BROWSE CANCEL END OPTIONS SAVE

The EDIT command is available when Access for DB2 is alsoinstalled.

Use END to signal that specifications on the Access DefinitionParameters panel are complete. The display returns to the SelectTables/Views for AD panel.

AvailableCommands

Page 185: Move for DB2 User Guide

3. Specify Access Definitions

User Manual 171

3.12 Defining for Relational Tools

An Access Definition can be used by any of the Relational Toolsregardless of which was used to create it or for which it was originallycreated. However, care should be taken when sharing AccessDefinitions among the products. Modifications to an AccessDefinition during an edit session can change the selected set of data.This may be undesirable for MOVE processes.

Also, MOVE does not allow multiple references to a single table.Therefore the list can not contain one or more tables, views,synonyms, or aliases that refer to the same underlying base table.(Although Compare for DB2 and Archive for DB2 require the samerestrictions as MOVE, Access for DB2 allows multiple references toa single table.)

If an Access Definition containing such an entry is used for an ExtractProcess, an error message is displayed and you are prompted to deletethe duplicate entries. You will not be able to perform the ExtractProcess if duplicate entries are present.

Similarly, when duplicate tables are present while editing an AccessDefinition, you cannot display the Specify Relationship Usage panel.An error message is presented when you enter the REL command.You must delete the duplicate entries to display the SpecifyRelationship Usage panel.

This is not a concern when using the Access Definition withAccess for DB2.

Duplicate Tables

Page 186: Move for DB2 User Guide

3. Specify Access Definitions

172 Move for DB2

Page 187: Move for DB2 User Guide

User Manual 173

4. Definitions

This section describes how to create and maintain primary keys,relationships, Column Maps, and Table Maps in the Princeton SoftechDirectory and to display primary keys and relationships from the DB2Catalog. This section also discusses how to export the objects definedin the Princeton Softech Directory of one subsystem and then importthese object definitions to another Directory of another subsystem.

When Option 6 Definitions is selected on the Main Menu, the Choosea Definition Option menu is displayed.

------------------------- Choose a Definition Option --------------------OPTION ===> SQLID ===>1 PRIMARY KEYS - Maintain Primary Keys SUBSYS ===>2 RELATIONSHIPS - Maintain Relationships LOCATION ===>3 COLUMN MAPS - Maintain Column Maps4 TABLE MAPS - Maintain Table Maps5 ADS - Maintain Access Definitions

E EXPORT - Export Princeton Softech Object DefinitionsI IMPORT - Import Princeton Softech Object Definitions

Figure 90. Choose a Definition Option

The available options are:

PRIMARY KEYS Primary keys are those columns that uniquelydefine a row in a table.

Use Option 1 to create new primary keys andmodify and delete existing primary keys in theDirectory. You can browse DB2 primary keys.

RELATIONSHIPS Relationships are the set of columns from eachof two tables used to define a correspondencebetween these tables.

Use Option 2 to create relationships and modifyand delete existing relationships in the

Panel options

Page 188: Move for DB2 User Guide

4. Definitions

174 Move for DB2

Directory. You can browse DB2 relationships.

COLUMN MAPS Column Maps are used by MOVE to mapsource columns to destination columns, or totransform the data for a destination column aspart of the Insert, Load, or Convert Processes.Column Maps are also used to exclude columnsfrom participating in a process.

Use Option 3 to create new Column Maps andmodify and delete existing Column Maps.

TABLE MAPS Table Maps are used by MOVE to map thesource tables to their corresponding destinationtables, so that tables with different names in thesource and destination can be mapped andtables in the source can be excluded from theprocess.

Use Option 4 to create new Table Maps andmodify and delete existing Table Maps.

ADS Access Definitions are used by MOVE tospecify which related data is to be extracted.You can specify the set of tables, selectioncriteria, relationships to use, and other criteriato define the desired set of data.

Use Option 5 to create new Access Definitionsand modify and delete existing AccessDefinitions. (This functions the same asselecting Option 5 ADS on the Main Menu.)

EXPORT The Export Process is used to extract objectdefinitions specific to Relational Tools from thePST Directory and store them in an externalfile. This file can then be used by the ImportProcess to add the object definitions to the PSTDirectory used by other subsystems.

Use Option E to export object definitions fromthe PST Directory.

IMPORT The Import Process is used to import previouslyexported Relational Tools object definitions.The imported definitions are stored in the PSTDirectory.

Use Option I to import object definitions.

Page 189: Move for DB2 User Guide

4. Definitions

User Manual 175

There are three input fields on the menu enabling you to change theSQLID, subsystem and remote location. This is especially useful foraccessing the definitions for a specific database, or when exportingand importing for connecting to the desired target database.

SQLID Current SQLID. If you modify this value, MOVEwill attempt to connect using the modifiedSQLID. Since you can be connected with onlyone SQLID, the connection with the originalSQLID is not maintained. However, if MOVEcannot connect with the specified SQLID, arollback is performed and you are reconnectedwith the original SQLID.

SUBSYS Current subsystem. If you modify this value,MOVE will attempt to connect to that subsystem.Since you can be connected to only one subsystemat any time, the original subsystem isdisconnected. However, if MOVE cannot connectthe specified subsystem, a rollback is performedand you are reconnected to the original subsystem.

LOCATION Current location. This field is only displayed ifremote access is available.

If you modify this value, MOVE will attempt toconnect to the remote subsystem. Since you canbe connected to only one subsystem at any time,the original subsystem is disconnected. However,if the connection fails, the Relational Toolssession is restarted and the Main Menu isredisplayed.

Considerations for Primary Keys and Relationships

When you request a function that requires relationship information—such as adding related tables to an Access Definition or selecting atraversal path for an extract—the relationship information from theDB2 Catalog is used. If the required information is not defined in theDB2 Catalog, MOVE searches for the information in the PrincetonSoftech Directory. If the information is not defined in the Directory,you can specify the relationship definition through a series of promptsprovided by MOVE. This information is then stored in the Directoryand becomes available to all Relational Tools users. The Directoryis an extension of the DB2 Catalog.

Panel fields

Page 190: Move for DB2 User Guide

4. Definitions

176 Move for DB2

You can add primary keys and relationships to the Directory by usingthe series of panels described in Sections 4.1 Primary Keys and 4.2Relationships. Alternatively, the IMPORT option can be used toimport relationship information from third party dictionaries or casetools.

Updatingthe Directory

Page 191: Move for DB2 User Guide

4.1 Primary Keys

User Manual 177

4.1 Primary Keys

MOVE prompts to create a primary key definition for a table when itis required for the current operation the user is attempting or when theuser explicitly requests processing of a primary key. The responses tothe prompts are stored in the Directory. These prompts are displayed:

• Upon entry into a Point-and-Shoot session when the Start Tabledoes not have a primary key.

• When extracting from a table with two or more parents and thesemultiple parents are involved in the Extract Process.

• When updating a table.

• When Option 1 is selected on the Choose a Definition Optionpanel.

The first three situations are controlled by MOVE, the last by userrequest. The same primary key information is required in thesesituations and the same prompts are displayed.

If defined, primary keys assist in defining relationships. Specifically,when you create a relationship and a primary key has been defined forthe parent table, MOVE automatically inserts the primary keycolumns into the Define Relationship panel. You can then modify thecolumn information as desired.

For Relationships

Page 192: Move for DB2 User Guide

4. Definitions

178 Move for DB2

4.1.1 Specifying a Primary Key

To define a primary key, select Option 1 PRIMARY KEYS, on theChoose a Definition Option panel. The following panel is displayed.

----------------------- Choose a Primary Key -------------------------Command ===>

Primary Key: Creator ID ===> Table Name ===>

Primary Key Type ===> B (P-PST, D-DB2, B-Both)

Use '_' for DB2 LIKE character ===> N (Y-Yes, N-No)

Figure 91. Choose a Primary Key

The fields on this panel are:

Creator ID 1- to 8-character Creator ID of the table forwhich the primary key is being defined ormodified. DB2 LIKE syntax is used todisplay a selection list. If the field is blankor '%' is specified, a list of tables whichhave primary keys defined is displayed, asspecified in the Table Name field, for allCreator IDs. To create a generic primarykey, specify an asterisk in this field (refer toSection 4.1.4 Defining Generic PrimaryKeys for more information).

Table Name 1- to 18-character name of the table forwhich the primary key is being defined ormodified. DB2 LIKE syntax is used todisplay a selection list. If the field is blankor '%' is specified, a list of all tables thathave primary keys defined, based on thespecified Creator ID, is displayed.

Primary Key Type Specifies whether the primary key selectionlist includes primary keys defined in thePST Directory (P) or the DB2 Catalog (D),or both (B).

Use '_' for DB2 LIKEcharacter

Specifies whether the underscore, '_', is tobe used as a DB2 LIKE character or usedliterally as part of the name. For example,A_B could be assumed to be a three-character name containing the characters'A_B' as entered or a three-character name

Panel Fields

Page 193: Move for DB2 User Guide

4.1 Primary Keys

User Manual 179

that begins with ‘A’, end with ‘B’, and hasany valid character in the middle. Thedefault is No which means that '_' is nothandled as a DB2 LIKE character.

When an explicit Creator ID and Table Name are supplied:

• MOVE checks the DB2 Catalog for the specified table and, if aprimary key is defined, displays the primary key information.This information is not modifiable.

• When the DB2 Catalog does not contain a primary key for anexisting table, MOVE checks the PST Directory. If there is aprimary key defined in the PST Directory, it is displayed and ismodifiable.

• If the table exists, but primary key information is not available,MOVE assumes you want to define a new primary key for thetable. Once completed, the primary key definition is stored in thePST Directory.

• If the table does not exist, an error message is displayed on theChoose a Primary Key panel.

A selection list is requested by using DB2 LIKE syntax or leaving afield blank. (You must specify at least one character in one of thefields along with the DB2 LIKE syntax.)

• MOVE constructs a list of tables for which primary keys aredefined in the DB2 Catalog, the PST Directory, or both,depending on the value specified for the Primary Key Type fieldon the Choose a Primary Key panel.

• If there are no primary keys that satisfy the selection list criteria,a message is displayed on the Choose a Primary Key panel.

Explicit TableName

Selection List

Page 194: Move for DB2 User Guide

4. Definitions

180 Move for DB2

4.1.2 Selection List of Primary Keys

The selection list is displayed as shown in the following figure:

--------------------------- Select Primary Keys ----------------------------- Command ===> SCROLL ===> CSR Line Cmds: S-Select, D-Delete, C-Copy, R-Rename, AT-Attr, I-Info 1 of 4

Cmd Creator Table Type By Date --- ------- ------------------ ----- -------- ------------------- ********************************* TOP ********************************* ___ * ORDERS PST DB2MGR 1999-09-03-08.45.50 ___ PSTDEMO CUSTOMERS DB2 DB2MGR 1999-08-26-16.06.30 ___ PSTDEMO DETAILS DB2 DB2MGR 1999-07-09-11.55.47 s__ PSTDEMO SHIP_INSTR PST DB2MGR 1999-07-09-11.55.47 ********************************* BOTTOM ******************************

Figure 92. Select Primary Keys

Each line in the selection list displays a table for which a primary keyis defined. The Creator ID and table name are displayed. Anasterisk, *, in the Creator field indicates a generic primary key.

The Type field indicates whether the primary key is defined in thePST Directory (PST) or the DB2 Catalog (DB2). The Type field isalso used to indicate that a primary key is being modified by anotheruser (*Busy) or that a PST primary key has been deleted during thissession (*Deleted). Once a key has been deleted, the line commandarea for that entry is protected.

A user option controls whether or not the description of each PSTprimary key is displayed on this panel. See Section 6.1 UserOptions for information about the Selection List Format option.

The Cmd field on the left side of the panel is used to enter linecommands. The following line commands are available:

S Select a primary key. PST primary keys can bemodified and, if selected, are displayed on theModify PST Primary Key panel. (See section4.1.3 Modifying a Primary Key for moreinformation.) DB2 primary keys cannot bemodified and, if selected are displayed on theBrowse DB2 Primary Key panel.

D Delete a PST primary key. After deleting, themessage “*DELETED” appears in the Datefield. A DB2 primary key cannot be deleted.

C Copy a primary key to create a new one. TheCopy Primary Key panel prompts for thename of the new primary key. The message

Description

LineCommands

Page 195: Move for DB2 User Guide

4.1 Primary Keys

User Manual 181

“*COPIED” appears in the Date field under theheading Last Modified. (See page 182 formore information.)

R Rename a primary key. The Rename PrimaryKey panel prompts for the new name of theselected primary key. The message“*RENAMED” appears in the Date field underthe heading Last Modified. (See page 182 formore information.)

AT Modify attributes of a primary key. TheObject Attributes panel allows you to edit thedescription of the primary key. (See page 182for more information.)

I Display information about the primary keyattributes.

To display the attributes of a primary key, type I in the Cmd fieldnext to the name of the primary key. The following figure shows thePrimary Key Attributes panel.

------------- Primary Key Attributes ----------------- COMMAND ===>

Table ID : PSTDEMO Table Name : SHIP_TO Description :

Last Modified By : PSTUSER Modified On : 1999-12-29-08.16.08

Figure 93. Primary Key Attributes

This is a read-only display. Relational Tools generates andmaintains all of the information on this panel based on yourspecifications for the primary key. (See Specify Description andSecurity Status in Section 6.1 User Options for information aboutthe panel.)

Primary KeyAttributes

Page 196: Move for DB2 User Guide

4. Definitions

182 Move for DB2

To modify the description of a primary key, type AT in the Cmd fieldnext to the name of the primary key to display the Object Attributespanel.

+-------------------Object Attributes-------------------+ ¦ ¦ ¦ Object Name: PSTDEMO.CUSTOMERS ¦ ¦ ¦ ¦ Modify the attributes below as needed. ¦ ¦ ¦ ¦ Description ===> ¦ ¦ ¦ ¦ Use END command to accept any changes and return. ¦ ¦ Use CANCEL command to ignore any changes and return. ¦ +-------------------------------------------------------+

Figure 94. Object Attributes

The Object Attributes panel provides a 40-character area to display andedit the description

To copy a primary key, type C in the Cmd field next to the name ofthe primary key. The following figure shows the Copy Primary Keypanel.

+------------Copy Primary Key-----------+ ¦ ¦ ¦ Existing Name: PSTDEMO.CUSTOMERS ¦ ¦ ¦ ¦ New Name: ¦ ¦ ¦ ¦ Creator ID ===> PSTUSER ¦ ¦ Table Name ===> CUSTOMERS ¦ +---------------------------------------+

Figure 95. Copy Primary Key

The Copy Primary Key panel displays the name of the originalprimary key and prompts for the new two-part name for the copy. Aprimary key can only be copied if the destination table exist with thesame key columns as the source table.

To rename a primary key, type R in the Cmd field next to the name ofthe source primary key. The following figure shows the RenamePrimary Key panel.

+-----------Rename Primary Key----------+ ¦ ¦ ¦ Existing Name: PSTDEMO.CUSTOMERS ¦ ¦ ¦ ¦ New Name: ¦ ¦ ¦ ¦ Creator ID ===> PSTUSER ¦ ¦ Table Name ===> CUSTOMERS ¦ +---------------------------------------+

Figure 96. Rename Primary Key

Object Attributes

Copy a PrimaryKey

Rename a PrimaryKey

Page 197: Move for DB2 User Guide

4.1 Primary Keys

User Manual 183

The Rename Primary Key panel displays the current name of theprimary key and prompts for a new two-part name. A primary keycan only be renamed if the destination table exists with the same keycolumns as the original table.

The following primary commands are available:

Use the FIND command to locate a specific character string anywherein the selection list. For example, FIND PST will locate the characterstring PST in the Creator, Table, or Type fields. Use RFIND(usually assigned to PF5) to repeat the FIND operation.

Use the SHOW command to redisplay a selection list of primary keyscontaining the specified string in either the Creator, Table, or Typefields. For example, SHOW CUST displays only the primary keysthat contain CUST in any of these fields. Use SHOW ALL to restorethe original selection list.

Use the SORT command to sort the selection list by a particular field.For example, SORT TYPE sorts the list by the values in the Typefield.

Use the LOCATE command to locate a value that is equal to orgreater than the specified search value. The LOCATE commandsearches for the value in the field that was sorted last or, by default,the Creator field.

In addition, the following scrolling commands are available:

BOTTOM END SELECT CANCEL LIST TABLES TOP DOWN OPTIONS UP

PrimaryCommands

Page 198: Move for DB2 User Guide

4. Definitions

184 Move for DB2

4.1.3 Modifying a Primary Key

When you specify the fully qualified name of a table that has a PSTprimary key, the Modify PST Primary Key panel is displayed.When you specify the fully qualified name of table that does not havea primary key, the Define PST Primary Key panel is displayed toenable you to create a primary key. The operation of these panels isidentical.

----------------------- Modify PST Primary Key -----------------------COMMAND ===> SCROLL ===> CSR

INSTRUCTIONS: Modify PST Primary Key for PSTDEMO.SHIP_INSTR Limit Key to 64 Columns and 254 Bytes

Cmd Column Name Data Type 1 OF 1--- ----------------------- ---------------*** ***************** TOP *****************___ SHIP_INSTR_ID DECIMAL(5,0)*** *************** BOTTOM ****************

Figure 97. Modify PST Primary Key

The fields on this panel are:

Cmd Line command entry field. The possible linecommands are:

D, Dn orDD

To delete one or more column names.DD is the block form of the command.

I or In To insert one or more blanks lines.

M, Mnor MM

To move one or more column names.MM is the block form of the command.

A or B Destination for the Move line command.

ColumnName

Names of the columns to be included in the primarykey.

At least one column name must be specified. Amaximum of 64 columns containing a total of 254bytes can be specified.

Data Type Data type of the column. This field is provided forinformation and cannot be modified. When youspecify a column name, MOVE automaticallydisplays the data type for that column in this field.

The name of the table is included in the INSTRUCTIONS on thepanel.

Panel Fields

Page 199: Move for DB2 User Guide

4.1 Primary Keys

User Manual 185

You can specify a description for any primary key stored in the PSTDirectory. You cannot supply a description for primary keys storedin the DB2 Catalog. Use the ATTRIBUTES command to display theObject Attributes panel for a PST primary key. This panel providesa 40-character area to display and edit the description. For additionalinformation about the Object Attributes panel see Specify Descriptionand Security Status in Section 6.1 User Options.

A selection list of the columns in the table can be displayed using theLIST COLUMNS command. Assume the LIST COLUMNScommand is entered to display the columns in the SHIP_INSTR table.The Select One or More Columns prompt is displayed. Only thecolumns not already defined in the primary key are displayed:

------------------------- Modify PST Primary Key -------------------------COMMAND ===> SCROLL ===> CSR

INSTRUCTIONS: Modify PST Primary Key for PSTDEMO.SHIP_INSTR Limit Key to 64 Columns and 254 Bytes

Cmd Column Name Data Type 1 OF 1--- ---------------*** *************** +-----------Select One or More Columns-----------+___ SHIP_INSTR_ID | Cmd Column Name Data Type 1 OF 3 |*** *************** | --- ----------------------------------- | | ***************** TOP ***************** | | ___ SHIP_ID SMALLINT | | ___ ORDER_SHIP_INSTR VARCHAR(254) | | ___ SHIP_UPDATED TIMESTAMP | | *************** BOTTOM **************** | +------------------------------------------------+

Figure 98. Select One or More Columns

This prompt lists the column names followed by the data type of thecolumn. The Cmd field on the left side of the prompt is used to enter linecommands. Use the S or SS line command to select the columns.

Press ENTER or use END to indicate that column selection is complete.The Modify PST Primary Key panel is redisplayed. The selectedcolumns are inserted in the list of columns comprising the key. You mayredisplay and select from the list of columns as needed.

You can use the LIST UNIQUE INDEX primary command to obtain alist of unique indexes for the table. You can select an index from the listto be used as the primary key. MOVE uses the column names from theindex to replace all previously specified column names.

This command performs a tablespace scan on the catalog table,SYSIBM.SYSINDEX. Be aware that using it can be time-consuming.

Description

Selection List ofColumns

Selection List ofIndexes

Page 200: Move for DB2 User Guide

4. Definitions

186 Move for DB2

When you are satisfied with the specifications for the primary key,press ENTER or use END to signal the end of the Modify PSTPrimary Key panel processing.

The primary key information is stored in the Directory. It isautomatically used the next time the table is accessed. This primarykey information is available to all MOVE users, therefore it onlyneeds to be defined once for any table.

Use the DELETE command on the Modify PST Primary Key panelto delete a primary key. You can also delete the primary key byerasing all of the column names and then using END.

The following primary commands are available:

ATTRIBUTESBOTTOMCANCELDELETE

DOWNENDGENERICLIST COLUMNS

LIST UNIQUERESETTOPUP

4.1.4 Defining Generic Primary Keys

Frequently, sets of tables are created that contain the same basenames, columns, and attribute specifications but are distinguished bydifferent Creator IDs. This enables users or groups of users to havetheir own set of tables and data. Rather than define an explicitprimary key for each table, you can define a generic primary key to beused for all tables having the same base name, regardless of theCreator ID.

Generic primary keys are always identified by an asterisk, *, as theCreator ID. You can create a generic primary key in the same manneras an explicit primary key, or you can convert an existing primary keyto a generic primary key as described in this section.

SpecificationComplete

Deleting a PrimaryKey

Available PrimaryCommands

Page 201: Move for DB2 User Guide

4.1 Primary Keys

User Manual 187

To create a generic primary key, select Option 1 PRIMARY KEYSon the Choose a Definition Option panel. The Choose a PrimaryKey panel is displayed. Type an asterisk in the CREATOR ID fieldand the desired table name in the TABLE NAME field. In thefollowing example, *.SHIP_INSTR is specified.

---------------------------- Choose a Primary Key ----------------------Command ===>

Primary Key: Creator ID ===> * Table Name ===> SHIP_INSTR

Primary Key Type ===> B (P-PST, D-DB2, B-Both)

Use '_' for DB2 LIKE character ===> N (Y-Yes, N-No)

Figure 99. Name a Generic Primary Key

Before you can specify the columns to be included in the genericprimary key, MOVE requires that you supply a Creator ID to identifya table that will be used as a base table to validate the generic primarykey definition. When you press ENTER on the Choose a PrimaryKey panel, the Define PST Primary Key panel is displayed andoverlaid with a CreatorID Prompt panel, as shown in the followingfigure.

-------------------------- Define PST Primary Key ----------------------COMMAND ===> SCROLL ===> CSR

INSTRUCTIONS: Define GENERIC Primary Key using Base Table ?.SHIP_INSTR Limit Key to 64 Columns and 254 Bytes

Cmd Column Name Data Type 1 OF 1--- ---------------*** *************** +----------------CreatorID Prompt-----------------+... | |*** *************** | Primary Key Definition Involves a Generic Key | | Supply a CreatorID for a Base Table | | | | Press ENTER Key or Enter END Command when Done | | Enter CANCEL Command to Exit Key Definition | | | | CreatorID ===> | +-------------------------------------------------+

Figure 100. Specify Creator ID for Base Table

Once you supply a Creator ID, the question mark, ?, in theINSTRUCTIONS text of the Define PST Primary Key panel isreplaced with the Creator ID. You can then specify the columns to beincluded in the generic key as documented previously in this sectionfor explicit keys. This generic primary key can be used by all tablesnamed SHIP_INSTR containing the key columns regardless ofCreator ID.

Creating aGeneric Key

Page 202: Move for DB2 User Guide

4. Definitions

188 Move for DB2

To convert an explicit primary key to a generic key, use theGENERIC command. The GENERIC command can be entered onthe Modify PST Primary Key or the Define PST Primary Keypanels to convert the currently displayed explicit primary key into ageneric primary key. The GENERIC command is also available whenbrowsing a DB2 primary key. (A generic primary key cannot beconverted into an explicit primary key.)

During the conversion of a PST primary key, the following prompt isdisplayed. Specify whether the original, explicit primary key is to bedeleted or retained as requested on the prompt.

-------------------------- Modify PST Primary Key ------------------------COMMAND ===> SCROLL ===> CSR

INSTRUCTIONS: Modify PST Primary Key for PSTDEMO.SHIP_INSTR Limit Key to 64 Columns and 254 Bytes

Cmd Column Name Data Type 1 OF 1--- ---*** *** +---------------- Confirm GENERIC Processing ---------------+___ SHI | |*** *** | Press ENTER to Delete Existing Explicit Primary Key | | Enter END Command to Retain Existing Explicit Primary Key | | Enter CANCEL Command to Return to Primary Key Editor | +-----------------------------------------------------------+

Figure 101. Confirm Generic Processing Prompt

If the generic key name already exists, the following prompt isdisplayed prior to the Confirm GENERIC Processing prompt. Youcan decide whether to replace the existing generic key.

------------------------- Modify PST Primary Key -------------------------COMMAND ===> SCROLL ===> CSR

INSTRUCTIONS: Modify PST Primary Key for PSTDEMO.SHIP_INSTR Limit Key to 64 Columns and 254 Bytes

Cmd Column Name Data Type 1 OF 1--- -------------------------- -----------***_+------------------Confirm GENERIC Override Processing-----------------+*| | | Generic Primary Key With Same Name Already Exists | | | | Press ENTER to Confirm Override of Existing Generic Primary Key | | Enter END Command to Cancel Override of Existing Generic Primary Key | +----------------------------------------------------------------------+

Figure 102. Generic Key Override Confirmation Prompt

Converting to aGeneric Key

Duplicate Name

Page 203: Move for DB2 User Guide

4.1 Primary Keys

User Manual 189

If the generic key specified on the Choose a Primary Key panel orSelect Primary Keys panel exists, the Modify PST Primary Keypanel is displayed. You are prompted for a Creator ID to identify abase table.

------------------------ Modify PST Primary Key -------------------------- COMMAND ===> SCROLL ===> CSR

INSTRUCTIONS: Modify GENERIC Primary Key using Base Table ?.SHIP_INSTR Limit Key to 64 Columns and 254 Bytes

Cmd Column Name Data Type 1 OF 1 --- ------------------ *** ******************* +--------Confirm New Base CreatorID---------+ ___ | | *** ******************* | Base Table Specified by CreatorID does | | not Contain All Generic Key Columns | | | | Press ENTER Key to Specify New CreatorID | | Enter END Command to OverRide Generic Key | +-------------------------------------------+

Figure 103. Confirm New Base CreatorID

You are not required to specify the same Creator ID that was used tocreate the generic key, but all of the columns referenced in the keymust be included in the new base table. If the key columns are notcontained in the table indicated by the Creator ID you specify, you aregiven the choice of respecifying the Creator ID or overriding theexisting generic key. If you elect to override, the existing generic keyis deleted and you are prompted to specify columns from the tableidentified with the new Creator ID.

After a base table is established, you may use the facilities describedfor modifying a primary key.

There is no difference in function or appearance between generic keysand explicit keys. Explicit primary keys take precedence over generickeys. Therefore, if an explicit primary key exists for an individualtable it will be used regardless of whether a generic key exists.

Modifying aGeneric Key

Using GenericPrimary Keys

Page 204: Move for DB2 User Guide

4. Definitions

190 Move for DB2

4.2 Relationships

MOVE enables you to define relationships prior to extracting datawhen the required relationships are not already provided in the DB2Catalog. You can request the prompts to define relationships using:

• Option 2 RELATIONSHIPS on the Choose a Definition Optionpanel.

• The CREATE RELATIONSHIP command issued from theAccess Definition table list, Select Tables/Views for AD panel,or the relationship list, Specify Relationship Usage panel.

You can define relationships that conform to DB2 rules or explicitPrinceton Softech’s “extended” relationships. These extendedrelationships are more flexible than those defined to DB2. DB2relationships require that each parent table have a primary key thatcontains between 1 and 64 columns and guarantees uniqueness. DB2relationships also require that each child table have a correspondingforeign key consisting of the same number of columns.Corresponding columns in the primary and foreign keys must haveidentical data types and attributes. When defining PST relationships,a number of the DB2 restrictions are relaxed:

• Primary keys and foreign keys are not required.

• A relationship is composed of a list of columns from one tableand a list of corresponding columns from another table. Thecorresponding columns need not be identical, but must becompatible. Compatible column types are described in AppendixF. Compatibility Rules for Relationships.

• In addition to corresponding column lists, any column name canbe replaced by an expression that may include string literals,numeric constants, concatenation, and substrings.

This flexibility allows PST relationships to reflect the type ofrelationships found in many applications and allows Relational Toolsto manipulate relational sets of data as desired.

ExtendedRelationships

Page 205: Move for DB2 User Guide

4.2 Relationships

User Manual 191

4.2.1 Specifying a Relationship

When Option 2 on the Choose a Definition Option panel is selected,the Choose a Relationship panel is displayed, as shown in thefollowing figure. This panel is also displayed when the CREATERELATIONSHIP command is entered from the Access Definitiontable list or relationship list.

---------------------------- Choose a Relationship ------------------------------OPTION ===> 3

1 CREATE - Create a Relationship for Specified Parent or Child Table 2 MODIFY - Modify a Relationship for Specified Child Table 3 LIST - List All Relationships for Specified Table

Specify Table Name (Child for OPTION 2, Parent or Child for OPTIONS 1 and 3) Creator ID ===> pstdemo Table Name ===> customers

Specify Relationship Name (OPTIONS 1 and 2) Relationship Name ===>

Specify Relationship Type (OPTIONS 2 and 3) Relationship Type ===> (P-PST, D-DB2, B-Both)

Use '_' for DB2 LIKE character ===> N (Y-Yes, N-No)

Figure 104. Choose a Relationship Panel

When specifying a table on this panel, you can provide a completeCreator ID and table name, referred to as a fully qualified table namein the following text. Alternatively, you can provide DB2 LIKEsyntax for either or both of these fields, referred to as a partial tablename. (You must specify at least one character for either of thesefields along with the DB2 LIKE syntax.)

Page 206: Move for DB2 User Guide

4. Definitions

192 Move for DB2

The options on this panel are:

1 CREATE Use this option to create a new relationship involvingthe specified table. If a fully qualified table name issupplied, the Create a New Relationship panel isdisplayed.

If a partial table name is supplied, a selection list oftables is displayed. Once you select a table from thelist, the Create a New Relationship panel isdisplayed.

In either case, if you provide a Relationship Name onthe Choose a Relationship panel, it is automaticallydisplayed on the Create a New Relationship panel.Alternatively, you can omit the relationship nameinitially and provide it on the Create a NewRelationship panel.

The specified table can be either the parent or child inthe relationship—you specify this on the Create aNew Relationship panel. This panel is described inSection 4.2.3 Creating a Relationship.

2 MODIFY Use this option to modify an existing relationship.Relationships are uniquely identified by the fullyqualified child table name and the relationship name.If you specify the fully qualified child table name andthe relationship name, the Modify Relationship panelis displayed.

If you specify a partial child table name orrelationship name, a selection list of relationships isdisplayed. Once you select a relationship, the ModifyRelationship panel is displayed.

3 LIST Use this option to list the relationships in which thespecified table is either a parent or child. If a fullyqualified table name is supplied, a selection list ofrelationships involving the named table is displayed.

If a partial table name is supplied, a selection list oftables is displayed. Select one or more tables fromthis list to generate a selection list of relationships inwhich at least one selected table participates.

The selection list is discussed in Section 4.2.2Selection List of Relationships.

Panel Options

Page 207: Move for DB2 User Guide

4.2 Relationships

User Manual 193

The fields on this panel are:

Creator ID 1- to 8-character Creator ID of the tablefor which the relationship is being createdor modified. Use DB2 LIKE syntax orleave this field blank to generate aselection list. To create a genericrelationship, specify an asterisk in thisfield (refer to Section 4.2.7 GenericRelationships for details).

Table Name 1- to 18-character name of the table forwhich the relationship is being created ormodified. Use DB2 LIKE syntax or leavethis field blank to generate a selection list.

Relationship Name 1- to 8-character name of the relationship.Use DB2 LIKE syntax or leave this fieldblank to generate a selection list forOption 2.

Relationship Type Specifies whether the relationship selectionlist includes relationships defined in thePST Directory (P), the DB2 Catalog (D),or both (B). This field is applicable onlyfor Options 2 and 3.

Use '_' for DB2 LIKEcharacter

Specifies whether the underscore, '_', is tobe used as a DB2 LIKE character or usedliterally as part of the name. For example,A_B could be assumed to be a three-character name containing the characters'A_B' as entered or a three-character namethat begins with 'A', ends with 'B', and hasany valid character in the middle. Thedefault is NO which means that '_' is nothandled as a DB2 LIKE character.

Panel Fields

Page 208: Move for DB2 User Guide

4. Definitions

194 Move for DB2

4.2.2 Selection List of Relationships

When a selection list is requested using Option 2 or 3 on the Choose aRelationship panel, the Select Relationships panel is displayed.

Assuming the table PSTDEMO.CUSTOMERS was specified andOption 3 was selected on the Choose a Relationship panel, thefollowing sample relationship selection list might be displayed.

--------------------------- Select Relationships ----------------------------- COMMAND ===> SCROLL ===> CSR

Line Cmd: S-Select, D-Delete, C-Copy, R-Rename, AT-Attr, I-Info 1 OF 5 LR-List Rels for Other Table

-------- Parent ---------- --------- Child ----------- Cmd Creator Table Creator Table Relation Type --- -------- ----------------- -------- ------------------ -------- --------- ********************************** TOP ************************************ ___ PSTDEMO CUSTOMERS PSTDEMO ORDERS RCO DB2 ___ PSTDEMO CUSTOMERS PSTDEMO ORDERS TEST PST ___ PSTDEMO CUSTOMERS PSTDEMO SALES SALES PST ___ PSTDEMO CUSTOMERS PSTDEMO SHIP_TO RCST PST ___ PSTDEMO SALES PSTDEMO CUSTOMERS RSC DB2 ********************************* BOTTOM *********************************

Figure 105. Select Relationships Panel

The list is initially ordered by the parent table name but may be sortedusing the SORT command (see the information in this section aboutprimary commands for details).

Each line in the selection list displays a single relationship. The listprovides the Creator ID and table name of the parent table and thechild table, and the name of the relationship. The Type field indicateswhether the relationship is defined in the PST Directory (PST) or theDB2 Catalog (DB2). The Type field is also used to indicate a genericrelationship (GEN).

A user option controls whether or not the description of each PSTrelationship is displayed on this panel. Site management determineswhether this panel also displays a prompt for Security Status. SeeSection 6.1 User Options for information about the Selection ListFormat option.

The Cmd field on the left side of the panel is used to enter linecommands. The following line commands are available:

S Select a relationship. PST relationships are modifiable.DB2 relationships are not modifiable.

D Delete a PST relationship. You cannot delete a DB2relationship.

Description

Line Commands

Page 209: Move for DB2 User Guide

4.2 Relationships

User Manual 195

C Copy a relationship to create a new one. The CopyRelationship panel prompts for the name of the copiedversion of the relationship. After copying, the message“*COPIED” appears in the Date field under the headingLast Modified (See page 196 for more information.)

R Rename a relationship. The Rename Relationship panelprompts for the new name of the selected relationship. Afterrenaming, the message “*RENAMED” appears in the Datefield under the heading Last Modified. (See page 197 formore information.)

AT Display the Object Attributes panel for the selectedrelationship. This command is only available for PSTrelationships. (See page 196 for more information.)

I Display information about a relationship.

LR List all of the relationships that involve the table that wasnot specified on the Choose a Relationship panel orselected from a table selection list. For example, if LR isentered for the last relationship displayed in the previousfigure, the resulting list would include all of the relationshipsinvolving PSTDEMO.SALES as the parent or child in therelationship.

To display the attributes of a relationship, type I in the Cmd field nextto the name of the relationship. The following figure shows theRelationship Attributes panel.

-------------------------- Relationship Attributes -------------------------- Command

Child Table ID : PSTDEMO Child Table Name : ORDERS Relationship Name : RCO

Description : Security Status : PUBLIC Last Modified By : PSTDEMO Modified On : 1999-12-21-09.58.37

Parent Table ID : PSTDEMO Parent Table Name : CUSTOMERS

Figure 106. Relationship Attributes Panel

This is a read-only display. MOVE generates and maintains all of theinformation on this panel based on your specifications for therelationship.

RelationshipAttributes

Page 210: Move for DB2 User Guide

4. Definitions

196 Move for DB2

To modify the description and security status of a relationship, typeAT in the Cmd field next to the name of the relationship to display theObject Attributes panel.

+-----------------------Object Attributes-----------------------+ ¦ ¦ ¦ Object Name: PSTDEMO.CUSTOMERS.RCO ¦ ¦ ¦ ¦ Modify the attributes below as needed. ¦ ¦ ¦ ¦ Description ===> ¦ ¦ ¦ ¦ Security Status ===> PUBLIC (PUBLIC, PRIVATE, READONLY) ¦ ¦ ¦ ¦ Use END command to accept any changes and return. ¦ ¦ Use CANCEL command to ignore any changes and return. ¦ ¦ ¦ +---------------------------------------------------------------+

Figure 107. Object Attributes

The Object Attributes panel provides a 40-character area to displayand edit the description. An 8-character area is available to specifyone of the following security statuses:

PUBLIC Anyone can edit and use. PRIVATE Only owner can edit and use. READONLY Anyone can use, only owner can edit.

Based on installation options, site management can establish thatusers may not specify security status on this panel. In that case, theprompt for security status is replaced with “Not Active” on the panel.Any attempt to change the security status will result in an errormessage. (See Specify Description and Security Status in 6.1 UserOptions for information about the panel.

To copy a relationship, type C in the Cmd field next to the name ofthe source relationship. The following figure shows the CopyRelationship panel.

+----------------Copy Relationship---------------+ ¦ ¦ ¦ Existing Name: PSTDEMO.CUSTOMERS.RCO ¦ ¦ ¦ ¦ New Name: ¦ ¦ ¦ ¦ Child Creator ID ===> PSTDEMO ¦ ¦ Child Table Name ===> CUSTOMERS ¦ ¦ Relationship Name ===> RCO ¦ +------------------------------------------------+

Figure 108. Copy Relationship

The Copy Relationship panel displays the name of the originalrelationship and prompts for the new three-part name for the copy. A

Object Attributes

Copy aRelationship

Page 211: Move for DB2 User Guide

4.2 Relationships

User Manual 197

relationship can only be copied when the participating tables of thenew relationship exist.

To rename a relationship, type R in the Cmd field next to the name ofthe relationship. The following figure shows the RenameRelationship panel.

+---------------Rename Relationship--------------+ ¦ ¦ ¦ Existing Name: PSTDEMO.CUSTOMERS.RCO ¦ ¦ ¦ ¦ New Name: ¦ ¦ ¦ ¦ Child Creator ID ===> PSTDEMO ¦ ¦ Child Table Name ===> CUSTOMERS ¦ ¦ Relationship Name ===> RCO ¦ +------------------------------------------------+

Figure 109. Rename Relationship

The Rename Relationship panel displays the current name of therelationship and prompts for a three-part name.

Several primary commands are available.

Use the FIND command to locate a specific character string anywherein the selection list, for example, FIND ITEMS. RFIND is used tofind subsequent occurrences using the same FIND search criteria, butcontinuing from the current cursor position.

Use the SHOW command to redisplay a selection list of relationshipsfor tables with the specified string in the Creator ID, table name,relationship name or relationship type fields. For example, SHOWCUST displays only the relationships between tables that containCUST in either of the Creator IDs or table names, or the relationshipname. Use SHOW ALL to restore the original selection list.

Use the SORT command to sort the selection list by a particular field.Since the names of both the parent table and the child table fields havethe headings Creator and Table, the following are available:

SORT TABLE Sorts using the values in the Child Table field. SORT CREATOR Sorts using the values in the Child Creator

field. SORT PTABLE Sorts using the values in the Parent Table field. SORTPCREATOR

Sorts using the Parent Creator field.

SORT CHILD Sorts using the fully qualified child table name. SORT PARENT Sorts using the fully qualified parent table

name. SORT RELATION Sorts using relationship name.

Rename aRelationship

PrimaryCommands

Page 212: Move for DB2 User Guide

4. Definitions

198 Move for DB2

SORT TYPE Sorts using type of relationship. (Use this togroup the DB2 relationships and the PSTrelationships.)

Use the LOCATE command to locate a value that is equal to orgreater than the specified search value. The LOCATE commandsearches for the value in the field sorted last or, by default, theCreator ID of the child table.

In addition to the commands described above, the following primarycommands are also available:

BOTTOMCANCEL

DOWNEND

LISTOPTIONS

SELECTTOP

UP

If you select a PST relationship, the Modify Relationship panel isdisplayed. (This panel is discussed in Section 4.2.4 EditingRelationships.) If you select a DB2 relationship, the Browse DB2Relationship panel is displayed.

If you select more than one relationship, MOVE displays eachrelationship in turn as you use END. After all relationships have beendisplayed, the Choose a Relationship panel is redisplayed.

4.2.3 Creating a Relationship

When Option 1 on the Choose a Relationship panel is selected and afully qualified table name is specified, either on that panel or from thesubsequent table selection list, the Create a New Relationship panelis displayed, as shown in the following figure.

--------------------------- Choose a Relationship ---------------------------OPTION ===>

1 CREATE - Create a Relationship for Specified Parent or Child Table 2 M 3 L +------------------Create a New Relationship-----------------+ | |Specif | Specified Table : PSTDEMO.ORDERS | and 3) Crea | Table Type ===> C (P-PARENT, C-CHILD) | Tabl | | | Leave blank or include wild cards for Table Selection List |Specif | | Rela | Other Table: | | Creator ID ===> PSTDEMO |Specif | Table Name ===> customers | Rela | | | Relationship Name ===> custord |Use '_ +------------------------------------------------------------+

Figure 110. Create New Relationship Panel

RelationshipSelected

Page 213: Move for DB2 User Guide

4.2 Relationships

User Manual 199

The fields on this panel are:

Specified Table The table name specified on the Choose aRelationship panel. This is a protected, non-modifiable field.

Table Type Indicate whether the Specified Table is the parent(P) or child (C) table in this relationship. Forexample, if you specify P, MOVE assumes thetable specified as the Other Table is the child. Ifyou specify C, MOVE assumes the Other Tableis the parent. The default value is C, howeverthis value is profiled and retained across MOVEsessions.

Other TableCreator ID

Specify the Creator ID of the other table in therelationship. To generate a selection list of tables,leave this field blank or specify DB2 LIKEsyntax. By default, the Creator ID specified forthe corresponding table is assumed.

Table Name Specify the table name of the other table in therelationship. To generate a selection list of tables,leave this field blank or specify DB2 LIKEsyntax.

Relationship Name If you specified a relationship name on theChoose a Relationship panel, that name isdisplayed in this field. Otherwise, the field isblank. Specify a 1- to 8-character relationshipname.

When you have filled in this panel, press ENTER to display theDefine Relationship panel to create a new relationship or the ModifyRelational panel to edit an existing relationship.

4.2.4 Editing Relationships

When you enter the required information on the Create a NewRelationship panel, the Define Relationship panel is displayed.When you select an existing relationship, either explicitly on theChoose a Relationship panel or from a selection list, the ModifyRelationship panel is displayed. The Define Relationship andModify Relationship panels are identical except for the panel titleand text, which reflect the current activity.

At any time during the session you can specify a description for anyrelationship you are editing. Use the ATTRIBUTES command to

Panel Fields

Description

Page 214: Move for DB2 User Guide

4. Definitions

200 Move for DB2

display the Object Attributes panel. This panel provides a 40-character area to display and edit the description. (Site managementdetermines whether this panel also displays a prompt for SecurityStatus.) For additional information about the Object Attributespanel see Specify Description and Security Status in Section 6.1User Options.

A sample Define Relationship panel is shown in the following figure.The upper portion of the panel indicates the relationship name andlists commands that are especially useful when defining or modifyinga relationship. The lower portion of the panel is divided into twoparts. The left portion displays the parent table name followed byspace for a list of parent table column names and data types. Theright portion indicates the child table name followed by space for a listof corresponding child column names and data types.

---------------------------- Define Relationship --------------------------- COMMAND ===> SCROLL ===> CSR

Define Relationship CUSTORD Special Commands: LIST COLUMNS, EXPAND, GENERIC, MODEL

Parent: PSTDEMO.CUSTOMERS Child: PSTDEMO.ORDERS 1 OF 1 Cmd Column Name Data Type Column Name Data Type --- ------------------------ ---------- ------------------------ ---------- *** ********************************* TOP ********************************** ___ CUST_ID CH(5) CUST_ID CH(5) *** ******************************* BOTTOM *********************************

Figure 111. Define Relationship Panel

MOVE provides several editing facilities for constructing a relationship.Most often, a relationship is composed of corresponding lists of columnsfrom the parent and child tables.

There are three ways to populate a relationship definition with columnnames. You can:

• Use the column names automatically inserted by MOVE.

• Insert the column names manually.

• Select column names from a selection list.

Each method is described in the following sections.

Automatically Inserted Column Names

When creating a new relationship, MOVE attempts to populate theDefine Relationship panel with as much meaningful relationshipinformation as possible.

DefineRelationship panel

Page 215: Move for DB2 User Guide

4.2 Relationships

User Manual 201

If the parent table has a primary key, the primary key column names anddata types are populated on the left side of the panel. If the child tablecontains any column names that match the primary key column namesand have compatible data types, those column names are populated onthe right side of the panel. (Note that unlike a DB2 relationship, a PSTrelationship does not require that corresponding columns have identicalattributes. However, corresponding columns must be compatible, asdefined in Appendix F. Compatibility Rules for Relationships of thismanual.)

When there are no matching names in the child table, MOVE checks thechild table for a single column with identical attributes, regardless of thename. If there is only one column with identical attributes, that columnname is inserted. Otherwise, no child table column names are inserted.

If the parent table does not have a primary key, a blank line isprovided for you to enter column names for the parent table and thechild table.

Manually Inserting Column Names

Regardless of whether column names have been automaticallypopulated by MOVE, you can manually insert additional columnnames. Use the I line command to insert a blank line in therelationship definition. You can then type the column names in theappropriate fields. MOVE automatically inserts the data type of thecolumn in the Data Type field.

In addition to specifying column names, you can enter character stringliterals and numeric constants in the child and parent Column Namefields. For example, instead of specifying the column nameCUST_ID, you can specify the value 50215 as a string literal byentering the following in the Column Name field:

'50215'

String literals must be enclosed in single quotes. Only a string literal canbe specified if the corresponding column has a data type of CHAR orVARCHAR. You cannot specify NULL as a literal value.

A numeric constant can only be specified if the corresponding column hasa data type of DECIMAL, INTEGER, or SMALLINT. Numericconstants cannot contain floating point or hexadecimal values.

At least one parent table column and one child table column must bereferenced in a relationship and at least one relationship entry mustrelate a column from one table to a column from the other. That is,the Column Name list for each table must include an actual column,or column substring, from that table. Additionally, you cannot relate

Existing PrimaryKey

Literals andConstants

Page 216: Move for DB2 User Guide

4. Definitions

202 Move for DB2

a literal or constant to a literal or constant. MOVE issues an errormessage for either of these conditions.

When you specify a literal or a constant in a Column Name field, theData Type field for that column reflects the attributes of the stringliteral or numeric constant.

--------------------------- Define Relationship -------------------------COMMAND ===> SCROLL ===> CSR Define Relationship CUSTORD Special Commands: LIST COLUMNS, EXPAND, GENERIC, MODEL

Parent: PSTDEMO.CUSTOMERS Child: PSTDEMO.ORDERS 1 OF 1Cmd Column Name Data Type Column Name Data Type--- ----------------------- ---------- ------------------------ ---------*** ******************************* TOP *********************************___ '50125' CH(5) CUST_ID CH(5)___ SALESMAN_ID CH(6) ORDER_SALESMAN CH(6)*** ****************************** BOTTOM *******************************

Figure 112. Literal String

A table is sometimes related to one of many other child tables basedon the data in a particular column. This is referred to as a data drivenrelationship. You can define such a relationship by using literals. Todemonstrate, consider the following sample tables used to determineemployee insurance rates for males and females.

Data DrivenRelationships

Page 217: Move for DB2 User Guide

4.2 Relationships

User Manual 203

The EMPLOYEE table contains each employee’s ID, age, and sex.

EMPLOYEE EMPLOYEE_ID

058-44-2244106-46-0619248-91-2890

AGE384027

SEXFMM

The FEMALE_RATES table contains the insurance rates used forfemales based on the female’s age. The MALE_RATES tablecontains the insurance rates used for males based on the male’s age.

FEMALE_RATES MALE_RATES AGE

383940

RATE.25.33.43

AGE383940

RATE.31.38.47

The EMPLOYEE table should be related to the FEMALE_RATEStable if the employee is female, and to the MALE_RATES table if theemployee is a male. To accomplish this, two relationships aredefined.

The first relationship relates the EMPLOYEE table to theFEMALE_RATES table when the SEX column corresponds to thestring literal 'F'. The AGE column in the EMPLOYEE tablecorresponds to AGE column in the FEMALE_RATES table.

EMPLOYEE FEMALE_RATES SEX 'F' AGE AGE

The second relationship relates the EMPLOYEE table to theMALE_RATES table and is identical to the first relationship, exceptthat the SEX column corresponds to the string literal 'M'.

EMPLOYEE MALE_RATES SEX 'M' AGE AGE

Therefore, for any given row in the EMPLOYEE table, only one ofthe relationships can be satisfied, since the column EMPLOYEE.SEXmust be 'M' or 'F'. Once the appropriate relationship is chosen, therelated rows are identified by comparing the AGE columns.

Page 218: Move for DB2 User Guide

4. Definitions

204 Move for DB2

Selecting Columns from a List

Selecting column names from a selection list is faster and lesserror-prone than inserting them manually. You can list the columnsin the parent or child table by using the LIST COLUMNS command.Columns already included in the relationship are not displayed in thelist. The list includes the data type of each column to assist you inselecting compatible columns. To demonstrate, assume that thefollowing command has been entered:

LIST COLUMNS CHILD

Along with the selection list prompt, the Define Relationship panel isredisplayed with a new field, Num, and the columns in the parenttable are numbered. This enables you to select each desired childcolumn by specifying the number of the corresponding parent column.

In the following figure, a 1 is typed in the Cmd field to the left ofCUST_ID to match it to the CUST_ID column in the CUSTOMERStable.

----------------------------- Define Relationship ----------------------------COMMAND ===> SCROLL ===> CSR

Define PST Relationship CUSTORD Special Commands: LIST COLUMNS, EXPAND, GENERIC, MODEL

Parent: PSTDEMO.CUSTOMERS Child: PSTDEMO.ORDERS

Cmd Num Column Name Data Ty +------------ Child Columns -------+--- --- ------------------------ ------- | |*** ********************************* TO | Select Columns by Matching 'Num' |___ 1 CUST_ID CH(5) | |___ 2 ADDRESS VCH(50) | Num Column Name Data Type |___ 3 CITY VCH(15) | --- ----------------- ---------- |*** ******************************* BOTT | *** *********** TOP ************ | | 1__ CUST_ID CH(5) | | ___ ORDER_ID DEC(5,0) | | ___ ORDER_DATE DATE | | ___ ORDER_TIME TIME | | ___ FREIGHT_CHARGES DEC(4,2) | | ___ ORDER_SALESMAN CH(6) | | ___ ORDER_POSTED_DATE TIMESTAMP | | *** ********* BOTTOM *********** | +----------------------------------+

Figure 113. Selecting Columns from List

A relationship can contain up to 64 pairs of corresponding columns,therefore you can select columns from the list until that limit isreached. The column selection numbers must be sequential. You canspecify a number that exceeds the last numbered entry on the panel byone, to insert a new entry in the relationship. Additional new entriesare inserted if you specify a sequential series of numbers that beginwith the number one greater than the number of the last entry.

Page 219: Move for DB2 User Guide

4.2 Relationships

User Manual 205

When END is used, the selected column name is inserted in theappropriate Column Name field of the child table, as shown in thefollowing figure. The Num field is no longer displayed on the panel.

------ --------------------- Define Relationship --------------------------COMMAND ===> SCROLL ===> CSR

Define Relationship CUSTORD Special Commands: LIST COLUMNS, EXPAND, GENERIC, MODEL

Parent: PSTDEMO.CUSTOMERS Child: PSTDEMO.ORDERS 1 OF 3Cmd Column Name Data Type Column Name Data Type--- ------------------------ --------- ------------------------ -----------*** ******************************** TOP **********************************___ CUST_ID CH(5) CUST_ID CH(5)___ ADDRESS VCH(50) REQUIRED___ CITY VCH(15) REQUIRED*** ******************************* BOTTOM ********************************

Figure 114. Selected Columns Inserted

You can also use the Select line commands, S and SS, to selectcolumns from the selection list. These names are added, in the sameorder as shown on the selection list, at the end of the list in theColumn Name field.

Conversely, you can request a selection list of columns for the parenttable using the LIST COLUMNS PARENT command. The selectionlist prompt overlays the parent table and the columns in the child tableare numbered.

You can use cursor position to indicate the table name when using theLIST COLUMNS command. Type the LIST COLUMNS commandwith no operands, position the cursor on the desired table name or listof columns, and press ENTER. The appropriate column selection listis displayed.

Expressions

One of the most powerful features of PST relationships is the abilityto combine columns with concatenation and use partial columns withthe substring function.

Often the data contained in two or more columns in one table iscontained in a single, composite column in another table. To definethis type of data structure in a relationship, use the concatenationoperator to concatenate multiple columns. The concatenationoperator (CONCAT or || ) can be specified in the parent or childColumn Name fields.

For example, assume that the parent table, CUSTOMERS, contains anADDRESS1 column for the customer’s street and an ADDRESS2

ConcatenatingColumns

Page 220: Move for DB2 User Guide

4. Definitions

206 Move for DB2

column for apartment information. Assume that the child table,ORDERS, contains only one column, ADDRESS, for both the street andapartment information. To relate the two columns to the single column,concatenate ADDRESS1 and ADDRESS2 by entering one of thefollowing in the Column Name field of the CUSTOMERS table:

ADDRESS1 || ADDRESS2 or ADDRESS1 CONCAT ADDRESS2

Next, enter the ADDRESS column in the corresponding field for theORDERS table, as shown in the following figure. When you specifya concatenation operator in a Column Name field, the Data Type fieldfor that column reflects the attributes of the expression formed by theconcatenation. If the data type for ADDRESS1 is CHAR(25) andADDRESS2 is CHAR(25), the data type of the concatenatedexpression is CHAR(50).

--------------------------- Define Relationship ---------------------------COMMAND ===> SCROLL ===> CSR

Define Relationship CUSTORD Special Commands: LIST COLUMNS, EXPAND, GENERIC, MODEL

Parent: PSTDEMO.CUSTOMERS Child: PSTDEMO.ORDERS 1 OF 1Cmd Column Name Data Type Column Name Data Type--- ------------------------- ---------- ------------------------ ---------*** ********************************* TOP *********************************___ ADDRESS1 || ADDRESS2 CH(50) ADDRESS CH(50)*** ******************************** BOTTOM *******************************

Figure 115. Concatenated Columns

If you need more space to specify a concatenated expression, you canuse the EXPAND command to display the specified column in theexpanded editor window (refer to page 208 for details on EXPAND).

Observe the following rules when defining a concatenated expression:

• Only CHAR or VARCHAR columns, string literals, andsubstring functions can be specified.

• Special Registers are not supported.

• A zero-length string literal, usually indicated as ' ', is not valid ina concatenated expression.

When one column in a table contains the data that is contained in twoor more columns in another table, you may find it useful to use aportion of this composite column in a relationship. To do so, use theSUBSTR function to retrieve a substring of the contents of acharacter column.

ConcatenationRules

SubstringingColumns

Page 221: Move for DB2 User Guide

4.2 Relationships

User Manual 207

The MOVE SUBSTR function is identical to the DB2 SUBSTRfunction in format and operation:

SUBSTR(column-name,start,length)

where:

column-name Specifies the name of a CHAR or VARCHARcolumn.

start Specifies the starting position of the substring as aninteger (1 or greater). The start value is required.

length Specifies the length of the substring as an integer(1 or greater). The length is optional. If omitted, thesubstring consists of the data beginning at the startposition through the last character.

The combined value of start and length cannot exceed the lengthattribute of the column.

To demonstrate, suppose a table contains a PHONE_NUMBERcolumn with a CHAR(10) data type, but you want to use only the firstthree positions of the column (the area code) in a relationship. Enterthe following SUBSTR function in the Column Name field of theDefine Relationship panel:

SUBSTR(PHONE_NUMBER,1,3)

When you specify a substring function in a Column Name field, theData Type field for that column reflects the attributes of the substring.

--------------------------- Define Relationship ---------------------------COMMAND ===> SCROLL ===> CSR

Define Relationship CUSTORD Special Commands: LIST COLUMNS, EXPAND, GENERIC, MODEL

Parent: PSTDEMO.CUSTOMERS Child: PSTDEMO.ORDERS 1 OF 1Cmd Column Name Data Type Column Name Data Type--- ------------------------- ---------- ------------------------ ---------*** ********************************* TOP *********************************___ SUBSTR(PHONE_NUMBER,1,3) CH(3) AREA_CODE CH(3)*** ******************************** BOTTOM *******************************

Figure 116. Substring of Column

If you need more space to enter a substring function, you can use theEXPAND command to display the specified column in the expandededitor window (refer to page 208 for details on EXPAND).

When a relationship is based on a composite column, it can be definedas a concatenation, as shown below:

Concatenate orSubstring

Page 222: Move for DB2 User Guide

4. Definitions

208 Move for DB2

Parent: PSTDEMO.TABLE1 Child: PSTDEMO.TABLE2 1 OF 1Cmd Column Name Data Type Column Name Data Type--- ------------------------- ---------- ------------------------ ---------*** ********************************* TOP *********************************___ STREET || CITY CH(50) ADDRESS CH(50)*** ******************************** BOTTOM *******************************

Or as a series of substrings, as shown below:

Parent: PSTDEMO.TABLE1 Child: PSTDEMO.TABLE2 1 OF 2 CmdColumn Name Data Type Column Name Data Type--- ------------------------- ---------- ------------------------ ---------*** ********************************* TOP *********************************___ STREET CH(25) SUBSTR(ADDRESS,1,25) CH(25)___ CITY CH(25) SUBSTR(ADDRESS,26,25) CH(25)*** ******************************** BOTTOM *******************************

Although these two variations are functionally equivalent and willretrieve the same set of related rows, the concatenation is moreefficient than the series of substrings. In general, concatenationresults in better performance because it directs DB2 to use an index ifone is available.

MOVE generates the following SQL for the first relationship:

SELECT * FROM TABLE2 WHERE TABLE2.ADDRESS = 'composite value from both parent columns'

The following SQL is generated for the second relationship:

SELECT * FROM TABLE2 WHERE SUBSTR(TABLE2.ADDRESS, 1, 25) = 'value from parent STREET column' AND SUBSTR(TABLE2.ADDRESS, 26, 25) = 'value from parent CITY column'

The second predicate in the second example references the low-orderportion of a column, therefore, DB2 will not use an index on theADDRESS column, even if one exists. As a result, DB2 must scanall rows in the table.

Editing Long Column Name Field Values

Often the amount of space available on the Define Relationship panelis insufficient for long Column Name field values—especially whenexpressions containing concatenation and substrings have beenspecified.

If the length of a column name or expression exceeds the spaceavailable on the panel, the data display for that column is truncated,protected and cannot be edited directly. Use the EXPAND commandto display the Expanded Relationship Editor prompt. This promptenables you to modify both the parent and child columns by providinga 75-character field for each column.

Page 223: Move for DB2 User Guide

4.2 Relationships

User Manual 209

Type the EXPAND command in the command area, position thecursor on the desired parent/child column pair, and press ENTER.Alternatively, you may use the EXP line command.

----------------------------- Define Relationship ---------------------------COMMAND ===> SCROLL ===> CSR

Define Relationship CUSTORD Special Commands: LIST COLUMNS, EXPAND, GENERIC, MODEL

Parent: PSTDEMO.CUSTOMERS Child: PSTDEMO.ORDERS 1 OF 3Cmd Column Name Data Type Column Name Data Type

+----------------------- Expanded Relationship Editor ----------------------+| || Parent Table: PSTDEMO.CUSTOMERS Data Type: CH(3) || SUBSTR(PHONE_NUMBER,1,3) || || Child Table: PSTDEMO.PHONE Data Type: CH(3) || AREA_CODE |+---------------------------------------------------------------------------+

Figure 117. Expanded Relationship Editor Prompt

While the Expanded Relationship Editor prompt is displayed, you can scrollto the previous or next column pair using the UP, DOWN, TOP, or BOTTOMcommands.

The LIST COLUMNS command (described on page 204) is availablewhile the expanded window is displayed. However, in this context,the command provides a selection list from which one column may beselected using the S line command. The selected column is added tothe end of the column specification, preceded by the concatenationoperator, � . You can remove the concatenation operator if desired.Only character data columns can be concatenated.

Use CANCEL to abandon the changes to the current column pair andreturn to the Define Relationship panel. Changes made to a columnpair prior to scrolling cannot be abandoned with the CANCELcommand.

Use END to return to the Define Relationship panel. If the length ofthe column name exceeds the space available, the data is truncatedand protected. You can use the EXPAND command again torespecify the data.

Editing with Line Commands

The facilities described in the previous sections are used to populate arelationship with column names and expressions, but you can alsomanipulate individual lines or parts of lines in a relationship.

Page 224: Move for DB2 User Guide

4. Definitions

210 Move for DB2

The following line commands are available on the DefineRelationship and Modify Relationship panels. Line commands areentered in the Cmd field.

D[n] Deletes one or more lines. n is the number of lines to bedeleted. If n is omitted, one line is deleted. Use the blockform (DD) to delete a block of lines.

The entire line is deleted. To delete one column name,position the cursor at the beginning of the column name andpress EOF or overtype the field with blank.

I[n] Inserts one or more blank lines. n is the number of lines tobe inserted. If n is omitted, one line is inserted.

R[n] Repeats a line one or more times. n is the number of timesthe line is to be repeated. If n is omitted, the line is repeatedonce. Use the block form (RR) to repeat a block of lines.

C[n] Copies one or more lines. n is the number of lines to becopied. If n is omitted, one line is copied. Use the blockform (CC) to copy a block of lines.

M[n] Moves one or more lines. n is the number of lines to bemoved. If n is omitted, one line is moved. Use the blockform (MM) to move a block of lines.

A Specifies the “after” destination for copied or moved lines.

B Specifies the “before” destination for copied or moved lines.

O Specifies the “overlay” destination for copied or movedlines.

EXP Column names and values are protected if they exceed thespace available in the Column Name field. Use the EXP linecommand to display the Expanded Relationship Editorprompt for editing long column names or values.

Line Commands

Page 225: Move for DB2 User Guide

4.2 Relationships

User Manual 211

The O (Overlay) line command enables you to merge copied or movedlines with a target line. Consider the following example in which amove operation is performed.

Cmd Column Name Data Type Column Name Data Type--- ------------------------- --------- ------------------------ ---------*** ********************************* TOP *********************************m__ CUST_ID CH(5) REQUIREDo__ REQUIRED CUST_ID CH(5) *** ******************************** BOTTOM ******************************

When ENTER is pressed, the CUST_ID column name and data typeare moved to the target line and the moved line is deleted.

Cmd Column Name Data Type Column Name Data Type--- ------------------------- --------- ------------------------ ---------*** ********************************* TOP *********************************___ CUST_ID CH(5) CUST_ID CH(5)*** ******************************** BOTTOM *******************************

In contrast, a copy operation is requested.

Cmd Column Name Data Type Column Name Data Type--- ------------------------- --------- ------------------------ ---------*** ********************************* TOP *********************************c__ CUST_ID CH(5) REQUIREDo__ REQUIRED CUST_ID CH(5) *** ******************************* BOTTOM *******************************

The target line is updated, but the copied line is retained.

Cmd Column Name Data Type Column Name Data Type--- ------------------------- --------- ------------------------ ---------*** ********************************* TOP *********************************___ CUST_ID CH(5) REQUIRED___ CUST_ID CH(5) CUST_ID CH(5)*** ******************************** BOTTOM *******************************

When a Move is requested and the moved line contains data thatwould overlay data on the target line, the Move request is changed toa Copy request to prevent the loss of data. MOVE displays amessage in the upper right corner of the panel indicating that the linewas not deleted. You can then use the original data as a guide toassist in further editing.

Other Primary Commands for Editing

Several primary commands are available on the Define Relationshipand Modify Relationship panel.

• Use the RESET primary command to remove any pending linecommands or line commands in error.

Merging Lineswith Overlay

Page 226: Move for DB2 User Guide

4. Definitions

212 Move for DB2

• Use the CLEAR command to remove all column specificationsfrom the Define Relationship or Modify Relationship panels.This is useful when you want to completely redefine therelationship.

• Use the DELETE command to delete the currently displayedrelationship and return to the previous panel. Note that thecurrently displayed relationship will also be deleted if all of theentries are deleted or blank when END is requested.

• Use the CAPS command to translate entered data to uppercase.

Column Name Restrictions

A maximum of 64 columns can be specified for any one table in therelationship. Therefore, a concatenated entry in the Column Namefield cannot include more than 64 columns. If an entry does include64 columns, there can be no other entries in the Column Name field.

Also, the total length of all of the values specified in the ColumnName field cannot exceed 254 characters. If the specification in asingle Column Name field contains 254 characters, no other ColumnName field entries can be made for that table.

Details about column compatibility are provided in Appendix F.Compatibility Rules for Relationships.

4.2.5 Saving and Using the Relationship

MOVE verifies that corresponding columns are compatible when youpress ENTER on the Define Relationship or Modify Relationshippanel. If they are not, an error message indicating the cause of theerror is displayed and the cursor is positioned on the first columnentry in error. Use HELP (usually assigned to PF1) to display a full-screen of information about the error.

You must correct any incompatibility before saving the relationship.

Use the SAVE command to save a relationship but continue definingthat relationship. Use END (usually assigned to PF3) to save therelationship and return to the Choose a Relationship panel. In bothcases, the relationship must be valid as described above.

Use CANCEL to abandon the changes and return to the Choose aRelationship panel.

Page 227: Move for DB2 User Guide

4.2 Relationships

User Manual 213

A relationship defined in the Directory can be affected by changesmade to the underlying tables.

If a table specified in a relationship is dropped, the relationship isconsidered invalid and is not available to satisfy a JOIN request or anextract request. This relationship cannot be updated, however it canbe deleted using the D line command from the selection list ofrelationships on the Select a Relationship panel.

If a column specified in a relationship is dropped or is altered so thatit is incompatible with its corresponding column, the relationship isconsidered invalid and is not available to satisfy a JOIN request or anextract request. If you attempt to update such a relationship, it isdisplayed in the relationship editor with an error message indicatingthat invalid entries have been specified. You can then correct thecolumn specifications.

Relationships are not affected if new columns are added to a tablespecified in a relationship, or when columns not included in therelationship are dropped or altered.

4.2.6 Modeling Relationships

Once a relationship is defined in the DB2 Catalog or Directory, youcan use it as a model for a new, similar relationship. On the DefineRelationship or Modify Relationship panel, enter the MODELcommand to display the following prompt.

--------------------------- Modify Relationship ---------------------------- COMMAND ===> SCROLL ===> CSR

Modify PST Relationship CUSTORD Special Commands: LIST COLUMNS, EXPAND, GENERIC, MODEL

Par +------------------Model New Relationship------------------+ 1 OF 1 Cmd | | a Type --- --- | Modify Child Table or Relationship Name to Create a new | ------- *** *** | relationship with the current column specifications | ******* ___ CUS | | 5) *** *** | Parent Table: PSTDEMO.CUSTOMERS | ******* | | | Child Table: | | Creator ID ===> PSTDEMO | | Table Name ===> ORDERS | | | | Relationship Name ===> newrel | +----------------------------------------------------------+

Figure 118. Model New Relationship Prompt

The displayed information reflects the values for the currentlydisplayed relationship. The name of the parent table is protected.

Impact ofDatabase Changes

Page 228: Move for DB2 User Guide

4. Definitions

214 Move for DB2

You may overtype the Creator ID and Table Name of the child tableand the Relationship Name.

Since a unique relationship name is based on concatenating theCreator ID and Table Name of the child table with a RelationshipName, only these values may be changed when modeling arelationship.

If you specify a relationship that already exists, the following promptis displayed when the existing relationship is defined in the Directory.(An error message is displayed if the existing relationship is defined inthe DB2 Catalog.)

---------------------------- Modify Relationship ------------------------- COMMAND ===> SCROLL ===> CSR

+--------------------Verify MODEL Command--------------------+ | | Pa | The relationship name formed by the new child table name | | and relationship name will conflict with an existing |1 OF 1 Cmd | relationship. Indicate the action that should be taken. | Type --- -- | | ----- *** ** | Press ENTER to Replace Existing Relationship and Proceed | ***** ___ CU | Enter END Command to Alter New Table or Relationship Name | ) *** ** | Enter CANCEL Command to Cancel MODEL Command and Return | +------------------------------------------------------------+ ***** | Creator ID ===> PSTDEMO | | Table Name ===> ORDERS | | | | Relationship Name ===> newrel | +--------------------------------------------------------+

Figure 119. Verify MODEL Command Prompt

Press ENTER to replace the existing relationship and display theDefine Relationship panel for the new relationship. Use END toredisplay the prompt to enable you to alter the table name or therelationship name. Use CANCEL to cancel the MODEL commandand return to the previously displayed Modify Relationship panel.

4.2.7 Generic Relationships

At times it is useful to establish multiple sets of tables that differ onlyby their Creator ID. With generic relationships, you specify therelationships once and use them for all of these sets of tables. Inaddition, when another set of these tables is created, they can also usethese generic relationships.

You can create a generic relationship in the same manner as anyexplicit relationship or by converting an existing, explicit relationshipto a generic relationship. A generic relationship is identified by an

If RelationshipExists

Page 229: Move for DB2 User Guide

4.2 Relationships

User Manual 215

asterisk, *, for the Creator ID. The tables used to define a genericrelationship must have the same Creator ID.

To create a generic relationship, specify Option 1 CREATE and anasterisk for the Creator ID, a table name, and a relationship name onthe Choose a Relationship panel. In the following figure,*.CUSTOMERS is one of the tables in the relationship named TEST.

------------------------- Choose a Relationship --------------------------OPTION ===> 1

1 CREATE - Create a Relationship for Specified Parent or Child Table 2 MODIFY - Modify a Relationship for Specified Child Table 3 LIST - List All Relationships for Specified Table

Specify Table Name (Child for OPTION 2, Parent or Child for OPTIONS 1 and 3) CREATOR ID ===> * TABLE NAME ===> CUSTOMERS

Specify Relationship Name (OPTIONS 1 and 2) RELATIONSHIP NAME ===> TEST

Specify Relationship Type (OPTIONS 2 and 3) RELATIONSHIP TYPE ===> (P-PST, D-DB2, B-Both)

USE '_' for DB2 LIKE CHARACTER ===> NO (Y-Yes, N-No)

These commands are available when the Selection list is displayed: S - Select a Relationship D - Delete a Relationship (PST Relationships Only) LR - List all Relationships for the other Table in Relationship AT - Modify Attributes of a Relationship (PST Relationships Only)

Figure 120. Creating a Generic Relationship

Creating a GenericRelationship

Page 230: Move for DB2 User Guide

4. Definitions

216 Move for DB2

When you press ENTER, MOVE prompts for a Creator ID todetermine which tables to use as the base tables.

--------------------------- Choose a Relationship ---------------------------OPTION ===>

1 CREATE - Create a Relationship for Specified Parent or Child Table 2 MODIFY - Modify a Relationship for Specified Child Table 3 LIST - List All Relationships for Specified Table

Specify Table Name (Child for OPTION 2, Parent or Child for OPTIONS 1 and 3) CREATOR ID ===> * TABLE NAME ===> CUSTOMERS

Specify Rela RELATIONSH +----------------CreatorID Prompt----------------+ | |Specify Rela | Relationship Definition Involves a Generic Key | RELATIONSH | Supply a CreatorID for Base Tables | oth) | |USE '_' for | Press ENTER Key or Enter END Command when Done | | Enter CANCEL Command to Exit Key Definition |These comman | | d: S - Selec | CreatorID ===> pstdemo | D - Delet +------------------------------------------------+ LR - List p AT - Modify Attributes of a Relationship (PST Relationships Only)

Figure 121. Specify Creator ID for Base Table

Type a Creator ID and press ENTER. The Create a NewRelationship panel is displayed.

--------------------------- Choose a Relationship ---------------------------OPTION ===>

1 CREATE - Create a Relationship for Specified Parent or Child Table 2 M 3 L +------------------Create a New Relationship-----------------+ | |Specif | Specified Table : *.CUSTOMERS | and 3) CREA | Table Type ===> P (P-PARENT, C-CHILD) | TABL | | | Leave blank or include wild cards for Table Selection List |Specif | | RELA | Other Table: (Base Creator ID: PSTDEMO) | | Creator ID : * |Specif | Table Name ===> orders | RELA | | | Relationship Name ===> TEST |USE '_ +------------------------------------------------------------+

These comman | | d: S - Selec | CreatorID ===> PSTDEMO | D - Delet +------------------------------------------------+ LR - List p AT - Modify Attributes of a Relationship (PST Relationships Only)

Figure 122. Create New Generic Relationship

The name of the table specified on the Choose a Relationship panelis displayed as the Specified Table. MOVE places an asterisk in theOther Table Creator ID field and protects the field. Provide the

Page 231: Move for DB2 User Guide

4.2 Relationships

User Manual 217

name of the Other Table in the relationship. When the panel isdisplayed for the first time, the Specified Table is assumed to be thechild and the Other Table the parent. If you decide that theSpecified Table should be the parent table, you can change the TableType to P as shown in Figure 122. Create New Generic Relationship.MOVE then assumes the Other Table is the child. The value youspecify for Table Type is profiled.

When you have provided the name for the Other Table, pressENTER to display the Define Relationship panel (see Figure 111).

The GENERIC command can be entered on the Modify Relationshipor Define Relationship panel to convert the currently displayedexplicit relationship into a generic relationship. (A genericrelationship cannot be transformed into an explicit relationship.) Thefollowing prompt is displayed. You can specify whether the explicitrelationship is to be deleted or retained.

------------------------- Modify Relationship ------------------------------ COMMAND ===> SCROLL ===> CSR

Modify PST Relationship CUSTORD Special Commands: LIST COLUMNS, EXPAND, GENERIC, MODEL

Parent: PSTDEMO.CUSTOMERS Child: PSTDEMO.ORDERS 1 OF 1 Cmd Type --- -- +-----------------Confirm GENERIC Processing-----------------+ ------ *** ** | | ****** ___ CU | Press ENTER to Delete Existing Explicit Relationship | ) *** ** | Enter END Command to Retain Existing Explicit Relationship | ****** | Enter CANCEL Command to Return to Relationship Editor | +------------------------------------------------------------+

Figure 123. Confirm GENERIC Processing Prompt

If the name duplicates an existing generic relationship, a prompt isdisplayed. You can decide whether or not to replace the existinggeneric relationship.

--------------------------- Modify Relationship ---------------------------- COMMAND ===> SCROLL ===> CSR

Modify PST Relationship CUSTORD Special Commands: LIST COLUMNS, EXPAND, GENERIC, MODEL

Parent: PSTDEMO.CUSTOMERS Child: PSTDEMO.ORDERS 1 OF 1 C - +------------------Confirm GENERIC Override Processing------------------+ * | | _ | Generic Relationship With Same Name Already Exists | * | | | Press ENTER to Confirm Override of Existing Generic Relationship | | Enter END Command to Cancel Override of Existing Generic Relationship | +-----------------------------------------------------------------------+

Figure 124. Generic Relationship Override Confirmation Prompt

Converting to aGenericRelationship

Page 232: Move for DB2 User Guide

4. Definitions

218 Move for DB2

The GENERIC command only converts relationships in which bothtables have the same Creator ID. If the tables do not have the sameCreator ID, a message is displayed.

You can modify a generic relationship by specifying the relationshipon the Choose a Relationship panel or selecting the relationship onthe Select Relationships panel. Once a relationship is selected, theModify Relationship panel is displayed.

You are prompted for a Creator ID to identify the base tables. Youare not required to specify the same Creator ID that was used tocreate the generic relationship. If you specify a different Creator ID,all of the columns referenced in the relationship must be included inthe tables. If the columns are not contained in the tables indicated bythe specified Creator ID, you are prompted to respecify a Creator IDor override the existing generic relationship. If you elect to override,the existing generic relationship is deleted and you can redefine thegeneric relationship.

Assume you have specified a generic relationship named*.ORDERS.CUSTORD consisting of the CUSTOMERS table as theparent and the ORDERS table as the child. The prompt for a CreatorID is displayed.

-------------------------- Choose a Relationship ------------------------OPTION ===>

1 CREATE - Create a Relationship for Specified Parent or Child Table 2 MODIFY - Modify a Relationship for Specified Child Table 3 LIST - List All Relationships for Specified Table

Specify Table Name (Child for OPTION 2, Parent or Child for OPTIONS 1 and 3) CREATOR ID ===> * TABLE NAME ===> CUSTOMERS

Specify Rela RELATIONSH +----------------CreatorID Prompt----------------+ | |Specify Rela | Relationship Definition Involves a Generic Key | RELATIONSH | Supply a CreatorID for Base Tables | oth) | |USE '_' for | Press ENTER Key or Enter END Command when Done | | Enter CANCEL Command to Exit Key Definition |These comman | | d: S - Selec | CreatorID ===> pstdemo | D - Delet +------------------------------------------------+ LR - List p AT - Modify Attributes of a Relationship (PST Relationships Only)

Figure 125. Prompt for Creator ID

Modifying aGenericRelationship

Page 233: Move for DB2 User Guide

4.2 Relationships

User Manual 219

Once a Creator ID is specified, the Modify Relationship panel isdisplayed, as shown in the following figure.

--------------------------- Modify Relationship ---------------------------COMMAND ===> SCROLL ===> CSR

Modify GENERIC Relationship CUSTORD using Base Creator ID PSTDEMO Special Commands: LIST COLUMNS, EXPAND, MODEL

Parent: *.CUSTOMERS Child: *.ORDERS 1 OF 1Cmd Column Name Data Type Column Name Data Type--- ------------------------- ---------- ------------------------ ---------*** ********************************* TOP *********************************___ CUST_ID CHAR(5) CUST_ID CHAR(5)*** ******************************** BOTTOM *******************************

Figure 126. Modify Generic Relationship

You can modify the generic relationship as if it were an explicitrelationship.

There is no difference in function or appearance between genericrelationships and explicit relationships. The same Creator ID isrequired for both tables when defining or modifying the genericrelationship. When the generic relationship is used to join tables orextract data, the tables are not required to have the same Creator ID.

Explicit relationships take precedence over generic relationships. Ifthere are any explicit DB2 or PST relationships, they will be used.Generic relationships are only used when no explicit relationshipexists between two tables.

Using GenericRelationships

Page 234: Move for DB2 User Guide

4. Definitions

220 Move for DB2

4.3 Column Maps

This section discusses how to define Column Maps. A Column Mapis a set of instructions used by MOVE to transform source data intothe destination form. Column Maps are used during the Insert, Load,and Convert Processes.

Column Maps are very useful for:

• Matching source and destination columns with different names.

• Modifying the data by:

- Masking sensitive data.

- Inserting literals, default values or DB2 special registers intocolumns.

- Specifying an expression.

- Adjusting date values in numeric, DATE, and TIMESTAMPcolumns.

- Propagating changes to values in the primary key to therelated foreign keys.

- Deriving a value by executing a routine that converts thesource value according to site-defined rules.

• Selectively copying columns to:

- Split tables.

- Copy one source column to multiple destinations.

- Create a single destination table from the data in a joinedview.

- Exclude columns from being copied to the destination table.

Column Maps are used by the following processes:

Insert Process When the source and destination do not matchor when you want to control the data insertedat the destination, use Column Maps. Notrequired.

Using ColumnMaps

Page 235: Move for DB2 User Guide

4.3 Column Maps

User Manual 221

Convert Process Usually specified to transform the source datasince the transformation is the express purposeof the Convert Process. This process createsan Extract File to contain the converted databut does not insert that data into the destinationdatabase.

DB2 Load Process As with the Insert Process, enables you tocontrol the data inserted at the destination. Notrequired.

For the Insert Process and the Load Process, the Column Maps mustbe present in the destination DB2 subsystem where the process isperformed. In most cases, Column Maps are defined while you are ina MOVE session and connected to the destination DB2 subsystem.

MOVE automatically performs certain data conversions as part ofthese processes. For full details on the conversions, see page 235.

Using Column Maps provides great control and flexibility. Forexample, specific source columns can be bypassed for one Insert orConvert Process and incorporated in another by using different mapsfor a single Extract File with the same or different destinations.

You can define Column Maps by:

• Selecting Option 3 COLUMN MAPS on the Choose a DefinitionOption submenu displayed when Option 6 DEFINITIONS isselected on the Main Menu as discussed in this section.

• Using the MAP command on the INSERT Process Table Map,the LOAD Process Table Map, or the CONVERT ProcessTable Map panels. This is discussed in Section 5.4 InsertProcess.

It is helpful to follow some logical set of naming conventions whencreating Column Maps to organize the maps and identify their use.For example, all maps created by a specific user could share acommon Map ID and the map name could reflect specificprogramming projects. Thus COHEND.INVCUST,COHEND.ACCTCUST, and COHEND.TSTCUST could be namesfor Column Maps created by the user COHEND. These ColumnMaps could all apply to the same destination CUSTOMERS tablewhere the source mapping varies based on the application to be tested.If another programmer needs to test different processes of these sameapplications against different data in the same table, his ColumnMaps might be named SMITH.INVCUST, SMITH.ACCTCUST,and SMITH.TSTCUST.

NamingConventions

Page 236: Move for DB2 User Guide

4. Definitions

222 Move for DB2

4.3.1 Choosing a Column Map

When Option 3 is selected on the Choose a Definition Option menu,the Choose a Column Map panel is displayed. The panel promptsfor the Map ID and Map Name.

-------------------------- Choose a Column Map -----------------------Command ===>

Column Map: Map ID ===> Map Name ===>

Use '_' for DB2 LIKE character ===> N (Y-Yes, N-No)

Rules used to validate Column Map ===> M (M-Move, C-Compare)

Figure 127. Choose a Column Map

The fields on this panel are:

Map ID 1- to 8-character Map ID. DB2 LIKEsyntax can be used to display a selectionlist. If the field is blank or '%' is specified,a list of maps, as specified in the MapName field, for all Map IDs is displayed.

Map Name 1- to 12-character name of the map beingdefined or modified. DB2 LIKE syntax canbe used to display a selection list. If thefield is blank or '%' is specified, a list of allmaps for the specified Map ID is displayed.

Use '_' for DB2LIKE character

Specifies whether or not the underscore, '_',is to be used as a DB2 LIKE character orused literally as part of the name. For example, A_B could be assumed to bea three-character name containing thecharacters 'A_B' as entered or a three-character name that begins with 'A', endswith 'B', and has any valid character in themiddle. The default is No which meansthat '_' is not handled as a DB2 LIKEcharacter.

Panel Fields

Page 237: Move for DB2 User Guide

4.3 Column Maps

User Manual 223

Rules Used to ValidateColumn Map

Specifies whether the Column Map shouldcomply with the rules for MOVE or forCompare for DB2. MOVE provides moreextensive facilities for mapping columnsincluding literals, constants, expressions,exit routines, and special registers.Compare for DB2 enables users to onlymap columns with compatible attributesand eliminate columns from processing.

This prompt is only displayed when bothMOVE and Compare for DB2 are installedand only applies when creating a newColumn Map.

Specify the Map ID and Map Name to proceed. You can specify theMap ID and Map Name explicitly or enter a blank field or DB2 LIKEsyntax to display a selection list.

If explicit values are specified for the Map ID and Map Name fields,then:

• If the named Column Map exists, MOVE displays the map on theModify Column Map panel.

• If the named Column Map does not exist, MOVE prompts for theadditional information needed to create a new map on the SpecifyColumn Map Tables panel.

A selection list is requested by using DB2 LIKE syntax or leaving afield blank:

• MOVE displays a list of Column Maps on the Select ColumnMaps panel. Use the S line command or the SELECT primarycommand to select a Column Map. If an existing Column Map isselected, the Modify Column Map panel is displayed. If a newColumn Map is named on the SELECT command, the SpecifyColumn Map Tables panel is displayed first.

• If there are no Column Maps that satisfy the selection list criteria,a message is displayed on the Choose a Column Map panel.

Explicit Names

Selection List

Page 238: Move for DB2 User Guide

4. Definitions

224 Move for DB2

4.3.2 Selection List of Column Maps

The selection list is displayed as:

----------------------------- Select Column Maps ----------------------------- COMMAND ===> SCROLL ===> CSR

Line Cmds: S-Select, D-Delete, C-Copy, R-Rename, AT-Attr, I-Info 1 of 4

-------- Map -------- -------- Source --------- ------ Destination ------ Cmd ID Name Creator Table Creator Table --- -------- ------------ -------- ---------------- -------- ---------------- ******************************* TOP ************************************* ___ FEINP PSTCUST PSTDEMO CUSTOMERS PSTDEMO2 CUSTOMERS ___ COHEND ORDERS PSTDEMO ORDERS PSTDEMO2 ORDERS ___ SENTNERM TEST SOFTECH SHIP_TO PSTDEMO2 SHIP_TO ___ FEINP PSTTEST SOFTECH CUSTOMERS PSTDEMO CUSTOMERS ***************************** BOTTOM ************************************

Figure 128. Select Column Maps

The fields on this panel are:

Cmd Line command entry field. The possible line commandsare:

S Select a Column Map.

D Delete a Column Map. After deleting, themessage “*DELETED” is displayed in theCreator field under the Source heading.

C Copy a Column Map. The Copy Column Mappanel prompts for the name of the new ColumnMap. After copying, the message “*COPIED”is displayed in the Creator field under theSource heading. (See page 226 for details.)

R Rename a Column Map. The Rename ColumnMap panel prompts for the new name of theselected Column Map. After renaming, themessage “*RENAMED” is displayed in theCreator field under the Source heading. (Seepage 227 for details.)

AT Modify attributes of a Column Map. TheObject Attributes panel allows you to edit thedescription and security status of the ColumnMap. (See page 226 for details.).

I Display information about a Column Map.

Panel Fields

Page 239: Move for DB2 User Guide

4.3 Column Maps

User Manual 225

ID 1- to 8-character Map ID.

Name 1- to 12-character name of the Column Map.

Creator Creator ID of the source or destination table asidentified by the field heading.

Table 1- to 18-character name of the source or destinationtable as identified by the field heading.

A user option controls whether or not the description of each ColumnMap is displayed on this panel. See Section 6.1 User Options forinformation about the Selection List Format option.

To display the attributes of a Column Map, type I in the Cmd fieldnext to the name of the Column Map. The following figure shows theColumn Map Attributes panel.

----------------------------- Column Map Attributes -------------------- COMMAND ===>

ID : FEINP Name : PSTCUST

Description : Sample Column Map Security Status : PUBLIC Last Modified By : MCGARRM Modified On : 2000-01-18-02-17 14.10.17

Number of Columns : 9 Destination Table : PSTDEMO.CUSTOMERS

Source Type : TABLE

Extract File Name : Source Table : PSTDEMO.CUSTOMER Validations : YES

Figure 129. Column Map Attributes

This is a read-only display. MOVE generates and maintains all of theinformation on this panel based on your specifications for the ColumnMap.

Note that Extract File Name is blank if the specified Source Table isnot from an Extract File. Also, the Security Status is displayed if it isenabled by site management.

Description

Column MapAttributes

Page 240: Move for DB2 User Guide

4. Definitions

226 Move for DB2

To modify the description attribute of a Column Map, type AT in theCmd field next to the name of the Column Map to display the ObjectAttributes panel.

+-----------------------Object Attributes-----------------------+ ¦ ¦ ¦ Object Name: FEINP.PSTCUST ¦ ¦ ¦ ¦ Modify the attributes below as needed. ¦ ¦ ¦ ¦ Description ===> ¦ ¦ ¦ ¦ Security Status ===> PUBLIC (PUBLIC, PRIVATE, READONLY) ¦ ¦ ¦ ¦ Use END command to accept any changes and return. ¦ ¦ Use CANCEL command to ignore any changes and return. ¦ ¦ ¦ +---------------------------------------------------------------+

Figure 130. Object Attributes

The Object Attributes panel provides a 40-character area to displayand edit the description. An 8-character area is available to specifyone of the following security statuses:

PUBLIC Anyone can edit and use. PRIVATE Only owner can edit and use. READONLY Anyone can use, only owner can edit. Based on installation options, site management can establish thatusers may not specify security status on this panel. In that case, theprompt for security status is replaced with “Not Active” on the panel.Any attempt to change the security status will result in an errormessage. For additional information about the Object Attributespanel see Specify Description and Security Status in Section 6.1User Options.

To copy a Column Map, type C in the Cmd field next to the name ofthe source Column Map. The following figure shows the CopyColumn Map panel.

+----------Copy Column Map---------+ ¦ ¦ ¦ Existing Name: FEINP.PSTCUST ¦ ¦ ¦ ¦ New Name: ¦ ¦ ¦ ¦ MapID ===> CASHMAN ¦ ¦ Map Name ===> PSTCUST ¦ +----------------------------------+

Figure 131. Copy Column Map

The Copy Column Map panel displays the name of the originalColumn Map and prompts for a new two-part name.

ObjectAttributes

Copy a ColumnMap

Page 241: Move for DB2 User Guide

4.3 Column Maps

User Manual 227

To rename a Column Map, type R in the Cmd field next to the nameof the Column Map. The following figure shows the RenameColumn Map panel.

+-------Rename Column Map-------+ ¦ ¦ ¦ Existing Name: FEINP.PSTCUST ¦ ¦ ¦ ¦ New Name: ¦ ¦ ¦ ¦ MapID ===> CASHMAN ¦ ¦ Map Name ===> PSTCUST ¦ +-------------------------------+

Figure 132. Rename Column Map

The Rename Column Map panel displays the current name of theColumn Map and prompts for a new two-part name.

The SELECT primary command can be used to select a specificColumn Map. The selected Column Map does not have to beincluded on this list. For example, to select the Column Map namedCOHEND.TESTORDS, enter:

SELECT COHEND.TESTORDS

If the Column Map exists, the source and destination are displayed onthe Modify Column Map panel. If the Column Map does not exist,MOVE prompts for the source and destination tables on the SpecifyColumn Map Tables panel. After the table names are specified, theDefine Column Map panel is displayed.

Rename a ColumnMap

SELECT PrimaryCommand

Map Display

Page 242: Move for DB2 User Guide

4. Definitions

228 Move for DB2

4.3.3 Specifying Column Map Tables

The Specify Column Map Tables panel prompts for the source anddestination table names. This panel is displayed when the ColumnMap option has been selected from the Choose a Definitions Optionmenu and a new map is being created.

-------------------------- Specify Column Map Tables ------------------------COMMAND ===>

INSTRUCTIONS: Specify Destination Table (Required) and Source Table (Optional) for Column Map COHEND.TESTORDS

Use Destination Columns From a DB2 Table: Creator ID ===> SOFTECH Table Name ===> ORDERS

Use Source Columns From: An Extract File: DSN of Extract File ===> 'SOFTECH.PST.EXTRACT.ORDS' Extract Table ===> PSTDEMO.ORDERS

Or, a DB2 Table (Use LIKE Syntax for List): Source Creator ID ===> ________ Source Table Name ===> ____________

Figure 133. Specify Column Map Tables

The prompts on this panel include:

Creator ID 1- to 8-character Creator ID of the destinationtable. By default, the current user's SQL IDis supplied.

Table Name 1- to 18-character name of the destinationtable. A destination table must be specified.

DSN of Extract File Name of the data set containing the ExtractFile to be used as the source. This value ismutually exclusive with the prompts for asource DB2 table.

Extract Table Fully qualified name of the table in theExtract File that is to be used as the source.The name must include the Creator ID (e.g.,PSTDEMO.ORDERS). Use either of thewild card characters, * or %, as the onlycharacter or leave the field blank to obtain aselection list of tables.

Source Creator ID 1- to 8-character Creator ID of the sourcetable.

Panel Fields

For a DB2 table

Page 243: Move for DB2 User Guide

4.3 Column Maps

User Manual 229

Source Table Name 1- to 18-character name of the source table.These two values are mutually exclusivewith the Extract File prompt.

Except for the destination Creator ID, the fields are blank when thepanel is displayed initially.

Source Table

The purpose of the source table in the Column Map is to provide thenames of the columns from which the data is to be copied so that youcan match the source column names with the destination columnnames.

The source table can be:

• A database table

• A table in the Extract File

• None

You would use one of these options based on the appropriate scenarioas described below.

Copying within the same DB2 subsystem

When you are copying data within the same DB2 subsystem, itmight be easiest to just point to the actual source table fromwhich the data is being extracted.

Copying across different DB2 subsystems

If you are copying across DB2 subsystems, you cannot accessboth the source and the destination table at the same time. In thiscase, you can use the source table definition that is contained inthe Extract File.

Creating a Column Map without the source table or the ExtractFile

Although it may not be a common occurrence, you may need tocreate a Column Map without having access to either the actualsource table or to the Extract File. You can specify that nosource table is to be used to create the Column Map. Then, youcan manually enter the names of the source columns that map tothe destination columns. Since there are no definitions of thesource columns for MOVE to reference, there is no validation toensure compatible data types. (The validation would beperformed during the actual insert.)

Same DB2Subsystem

Different DB2Subsystem

No Source Table

Page 244: Move for DB2 User Guide

4. Definitions

230 Move for DB2

If entries are not made in the prompts for Use Source ColumnsFrom: on the Specify Column Map Tables panel, MOVEassumes you want to create a map without specifying a sourcetable. A confirmation prompt is displayed. Press ENTER inresponse to this prompt to proceed with the Column Mapdefinition. Use END to indicate that you want to specify a sourcetable; the Specify Column Map Tables panel is redisplayed.

Creating a Column Map using other tables

When you are creating a map manually because you do not haveaccess to the actual source table or the Extract File, you can useother tables that contain some of the source column names. Youcan use several tables to collect the source column names to avoidtyping each source column name.

For example, assume the source and destination tables contain100 columns. You can type all 100 source column names.However, if another table contains 50 of the column names, youcan specify it as the source table for the Column Map. Then, youcan use those names instead of typing them. Also, if a differenttable contains another 25 of the needed names, you can switch tothat table to include those additional names. In fact, thedestination table may already contain many of the source columnnames, so you could specify it as the source table name and usethose names in the Column Map.

This is a convenient way to avoid typing in all of the sourcecolumn names when they exist in other tables.

Validation of column types

By default, MOVE validates the data types of the source anddestination columns during the definition of a Column Map toensure that they are compatible. This validation can be turned offas noted on page 236.

When you use the actual source table or the Extract File in aColumn Map, you would want this validation to occur to ensurethat the Insert, DB2 Load, or Convert Process operates properly.

However, if you were using other tables to get source column names(as in the previous example for multiple source tables), you can turnoff validation. For example, you can turn off validation when thedata types of the actual source columns do not match the data typesof the columns that you are using. The validation detects thisdiscrepancy. Also, you should turn off validation if you choose somecolumns from one table, then switch to another table to selectcolumns and the second table does not contain the columns from the

Multiple SourceTables

Validation

Page 245: Move for DB2 User Guide

4.3 Column Maps

User Manual 231

first table. MOVE issues a warning (the status field contains*ERROR*) to indicate that there are no matches for the columnsselected from the first table.

Note that the validation discussed here refers only to thevalidation done when creating and editing Column Maps. Duringthe actual Insert, DB2 Load, or Convert Process, MOVE alwaysvalidates that the source and destination columns are compatible.

When you are certain you want to use a DB2 table but are unsure ofthe name, you can request a selection list of DB2 table names byusing DB2 LIKE syntax in either or both of the DB2 Table promptfields. A selection list is displayed based on the values you specify.

You can obtain a selection list of Extract File data set names using *or % as the last character of the name in the DSN of Extract Filefield. If you do not use apostrophes, MOVE automatically prefixesthe entry, as specified by the user option, Data Set Prefix, and usesthis value to qualify the selection list.

Use the Select line command, S, to select an entry from any of theselection lists.

4.3.4 Defining Column Maps

After the source and the destination table are identified, thedestination columns are displayed on the Define Column Map panel.(This panel is also displayed when you use the MAPS command onthe INSERT Process Table Map, LOAD Table Map orCONVERT Process Table Map panel.)

MOVE automatically matches every column in the source that has thesame name and compatible data type as the destination. Thesematches are displayed with the status EQUAL or MAPPED. (Thedifference is discussed on page 233.) Any destination column thatdoes not match a source column is assigned the NOTUSED or theREQUIRD status.

Columns with the NOTUSED status are defined to DB2 with adefault column value. Therefore, when the destination is not mappedto a source, the column is populated with DB2-defined default for anINSERT and the column is ignored for an UPDATE.

REQUIRD columns are defined to DB2 as NOT NULL. (That isthey are defined without a default column value). These columnsmust be mapped for an INSERT because DB2 cannot assign a defaultvalue. In contrast, REQUIRD columns do not have to be mapped foran UPDATE. Unmapped REQUIRD columns are unchanged by anUPDATE. However, the Update/Insert process will cause any

Selection Lists

Matching Sourceand Destination

Page 246: Move for DB2 User Guide

4. Definitions

232 Move for DB2

attempts to insert new rows containing unmapped REQUIRD columnsto fail.

When you attempt to save a Column Map with columns in REQUIRDstatus, the Confirm REQUIRD Columns pop-up reminds you thatthe Column Map is only valid when used for an Update/InsertProcess. You can press ENTER to save the Column Map or useEND to return to the editor from this pop-up.

The following figure is an example of the initial panel display:

-- Define Column Map: COHEND.TESTORDS ---------------------------------------COMMAND ===> SCROLL ===> CSR

Corresponding Columns MUST Have Compatible Data TypesUse LIST UNUSED Command for List of Unused Source ColumnsUse LIST ALL Command for List of All Source Columns VAL ON MOVE 1 OF 8 -----PSTDEMO.ORDERS-------- ------------SOFTECH.ORDERS-----------------Cmd Source Column Data Type Num Destination Column Data Type Status--- ----------------- ---------- --- ------------------- --------- ---------*** ******************************** TOP ***********************************___ ORD_ID DEC(5,0) 1 ORD_ID DEC(5,0) EQUAL___ 2 CUST_ID CH(5) NOTUSED___ 3 ORDER_DATE DATE NOTUSED___ 4 ORDER_TIME TIME NOTUSED___ 5 FREIGHT_CHARGES DEC(4,2) NOTUSED___ ORDER_SALESMAN CH(6) 6 ORDER_SALESMAN CH(6) EQUAL___ 7 ORDER_POSTED_DATE TIMESTAMP NOTUSED___ ORDER_SHIP_DATE CH(8) 8 ORDER_SHIP_DATE CH(8) EQUAL*** ****************************** BOTTOM ***********************************

Figure 134. Define Column Map - Initial Column List

The fields on this panel include:

Cmd Line command entry field. Available commands are:

AGE Display the prompts for the AGE function.

CLR Clear the source column field.

D Delete destination columns that become unknownif the destination table name is changed.

EXP Display the Source Column field as a 75-characterfield for specifying the column value.

I Display specific information about a column inerror status.

SRC Replace source column value with column name.

Panel Fields

Page 247: Move for DB2 User Guide

4.3 Column Maps

User Manual 233

The name of the source is provided as a heading.

SourceColumn

The name of the source column to be mapped to thedestination column specified on the same line. You canspecify a different column name, a literal, an expression, afunction, an exit routine, a special register, NULL, orleave this field blank.

DataType

The data type of the source. This value is automaticallysupplied and cannot be modified. Although the data typeof the source and destination do not have to matchexactly, they must be compatible. See page 235 fordetailed information.

Note that when the Source Column contains an AGEfunction specification the Data Type is either blank or“PROP”. “PROP” indicates that the aged value is to bepropagated.

The name of the destination is provided as a heading.

Num A number assigned by MOVE to each destinationcolumn. The numbers are assigned sequentially inascending order. They are intended to be used with theLIST commands and the EXPAND command.

DestinationColumn

The name of the destination column. The columns arelisted in the order in which they were defined within thetable. This cannot be modified.

Data Type The data type of the destination column.

Status Current status of the destination column. This cannotbe modified. The status is one of the following:

EQUAL The destination column and the sourcecolumn have the same data type andlength.

MAPPED The destination column and the sourcecolumn do not have identical data typeor length, but are compatible.

NOTUSED No source is specified. For Insert andLoad, the DB2 default value definedfor the destination column is inserted.

For Update, the existing value in thedestination column is not updated.

Source

Destination

Page 248: Move for DB2 User Guide

4. Definitions

234 Move for DB2

REQUIRD No source is specified and the columnis defined as NOT NULL. There is noDB2 default defined for the column.

When inserting rows, a value must bespecified for the destination column.DB2 cannot supply a default value.When updating rows, the column isnot updated.

If you attempt to insert a row using amap with columns in REQUIRDstatus, the row is discarded.

LITERAL A literal value is supplied as thesource for the destination column.

EXIT The value is to be determined by asite-specific exit routine.

EXPR The value is an expression or afunction.

NULL The keyword NULL is specifiedindicating that the NULL value is tobe inserted in the column.

SPC_REG One of the special registers is specifiedas the value for the destinationcolumn.

*ERROR* The requested mapping is invalid.This status is possible only if a sourcetable has been specified and validationis performed. The Column Mapcannot be saved with columns in thisstatus.

UNKNOWN The named destination column doesnot exist. This occurs if the columnhas been dropped from the destinationtable since the map was created or if adifferent destination table wasspecified.

You can delete these unknowncolumns using the Delete linecommand, D, or the DELETEUNKNOWN primary command. Theline is deleted and the destination

Page 249: Move for DB2 User Guide

4.3 Column Maps

User Manual 235

column count is adjusted.

NOT_INS Data cannot be inserted into thecolumn. For example, the columnmay be an expression in a view.

At any time during the session you can specify a description for theColumn Map you are editing. Use the ATTRIBUTES command todisplay the Object Attributes panel. This panel provides a 40-character area to display and edit the description. (Site managementdetermines whether this panel also displays a prompt for SecurityStatus.) For additional information about the Object Attributespanel see Specify Description and Security Status in Section 6.1User Options.

The following primary commands are available:

ATTRIBUTE DELETE UNKNOWN SAVE BOTTOM DOWN SHOW CANCEL END TOP CAPS EXPAND UP CHANGE TABLES LIST VALIDATION CLEAR RESET Use the CHANGE TABLES command to redisplay the SpecifyColumn Map Tables panel. You can change the source anddestination table names on this panel. However, you can not changethe table names when the Column Map editor is invoked from theINSERT Process Table Map, LOAD Process Table Map orCONVERT Process Table Map panels. The names of the sourceand destination tables are specified in the Table Map.

4.3.5 Validation

By default, when a source table is specified or you enter a sourcevalue for a destination column, MOVE validates the source columndata to ensure that it can be stored in the destination column. Thesevalidations include:

Character Data

Character data can be converted to any character data type. It canalso be converted to numeric data provided the source value is a validnumeric value and fits the destination column.

The character data is padded or truncated on the right as needed to fitthe destination column.

Description

AvailableCommands

Changing TableNames

Compatible DataTypes

Page 250: Move for DB2 User Guide

4. Definitions

236 Move for DB2

Numeric Data

Numeric data can be converted to another numeric data type and toany character data type.

Decimal positions for numeric data are truncated if necessary.

If significant positions for numeric data would be truncated by thetransformation, the transformation is not performed and a conversionerror results.

A character data type must be defined with a minimum length of five,CH(5), when converting single or double floating point data types.

Special Registers

The DB2 special registers, CURRENT TIME or CURRENT_TIME,CURRENT DATE or CURRENT_DATE, CURRENTTIMESTAMP or CURRENT_TIMESTAMP, CURRENT SQLID orCURRENT_SQLID, and USER are supported. (CURRENT_TIME,CURRENT_DATE, CURRENT_TIMESTAMP are supported onlywhen DB2 release 4.1 or greater is used.)

The MOVE-specific special register, CURRENT TSOID, is alsoavailable. This special register contains the TSO ID of the current user.

All date, time, and timestamp data types cannot be converted to anycharacter or numeric data types. Conversely, character and numeric datatypes cannot be converted to date, time, and timestamp data types.

A timestamp data type can be converted to time or date and theextraneous portion of the timestamp is dropped.

A date data type can be converted to a timestamp. The appropriateportion of the timestamp is filled in with the date; the remainingportion is filled in with zeros.

A time data type can be converted to a timestamp. The appropriateportion of the timestamp is filled in with the time. The date portion isfilled in at execution with the current date.

As noted previously, you can define the destination columns by usingone or more source tables as prototypes. When you do this, it may beundesirable to have validation enabled.

You can toggle between validating and not validating using theVALIDATIONS command. To disable automatic validation, enter:

VAL OFF

DisablingValidation

Page 251: Move for DB2 User Guide

4.3 Column Maps

User Manual 237

If validation is performed, the exact match columns are identified bythe EQUAL status. If validation is not performed, the MAPPEDstatus is assigned.

The validation status is displayed on the right-hand side of the panelabove the column count.

4.3.6 Managing the Column Display

Facilities are available to help you manage the list of columns whilespecifying source values.

When the list of destination columns is extensive, you can focus onthose columns that have not been mapped using the SHOW command.By default, all destination columns are displayed. You can requestthat all destination columns having a specific status are to bedisplayed.

For example, to display all destination columns that have theNOTUSED status, enter:

SHOW NOTUSED

The following panel is displayed.

-- Define Column Map: COHEND.TESTORDS --------------------------------------COMMAND ===> SCROLL ===> CSR

Corresponding Columns MUST Have Compatible Data TypesUse LIST UNUSED Command for List of Unused Source ColumnsUse LIST ALL Command for List of All Source Columns VAL ON MOVE 1 OF 4 -----PSTDEMO.ORDERS--------- -------------SOFTECH.ORDERS---------------Cmd Source Column Data Type Num Destination Column Data Type Status--- ----------------- ---------- --- ------------------ --------- ---------*** ************************************ TOP ********************************___ 2 CUST_ID CH(5) NOTUSED___ 3 ORDER_DATE DATE NOTUSED___ 4 ORDER_TIME TIME NOTUSED___ 7 ORDER_POSTED_DATE TIMESTAMP NOTUSED*** ********************************** BOTTOM *******************************

Figure 135. Display Unmapped Columns

You can redisplay all of the destination columns using SHOW orSHOW ALL.

You can use the LIST command to display a list of source columns.LIST ALL provides a list of all of the columns in the source table;LIST UNUSED provides a list of source columns that have not beenmatched to a destination column. With either display, you specify the

SHOW Command

LIST Command

Page 252: Move for DB2 User Guide

4. Definitions

238 Move for DB2

assigned destination column number in the Num field to match thesource to the destination.

For example, assume the Define Column Map panel is displayed andyou want to map the unmapped destination columns. The SHOWNOTUSED command is used to display the destination columns withthe NOTUSED status and then the LIST UNUSED command isentered. A list of source columns that have not been mapped isdisplayed. The data type of the source columns is also displayed toassist in selecting compatible columns for matching.

-- Define Column Map: COHEND.TESTORDS -------------------------------------COMMAND ===> SCROLL ===> CSR

Corresponding Columns MUST Have Compatible Data TypesUse LIST UNUSED Command for List of Unused Source ColumnsUse LIST ALL Command for List of All Source Columns VAL ON MOVE+------- Unused Columns -------+ 1 OF 4| | ------------SOFTECH.ORDERS---------------|Select Items by Matching 'Num'| Num Destination Column Data Type Status| | --- ------------------- --------- -------|Cmd Column Name Data Type| *** TOP **********************************|--- ---------------- ---------| 2 CUST_ID CH(5) NOTUSED|*** *********** TOP **********| 3 ORDER_DATE DATE NOTUSED|2__ CUSTOMER_ID CH(6) | 4 ORDER_TIME TIME NOTUSED|___ TOTAL_ORD DEC(7,2) | 7 ORDER_POSTED_DATE TIMESTAMP NOTUSED|7__ LAST_ORD_DATE DATE | BOTTOM **********************************|___ FREIGHT DEC(4,2) ||___ CUST_ORD_ZIP CH(5) |+------------------------------+

Figure 136. Matching Unused Source Columns

As shown in Figure 136. Matching Unused Source Columns,columns are mapped to a destination column by typing the numberfrom the Num field assigned to the destination column in the Cmdfield of the source column list. The first source column,CUSTOMER_ID, is mapped to the destination column, 2 CUST_ID;the third source column, LAST_ORD_DATE, is mapped to thedestination column, 7 ORDER_POSTED_DATE; the second sourcecolumn, TOTAL_ORD, and the last two source columns are notmapped.

The list of source columns can be scrolled using the commands UP,DOWN, TOP, and BOTTOM or the PF keys assigned thesefunctions.

When you have completed using the selection list to match the columns,use END to remove the Unused Column List and return to the DefineColumn Map panel. MOVE checks the mapping you have selected. Ifvalidation is performed, EQUAL is displayed for all mappings ofmatching data types, MAPPED for all other mappings, and *ERROR*for any invalid mapping. If validation is not performed, the statusMAPPED is displayed for all valid mappings.

Example of LISTUNUSED

END List

Page 253: Move for DB2 User Guide

4.3 Column Maps

User Manual 239

In the following figure, assume that SHOW ALL has also beenentered after the LIST UNUSED command to redisplay all of thedestination columns and the specified source columns.

-- Define Column Map: COHEND.TESTORDS ---------------------------------------COMMAND ===> SCROLL ===> CSR

Corresponding Columns MUST Have Compatible Data TypesUse LIST UNUSED Command for List of Unused Source ColumnsUse LIST ALL Command for List of All Source Columns VAL ON MOVE 1 OF 8 -----PSTDEMO.ORDERS-------- ------------SOFTECH.ORDERS-----------------Cmd Source Column Data Type Num Destination Column Data Type Status--- ----------------- ---------- --- ------------------ --------- ----------*** ************************************ TOP ********************************___ ORD_ID CH(5) 1 ORD_ID CH(5) EQUAL___ CUSTOMER_ID CH(6) 2 CUST_ID CH(5) MAPPED___ CURRENT DATE 3 ORDER_DATE DATE SPC_REG___ 4 ORDER_TIME TIME NOTUSED___ EXIT CHEKFRGT 5 FREIGHT_CHARGES DEC(4,2) EXIT___ ORDER_SALESMAN 6 ORDER_SALESMAN CH(6) EQUAL___ LAST_ORD_DATE DATE 7 ORDER_POSTED_DATE TIMESTAMP MAPPED___ ORDER_SHIP_DATE CH(8) 8 ORDER_SHIP_DATE CH(*) EQUAL*** ********************************** BOTTOM *******************************

Figure 137. Define a Column Map - Return from LIST

4.3.7 Specifying Source for Destination Columns

In addition to the automatic mapping of columns from source todestination, you can explicitly specify the source value in the SourceColumn field for each destination column using one of the followingmethods:

• Leave the field blank.

• Type a value such as a column name, literal, constant, orexpression.

• Specify a site-defined exit routine to establish the value.

Type the Value

You can type any of the following:

• The column name. Column names that you supply need not have thesame name or data type. A value bound by the escape characterspecified with the DB2 installation options is assumed to be a columnname. The mapped columns are identified with the status MAPPED.MOVE automatically supplies the source column data type and theappropriate status for the destination column.

Page 254: Move for DB2 User Guide

4. Definitions

240 Move for DB2

• A literal value. Literals, except numerics, must be bound by thecharacter designated as the SQL string delimiter in the DB2installation options. The data type for literals is blank and the statusis LITERAL.

• NULL or one of the special registers. The special registers are:CURRENT TIME or CURRENT_TIME, CURRENT DATE orCURRENT_DATE, CURRENT TIMESTAMP orCURRENT_TIMESTAMP, CURRENT SQLID orCURRENT_SQLID, CURRENT TSOID or CURRENT_TSOID,and USER.

• A function.

• An arithmetic expression.

• An exit routine.

Functions

There are several functions provided with MOVE to manipulate thedata from the source prior to inserting it into the destination. Thesefunctions and their syntax are documented in the following text.

Aging Dates

Two functions are provided to age dates: AGE and FUTURE_YEAR.The aging parameters specified for AGE are more robust and flexible,than the parameters for FUTURE_YEAR. However, FUTURE_YEARis supported so that Column Maps written using MOVE release 2.5 areavailable for release 3.0. If a Column Map is edited using release 3.0, itis no longer available for use with release 2.5.

It is recommended that you take advantage of the functionalityprovided with AGE rather than FUTURE_YEAR when defining newColumn Maps. FUTURE_YEAR is limited to aging the year portionof DATE and TIMESTAMP columns; whereas AGE:

• Processes any character, numeric, DATE, or TIMESTAMP column.

• Ages to an explicit date or by explicit or relative values.

• Increments or decrements by days, weeks, months, years, or acombination of these units. Also, you can specify aging by anumber of business units (e.g., payday, quarters, etc.).

• Includes parameters to automatically adjust aged data to complywith business rules.

Page 255: Move for DB2 User Guide

4.3 Column Maps

User Manual 241

When the Column Map is used by an Insert, Update/Insert, Load orConvert Process, you are given the opportunity to specify:

• Default values to be used for source columns defined with AGE forwhich you have not specified all required values. For example, youcan use one Column Map for multiple processes and specify uniqueaging amounts or business rules for each without modifying the AGEfunction parameters on the Column Map.

• Aging values for all DATE and TIMESTAMP columns notexplicitly defined.

• Aging values for all source columns defined withFUTURE_YEAR(DEF).

• Whether aging is performed for an individual process.

Ages dates based on a variety of parameters. To specify agingparameters to age dates prior to inserting them at the destination, usethe AGE line command. This invokes the Aging Specificationsprompts. The values you specify for these prompts are evaluated byMOVE and used to generate the AGE function and its parameters.Assume AGE was specified for the ORDER_SHIP_DATE column.Some values for Aging Specifications prompts for the column areincluded in the following figure:

.------------------ Aging Specifications -----------------. | Command ===> | | | | Source Column ===> ORDER_SHIP_DATE | | Destination Column : ORDER_SHIP_DATE | | | | Input Date Format ===> MM/DD/YY | | Output Date Format ===> | | Aging Rule ===> | | Rule Table ===> | | Pivot Year ===> 65 (00 – 99) | | | | Specify Explicit Date or Aging Amount | | Explicit Date ===> YYYY/MM/DD | | | | Aging Amount | | Years ===> (-2500 to +1581) | | Months ===> (-30000 to +30000) | | Days ===> (-30000 to +30000) | | Weeks ===> (-99999 to +99999) | | Business Rules ===> (0 to 30000) | | | | Propagate Aging ===> (Y-Yes, N-No) | '---------------------------------------------------------'

Figure 138. Aging Specifications

Note that the date format defines a two-digit year, so the pivot year isincluded to determine the century. An output data format is not specifiedin the figure, but you could specify a different format such as“MMDDYYYY” to adjust the input to a four-digit year output.

AGE

Page 256: Move for DB2 User Guide

4. Definitions

242 Move for DB2

The other values, such as aging values and rules, are not specified.These values are to be supplied for each process when the ColumnMap is used.

The following fields are provided on this prompt:

Source Column Name of the source column to age.

DestinationColumn

Name of the destination column. This cannot bemodified.

Input DateFormat

Date format. This value can be specified using oneof the distributed date formats or one of the formatsthat have been defined by the site. The format mustbe valid for the column length and type.

Use an asterisk to display a selection list of formatsvalid for the column. Use the S line command toselect a format from the list.

This is required. (For more information aboutspecifying the format, see Appendix H. DateFormats.)

Output DateFormat

Date format for the aged data. This value can bespecified using one of the distributed date formatsor one of the formats that have been defined by thesite. The format length must match the input formatlength.

Use an asterisk to display a selection list of formatsvalid for the column. Use the S line command toselect a format from the list.

If not specified, the Input Data Format is used.(For more information about specifying the format,see Appendix H. Date Formats.)

Aging Rule Name of the default aging rule to use. An agingrule is required only when aging by business unitsor if a rule table is specified.

Use an asterisk to display a selection list of rules inthe current rule table. Use the S line command toselect a rule from the list. If an aging rule is not specified for the field, theaging rule specified for the process is used.

Specify NONE to perform linear aging on the field.An aging rule is not applied.

Panel Fields

Page 257: Move for DB2 User Guide

4.3 Column Maps

User Manual 243

Rule Table Name of the rule table containing the specifiedaging rule. If not specified, the default rule table isused.

Pivot Year Year used to determine whether a two-digit yearvalue is handled as occurring in the 20th century(1900) or the 21st century (2000). If the year isgreater than or equal to the pivot year, 1900 is used.If not specified, the pivot year defined for theprocess is used.

Explicit Date Specify an explicit date that is to be used. Thespecified aging rule is applied to this date. The datemust be in the form YYYY/MM/DD orYYYY/DDD (a Julian date).

Years Specify the number of years to increment ordecrement the date as a value in the range -2500 to+1581.

Months Specify the number of months to increment ordecrement the date as a value in the range -30000 to+30000.

Days Specify the number of days to increment ordecrement the date as a value in the range -99999 to+99999.

Weeks Specify the number of weeks to increment ordecrement the date as a value in the range -30000 to+30000.

Business Rules Specify the number of occurrences of a businessrule to adjust the date as a value in the range 0 to30000. If you specify a value for Business Rules,you must specify an Aging Rule.

For example, if NEXTPAYDAY is the Aging Rule,the value in this field is used to adjust the date bythat number of paydays. Therefore, 4 in the field,adjusts the date to the fourth payday after thecolumn’s current date value. (The date to beadjusted is NOT included in the calculation.)

You can specify either a value for Business Rulesor values for calendar units (years, months, weeks,or days), but not both.

Aging Amount

Page 258: Move for DB2 User Guide

4. Definitions

244 Move for DB2

PropagateAging

Specify whether the resulting age value ispropagated. If you elect to propagate the value,“PROP” is displayed in the Data Type field of thesource column. (For information aboutpropagation, see the information on page 246 aboutthe PROP function.)

Note that the combined values for Years, Months, Days, and Weekscannot result in an aging amount for Years greater than 1581. Anerror will result when the aging is attempted.

You can direct MOVE to age values in DATE and TIMESTAMPcolumns using the global specifications for the processor. However,if you want to age specific DATE and TIMESTAMP columnsexclusively, age the columns to unique values, or use an exit, specifythe AGE function for the column. These DB2-defined data typesmust have the format “DB2DATE”.

DATE and TIMESTAMP columns defined as nullable are “skipped”if they contain NULL. That is, these columns are not aged, and areincluded in the reported count of skipped columns. These skippedcolumns are handled the same as the other skipped values accordingto the process specifications.

After you define values for the AGE function on the AgingSpecifications panel, use END to return to the Column Map editor.The AGE function is identified by the string “AGE(column)” wherecolumn is the name of the source column to be aged. You can modifythese values using the AGE line command again to redisplay theAging Specifications panel. However, you must use the CLR linecommand to delete the entire AGE function specification or the SRCline command to replace the AGE function with the source column.

The specifications in the Column Map are combined with thespecifications for an individual request on the Aging Parameters panel.For more information about specifying values for an individual processsee Age Date Values on page 340.

Increments or decrements the year portion of the date in a DATE orTIMESTAMP column.

FUTURE_YEAR(value,column-name) Returns an explicit date value or the result of

incrementing or decrementing a date value. Thedata type of both the source and destinationcolumns must be DATE or TIMESTAMP.

DATE andTIMESTAMPcolumns

AGESpecificationsComplete

FUTURE_YEAR

Page 259: Move for DB2 User Guide

4.3 Column Maps

User Manual 245

value is specified as one of the following:

⇒ A four digit year

⇒ A one to three digit value preceded by a plusor minus sign to increment or decrement theyear value. Since incrementing is the default,the plus sign is optional.

⇒ The keyword DEFAULT (abbreviated toDEF). In this case, the date is modified whenthe process is executed only if values arespecified on the Aging Parameters panelbefore an Insert, Convert or Load Process.

column-name specifies the source columncontaining the value that is the subject of thefunction. The resulting date value is inserted intothe year portion of the data prior to inserting thedata into the destination column.

The column-name parameter is required only ifthere is no source column that matches thedestination column in both name and data type.

The underscore in the function name is optional.

The following examples illustrate this function.

FUTURE_YEAR(2000) Force 2000 in the year portion of the value in the

matching source column before inserting the data atthe destination.

FUTURE_YEAR(+10,ORD_DATE) Increment the date in the source column,

ORD_DATE, by 10 years before inserting the data atthe destination.

FUTURE_YEAR(DEF) Modify the date in the source column by the values

specified on the Aging Parameters panel beforeinserting the data at the destination.

The DEFAULT parameter is most frequently usedwhen there are several date columns you want tomodify in the same way or to modify a set of datecolumns differently for different processes. Forexample, using the same Extract File you can add 10years to the dates for one process and not modify the

Page 260: Move for DB2 User Guide

4. Definitions

246 Move for DB2

date for others. To provide this function, specifyFUTURE_YEAR(DEF) for all of the date columnsinvolved and specify the desired modification on theSpecify Aging Parameters panel available for Insertand Load Processes. The values on the SpecifyAging Parameters panel can be changed for everyexecution of an Insert, Load Process, and ConvertProcess.

If you specify an explicit year for the aging value onthe Specify Aging Parameters panel, only the yearportion is applied. If you specify values to ageincrementally or semantically, the column is ignored.

For additional information about the individual processes, seeSection 5.4 Insert Process, Section 5.5 DB2 Load Processand Section 5.8 Convert Process.

Propagating Primary Key Values

The PROP function is used to propagate values in the primary key orthe foreign key to all related tables. This is especially useful forgenerating multiple sets of related data. You specify the value for thesource column in the Column Map and MOVE automaticallypropagates the value.

PROP(value,column-name) Assigns a value to a column and propagates that value to

all related tables.

value is specified as one of the following:

⇒ A literal.

⇒ An expression such as a function or functionconcatenated with a literal, etc.

⇒ A special register.

⇒ An exit routine.

column-name specifies the source column containing thevalue that is the subject of the function. The resultingvalue is inserted into the destination column of the mappedtable and the appropriate destination column in theparticipating related tables.

The column-name parameter is required if there is nosource column that matches the destination column in bothname and data type. It is also required when value is a

Page 261: Move for DB2 User Guide

4.3 Column Maps

User Manual 247

concatenated expression.

The following examples illustrate this function.

PROP(‘SMITH’) Propagate a literal value in the mapped destination

column and the destination columns of the relatedtables.

PROP(SEQ(10000,99999)) Generate a sequential number between 10000 and

99999 and propagate that number in the mappeddestination column and the destination columns of therelated tables.

PROP(SEQ(10000,99999),CUST_NUMBER) Generate a sequential number between 10000 and

99999 in the named destination column and propagatethat number in the destination columns of the relatedtables.

PROP(EXIT CHEKCUST) Call an exit routine to establish the value for the

destination column and propagate that number in thedestination columns of the related tables.

When using PROP note the following:

• PROP can be specified only for a primary key or foreign key column.

• If PROP is specified, there must be at least one related tableincluded in the process.

• You can specify PROP for either the primary key or the foreign keycolumn. However, you cannot specify PROP for both. Also, if youspecify PROP for one, you must specify the source column name asthe source for the other. You cannot specify some other value.

• When PROP is specified on the foreign key column and the valueyou specify includes a column name, that name must participate inthe relationship and be common to the parent and child tables.Although expressions are valid, any other column names are not.

• If you want to use an exit routine, the PROP function must bespecified for the column in the table for which the exit routine iswritten. MOVE does not call the exit routine prior to propagatingthe related column in another table.

• PROP is available only to relationships defined by a primary key andforeign key pairing. Extended relationships are not supported.

Page 262: Move for DB2 User Guide

4. Definitions

248 Move for DB2

• Since it is impossible to evaluate the impact of the specificationsfor PROP until they are applied, conflicting specifications are notidentified until the process is executed. (The Control Filecontains the messages when errors are encountered.)

• A Column Map that contains the PROP function can only be usedwith release 3.0 or greater of MOVE.

• For the Insert and Load Processes, if the propagated primary keyvalue duplicates an existing value, the row is discarded. MOVEthen discards the rows from related tables whose foreign keycontains the propagated value. (The grandchildren, great-grandchildren, and so on are also discarded.) This feature ensuresthat “foster” child rows are not inadvertently inserted.

For the Update Process, the row is updated. MOVE then insertsor updates appropriately the rows from related tables whoseforeign key contains the propagated value.

• You can apply the PROP function to a source column definedwith an AGE function. A prompt on the Aging Specificationspanel determines whether the value is propagated. If you elect topropagate an aged column, the Data Type of the source columnis listed as PROP.

Before executing an Insert, Load, or Convert Process, you can displaythe various sets of propagation specifications that are mapped in theColumn Maps used in the process. You can use the OUTPUTcommand when that panel is displayed to print a report on thespecifications. For details on the prompt and the panel that displaysthis information, see the text pertaining to performing the specificprocess.

Functions to Manipulate Values

Other functions are provided for manipulating values. These include:SUBSTR, RAND, and SEQ.

SUBSTR(column-name, start, length) Returns a substring of the contents of the named column.

start specifies the position of the first character and lengthdetermines the number of characters that are extracted. column-name must refer to a non-numeric column. (Validnon-numeric columns include character, date, time, andtimestamp data type columns.) start and length must be integers with a value greater thanor equal to 1. The start must point to a position within the

Page 263: Move for DB2 User Guide

4.3 Column Maps

User Manual 249

string. The combined start and length values cannot exceedthe length attribute of the column. Only a column-name and a start value are required.Therefore, if only one integer is specified, it is used as thestart and the substring consists of the data beginning withthe start and through to and including the last character.

RAND(low, high) Returns a random number within the range specified by the

values for low and high. Valid low and high values are documented below.

SEQ(start, step) Returns a number that has been incremented sequentially by

the step value based on the start value. Valid start and step values are documented below.If the SEQ value exceeds 2147483648, it is automaticallyreset to the starting value.

The range of valid values for low, high, start and step varies based onthe data type:

Character -2147483648 2147483647 Integer -2147483648 2147483647 Small integer -32768 32767 Floating point -2147483648 2147483647 Decimal maximum number of significant digits to the

left of the decimal

To clarify decimal data types, assume a column is defined asDEC(6.2), the maximum number of significant digits to the left ofthe decimal is 4 because two digits are specified to the right.Therefore, the range for low and high or start and step for thiscolumn is -9999 through 9999 inclusive.

The special registers CURRENT DATE or CURRENT_DATE,CURRENT TIME or CURRENT_TIME, and CURRENTTIMESTAMP or CURRENT_TIMESTAMP cannot beexpressed by functions.

• An expression. Any of these values can be concatenated tospecify an expression except for the special registers CURRENTDATE or CURRENT_DATE, CURRENT TIME orCURRENT_TIME, and CURRENT TIMESTAMP orCURRENT_TIMESTAMP. Use the CONCAT keyword or twovertical bars, ||, to indicate concatenation.

Values forParameters

Page 264: Move for DB2 User Guide

4. Definitions

250 Move for DB2

For example, you can concatenate a literal value, ‘PST’, with afunction, SUBSTR, using either operator:

‘PST’ CONCAT SUBSTR(ORD_ID,1,3)

‘PST’ || SUBSTR(ORD_ID,1,3)

Since the expression is validated at run-time, the source data typeis blank and the status is EXPR. If an expression is invalid andcannot be evaluated, any affected row is discarded and marked asa conversion error.

When RAND or SEQ are in a concatenated expression, aVARCHAR string is returned.

Arithmetic Calculations

Arithmetic calculations can be specified for any numeric column.This includes decimal, integer, small integer, and float data types. Tospecify an arithmetic calculation, use the following syntax:

value operand value

value can be a source column name or a numeric constant.Note that:

• One of the values must be a column name.

• Zero (0) may not be specified as a value.

• If NULL is specified as one of the values, NULL isinserted in the destination column.

operand can be one of the following:

+-*/

Additionsubtractionmultiplicationdivision

A Column Map that contains arithmetic calculations can only be usedwith release 3.0 or greater of MOVE.

The following are examples of arithmetic calculations that can bespecified as the source value in a Column Map:

FREIGHT_CHARGES + 2.00ON_HAND_INVENTORY - 15UNIT_PRICE * 1.1TOTAL_COST / UNIT_PRICE

Page 265: Move for DB2 User Guide

4.3 Column Maps

User Manual 251

When specifying arithmetic calculations, the following errorconditions can only be detected at runtime:

• Overflow

• Null value in a non-nullable column

• Length of field too large to participate in computation

These errors are reported in the Control File.

Exit Routines

You can use site-defined exit routines to derive a value for anyindividual destination column. This is useful to handle specialprocessing, data manipulation, and literals that exceed the length ofthe Source Column field.

Specify the keyword EXIT followed by a space and the 1- to 8-character name of the exit routine in the Source Column field. AfterENTER is pressed, the status EXIT is displayed for the destinationcolumn. The existence of the exit routine is not verified at this time.Verification occurs when a MOVE Insert Process, Load Process, orConvert Process is performed.

For example, to specify the exit routine CHEKFRGT as the source,type the following in the Source Column field of the desireddestination column:

EXIT CHEKFRGT

See Figure 137. Define a Column Map - Return from LIST onpage 239 for an example of this. For information on defining exitroutines, see Appendix C. Exit Routines for Column Maps.

If the length of the value you want to specify exceeds the spaceavailable, use the EXPAND command to display a 75-character field.Type EXPAND in the command area, position the cursor in thedesired Source Column field, and press ENTER. Alternatively, youcan specify the destination column name or number with theEXPAND command. A comparable line command, EXP, is alsoavailable.

EXPANDCommand

Page 266: Move for DB2 User Guide

4. Definitions

252 Move for DB2

In the following figure, an expression is specified in the expandeddisplay for the column ORDER_SALESMAN. A value is created byconcatenating a random number greater than or equal to 100 and lessthan or equal to 999 with ‘PST’.

-- Define Column Map: COHEND.TESTORDS ---------------------------------------COMMAND ===> SCROLL ===> CSR

Corresponding Columns MUST Have Compatible Data TypesUse LIST UNUSED Command for List of Unused Source ColumnsUse LIST ALL Command for List of All Source Columns VAL ON MOVE 1 OF 7 -----PSTDEMO.ORDERS-------- ------------SOFTECH.ORDERS-----------------Cmd Source Column Data Type Num Destination Column Data Type Status

+- Dest: ORDER_SALESMAN ---Type: CH(6) --- Status: EXPR --------------------+| || 'PST' || RAND(100,999) |+---------------------------------------------------------------------------+

___ 5 FREIGHT_CHARGES DEC(4,2) NOTUSED___ 6 ORDER_SALESMAN CH(6) NOTUSED___ 7 ORDER_POSTED_DATE TIMESTAMP NOTUSED*** ********************************** BOTTOM ******************************

Figure 139. Expanded Source Column Field

During the expanded source column display, you can scroll to theprevious or next column using UP, DOWN, TOP, and BOTTOM.

Use END to return to the Define Column Map panel. If the length ofthe source specification exceeds 21 characters, the data is truncatedand protected. You can expand the source column again to respecifythe value as needed.

While editing the Column Map, you may want to remove one or moreof the Source Column specifications. You can use the CLEARprimary command to remove all of the source column specificationsor the CLR line command to remove the specifications for a singlesource column.

The CLR line command is especially useful for clearing the valuesthat have been specified on the expanded source column display or theAging Specifications panel. You can remove these specificationswithout invoking a pop-up. (For aging specifications, CLR orCLEAR is the only way to remove the AGE function.)

CLEAR Command

Page 267: Move for DB2 User Guide

4.3 Column Maps

User Manual 253

4.3.8 Completed Column Map

When you have completed defining the Column Map, use END. Thepanel from which the Define Column Map panel was invoked isredisplayed.

Use the SAVE command to save the modified Column Map under anew name. This enables you to model a new Column Map on anexisting one. A confirmation prompt is displayed.

Column Maps are used for the Insert Process and the Load Process todirect the data from a source table to a destination table. They areused by the Convert Process to convert the source data in an ExtractFile. You can specify the names of Column Maps when you specifythe source and destination tables for the process on the INSERTProcess Table Maps, the LOAD Process Table Maps, and theConvert Process Table Maps panels. Information on specifyingColumn Map names for the Insert Process is provided in Section 5.4Insert Process. Information for the DB2 Load Process and BMCLOADPLUS is provided in Section 5.5 DB2 Load Process.Information for the Convert Process is provided in Section 5.8Convert Process.

A Column Map can be used to map any pair of tables regardless ofthe Creator ID and table name. For example, a Column Map definedto map a table named PSTDEMO.CUSTOMERS to a table namedTEST.CUSTOMERS can also be used to map PROD.CUSTOMERSto QA.CUSTOMERS.

Using a ColumnMap

Page 268: Move for DB2 User Guide

4. Definitions

254 Move for DB2

4.4 Table Maps

A Table Map specifies the correlation of the source and destinationtables for the Insert, Insert/Update, Convert, Load processes. Thisoffers the opportunity to match unlike-named tables and to excludeone or more tables from the process.

From a Table Map, you can specify a Column Map for tables on theTable Map. (Column Maps enable you to map unlike namedcolumns, compatible columns, generate column data, and eliminateindividual columns from the process, as discussed in Section 4.3Column Maps.)

You can define Table Maps from a menu option or as a part of amigration process. For the most part, the steps for defining a TableMap are the same. However, a Table Map defined through the menuoption is always stored in the PST Directory and a Table Map definedfor a specific process may be defined for that process only or stored inthe PST Directory. This section focuses on defining through a menuoption. It mentions, where pertinent, the difference when defining aTable Map for MOVE or for Compare for DB2. Additionalinformation about Table Maps defined within a process is provided inthe discussion of each process.

4.4.1 Choosing a Table Map

To create or edit a Table Map through the Definitions option on theMain Menu select Option 4 TABLE MAPS on the Choose aDefinition Option submenu. The Choose a Table Map panel isdisplayed and prompts for the Map ID and Map Name.

------------------------- Choose a Table Map -------------------------Command ===>

Table Map: Map ID ===> Map Name ===>

Use '_' for DB2 LIKE character ===> N (Y-Yes, N-No)

Rules used to validate Table Map ===> M (M-Move, C-Compare)

Figure 140. Choose a Table Map

Page 269: Move for DB2 User Guide

4.4 Table Maps

User Manual 255

The fields on this panel are:

Map ID 1- to 8-character Map ID. DB2 LIKEsyntax can be used to display a selectionlist. If the field is blank or '%' is specified,a list of maps, as specified in the MapName field, for all Map IDs is displayed.

Map Name 1- to 12-character name of the Table Mapbeing defined or modified. DB2 LIKEsyntax can be used to display a selectionlist. If the field is blank or '%' is specified,a list of all maps for the specified Map IDis displayed.

Use '_' for DB2 LIKEcharacter

Specifies whether or not the underscore,'_', is to be used as a DB2 LIKE characteror used literally as part of the name.

For example, A_B could be assumed to bea three-character name containing thecharacters 'A_B' as entered or a three-character name that begins with 'A', endswith 'B', and has any valid character in themiddle. The default is No which meansthat '_' is not handled as a DB2 LIKEcharacter.

Rules used to validateTable Map

Specifies the rules for defining a TableMap. Specify:

M Rules for MOVE.

C Rules for Compare for DB2.

This prompt is only displayed whenCompare for DB2 is also installed.

Although Table Maps can be created and edited using MOVE orCompare for DB2, differences in the way each product uses TableMaps require a separate set of rules.

MOVE rules:

• Source Tables - Can be contained in an Extract File or specifiedin an Access Definition.

• Destination Tables – Must exist in DB2 or will be created beforeprocess can proceed.

Panel Fields

Rules forTable Maps

Page 270: Move for DB2 User Guide

4. Definitions

256 Move for DB2

• Column Maps - Full functionality including expressions, literals,constants, special registers, and exit routines to map the columns.

Compare for DB2 rules:

• Source 1 Tables - Can be contained in an Extract File orspecified in an Access Definition.

• Source 2 Tables - Can be contained in an Extract File, specifiedin an Access Definition, or must exist in DB2.

• Column Maps - Functionality is restricted to mapping unlikecolumn names, columns with compatible attributes, and excludingcolumns.

In spite of these differences, a Table Map can be used by eitherproduct if the definition adheres to the product rules. The sourcetable in a Table Map defined using MOVE corresponds to the Source1 Table in a Table Map defined using Compare for DB2. Similarly,the destination table corresponds to the Source 2 Table.

Specify the Map ID and Map Name to proceed. You can specify theMap ID and Map Name explicitly or choose from a selection list. Todisplay a selection list, leave one or both fields blank or use DB2LIKE syntax in one or both fields.

If explicit values are specified for the Map ID and Map Name fields:

• And the named Table Map exists, MOVE displays the Table Mapon the Modify Table Map panel.

• And the named Table Map does not exist, MOVE displays theSpecify Table Map Sources panel.

Use DB2 LIKE syntax or leave a field blank to request a selectionlist. MOVE displays a list of Table Maps on the Select Table Mapspanel. If there are no Table Maps that satisfy the selection listcriteria, a message is displayed on the Choose a Table Map panel.Respecify the DB2 LIKE syntax.

Specify Names

Explicit Names

Selection List

Page 271: Move for DB2 User Guide

4.4 Table Maps

User Manual 257

4.4.2 Selection List of Table Maps

The selection list is displayed as:

------------------------------- Select Table Map ----------------------------- Command ===> Scroll ===> CSR

Line Cmds: S-Select, D-Delete, C-Copy, R-Rename, AT-Attr, I-Info 1 of 7

----- Table Map ----- ------ Last Modified ------- Cmd Map ID Name By Date --- -------- ------------ -------- ------------------- ************************** TOP ****************************** ___ COHEND TMAP1 COHEND 1998-08-22 21.32.06 ___ DEBORAH TMAP1 KEBLERD 1998-08-22 21.32.06 ___ FEINP TEST FEINP 1998-06-28 13.55.56 ___ HOESCHD TBLMAP1 HOESCHD 1998-08-16 12.29.33 ___ MCGARRM C1 MCGARRM 1998-08-09 15.24.22 ___ TEST MAP1 NADELSS 1998-08-22 21.32.06 ___ TEST2 TMAP1 WRIGHTA 1998-08-22 21.32.06 ************************ BOTTOM *****************************

Figure 141. Select Table Map

The fields on this panel are:

Cmd Line command entry field. The possible line commands are:

S Select a Table Map.

D Delete a Table Map. After deleting, the message“*DELETED” is displayed in the Date field underthe Last Modified heading.

C Copy a Table Map to create a new one. The CopyTable Map panel prompts for the name of the newTable Map. After copying, the message“*COPIED” is displayed in the Date field under theLast Modified heading. (See page 259 for details.)

R Rename a Table Map. The Rename Table Mappanel prompts for the new name of the selectedTable Map. After renaming, the message“*RENAMED” is displayed in the Date field underthe Last Modified heading. (See page 259 fordetails.)

AT Modify attributes of a Table Map. The ObjectAttributes panel allows you to edit the descriptionand security status of the Table Map. (See page258 for details.)

I Display information about a Table Map.

Map ID 1- to 8-character Map ID that qualifies the Map Name.

Name 1- to 12-character name of the Table Map.

Panel Fields

Page 272: Move for DB2 User Guide

4. Definitions

258 Move for DB2

By TSO ID of the user that last modified the Table Map.

Date Date the Table Map was last modified.

A user option controls whether or not the description of each TableMap is displayed on this panel. (See Section 6.1 User Options forinformation about the Selection List Format option.)

To help in selecting a Table Map, use the I line command to displayinformation about a specific Table Map. The figure shows the TableMap Attributes panel.

----------------------- Table Map Attributes ----------------------- Command ===>

Map ID : COHEND Map Name : TMAP1

Description : Sample Table Map Security Status : PUBLIC

Last Modified By : COHEND Modified On : 2000-01-18 21.32.06

Source Creator ID : PSTCOMP Destination Creator ID : PSTDEMO

Source Type : Access Definition Extract File DSN : SOFTECH.COHEND.AD1 Destination Type : DB2 Tables

Figure 142. Table Map Attributes

This is a read-only display. MOVE generates and maintains all of theinformation on this panel based on your specifications for the TableMap.

When you are finished viewing the Table Map information, use ENDto return to the selection list.

To modify the description and security status attributes of a TableMap, type AT in the Cmd field next to the name of the Table Map todisplay the Object Attributes panel. The description and securitystatus are specified on the Object Attributes panel.

+-----------------------Object Attributes-----------------------+ ¦ ¦ ¦ Object Name: COHEND.TMAP1 ¦ ¦ ¦ ¦ Modify the attributes below as needed. ¦ ¦ ¦ ¦ Description ===> ¦ ¦ ¦ ¦ Security Status ===> PRIVATE (PUBLIC, PRIVATE, READONLY) ¦ ¦ ¦ ¦ Use END command to accept any changes and return. ¦ ¦ Use CANCEL command to ignore any changes and return. ¦ ¦ ¦ +---------------------------------------------------------------+

Figure 143. Object Attributes

Description

Table MapAttributes

Object Attributes

Page 273: Move for DB2 User Guide

4.4 Table Maps

User Manual 259

The Object Attributes panel provides a 40-character area to displayand edit the description. A User Option specifies whether descriptionand security status are displayed on Selection List. An 8-characterarea is available to specify one of the following security statuses:

PUBLIC Anyone can edit and use. PRIVATE Only owner can edit and use. READONLY Anyone can use, only owner can edit.

Based on installation options, site management can establish thatusers may not specify security status on this panel. In that case, theprompt for security status is replaced with “Not Active” on the panel.Any attempt to change the security status will result in an errormessage. For additional information about the Object Attributespanel see Specify Description and Security Status in Section 6.1User Options.

To copy a Table Map, type C in the Cmd field next to the name of thesource Table Map. The following figure shows the Copy Table Mappanel.

+----------Copy Table Map---------+ ¦ ¦ ¦ Existing Name: COHEND.TMAP1 ¦ ¦ ¦ ¦ New Name: ¦ ¦ ¦ ¦ MapID ===> COHEND ¦ ¦ Map Name ===> TMAP1 ¦ +---------------------------------+

Figure 144. Copy Table Map

The Copy Table Map panel displays the name of the original TableMap and prompts for a new two-part name.

To rename a Table Map, type R in the Cmd field next to the name ofthe Table Map. The following figure shows the Rename Table Mappanel.

+---------Rename Table Map--------+ ¦ ¦ ¦ Existing Name: COHEND.TMAP1 ¦ ¦ ¦ ¦ New Name: ¦ ¦ ¦ ¦ MapID ===> COHEND ¦ ¦ Map Name ===> TMAP1 ¦ +---------------------------------+

Figure 145. Rename Table Map

The Rename Table Map panel displays the current name of theTable Map and prompts for a new two-part name.

Copy a Table Map

Rename a TableMap

Page 274: Move for DB2 User Guide

4. Definitions

260 Move for DB2

On the selection list, use the D line command to delete a Table Map.Once a map has been deleted, the line command area for that entry isprotected. The entry is retained until the selection list is requestedagain or the REFRESH DIRECTORY primary command is used toupdate the Table Map selection list.

On the selection list, use the S line command or the SELECT primarycommand to select a Table Map to modify. If an existing Table Mapis selected, the Modify Table Map panel is displayed.

The SELECT primary command can be used to specify a Table Mapthat is not included on the selection list. For example, to select theTable Map named PSTDEMO.TESTMAP, enter:

SELECT PSTDEMO.TESTMAP

If the Table Map named on the SELECT primary command does notexist, MOVE assumes a new Table Map is to be created and theSpecify Table Map Source panel is displayed. After specifying thesources, the Define Table Map panel is displayed.

4.4.3 Specifying Table Map Sources

The Specify Table Map Source panel prompts you to specify thesource for the Table Map.

------------------------ Specify Table Map Source -------------------- COMMAND ===>

Specify where Source Table List will come from. Destination Tables can be any DB2 Tables.

Use Source Tables from an Extract File: DSN ===>

Or, Tables Specified in Access Definition GROUP ===> USER ===> NAME ===>

Figure 146. Specify Table Map Source

As shown on the panel, the possible types of sources are:

Extract File Specify the data set name of the Extract Filecontaining the list of source tables. You candisplay a selection list of existing Extract Filesby typing * as the last character in the DSNname.

Access Definition Specify the full name of the Access Definitioncontaining the list of source tables. The three-

Delete a TableMap

Select a TableMap

Page 275: Move for DB2 User Guide

4.4 Table Maps

User Manual 261

part name can be specified explicitly or DB2LIKE syntax can be used to obtain a selectionlist.

After you have specified the source, use END or ENTER to proceed.The Define Table Map panel is displayed.

Page 276: Move for DB2 User Guide

4. Definitions

262 Move for DB2

4.4.4 Defining Table Maps

The Define Table Map panel lists the corresponding tables from the sourceand destination under the appropriate headings. Each source table ismapped to the destination table that is displayed on the same line.

When this panel is displayed initially:

Source The CID field is contains the default Creator ID fromthe named source object (Extract File or AccessDefinition). The Table Name field is populated withthe table names from the source object. All fields areprotected.

Destination The CID field is blank and the Table Name fields arepopulated with the same names as the source. Allfields can be modified.

Assuming an Extract File is named for the source, the following panelis displayed:

-- Define Table Map: PSTDEMO.NEWMAP ------------------------------------------ Command ===> Scroll ===> CSR

Available Commands: APPLY, SAVE, LIST, MAP, POPULATE, END when Complete Destination May be any DB2 Tables or Views Column Src CID: PSTDENO Dest CID ===> Map ID ===>

Extract Tables Destination Table Name Type Column Map or "LOCAL" --------------------- ------------------------ --------- --------------------- ************************************* TOP ************************************ CUSTOMERS CUSTOMERS UNKNOWN DETAILS DETAILS UNKNOWN ITEMS ITEMS UNKNOWN ORDERS ORDERS UNKNOWN SHIP_TO SHIP_TO UNKNOWN *********************************** BOTTOM ***********************************

Figure 147. Define Table Map

The fields on this panel include:

Src CID The default Creator ID for the source tables as definedin the Extract File or Access Definition designated asthe source. This value cannot be modified.

Dest CID The default Creator ID for the destination tables. Avalid value must be specified.

ColumnMap ID

The default Creator ID for Column Maps. This fieldis only required when an unqualified Column Mapname is specified.

Initial Display

Panel Fields

Page 277: Move for DB2 User Guide

4.4 Table Maps

User Manual 263

Extract Tables The list of source tables in the Extract File or AccessDefinition designated as the source. These valuescannot be modified.

The fully qualified name is displayed only when theCreator ID differs from the Src CID.

DestinationTable Name

The list of destination tables. These values can bemodified.

If a destination Table Name field is blank, thecorresponding source table is not included in theprocess.

Type The type of the object named in the DestinationTable Name field. This value is not modifiable andautomatically supplied as one of the following:

TABLEVIEWUNKNOWNUNUSED

A-TABLEA-VIEWS-TABLES-VIEWNOT INS

A table.A view.Non-existent in destination. A destination table is not specified. An alias of a table. An alias of a view. A synonym of a table. A synonym of a view.A Temporary Table.

Column Map The name of the Column Map used for mapping thecolumns from source to destination for a specific pairof tables. Specify the Column Map names manually or request aselection list using the LIST MAPS command. If youleave the field blank, a Column Map is not used. You can use the POPULATE command to insert thename of the Column Map in this field. Section 4.4.5 Including Column Maps discusseshow to request the Column Map editor to create a newColumn Map or modify an existing one.

At any time during the session you can specify a description for theTable Map you are editing. Use the ATTRIBUTES command todisplay the Object Attributes panel. This panel provides a 40-character area to display and edit the description. (Site managementdetermines whether this panel also displays a prompt for Security

Description

Page 278: Move for DB2 User Guide

4. Definitions

264 Move for DB2

Status.) For additional information about the Object Attributespanel see Specify Description and Security Status in Section 6.1User Options.

The destination Creator ID and table names can be modified. Youcan overtype the name directly or select a table name from a selectionlist.

Use the LIST TABLES command to request a selection list of tablesthat have the current Destination CID. You can override the CreatorID by specifying one as an operand, as in LIST TABLES SMITH.%.The LIST command can also be used to display a selection list ofviews, aliases, and synonyms. The list will include the tables thatsatisfy the selection list criteria but are not already included asdestination tables on the Table Map.

The LIST command presents a list of the available tables, and assignsa number and a type to each source table on the Table Map. Youmap the tables by matching the assigned table numbers from the Numfield. The source Type field identifies UNUSED tables.

For example, if the destination Creator ID is 'SMITH', a selection listof tables with that Creator ID is displayed when LIST TABLES withno operands is entered.

-- Define Table Map: PSTDEMO.NEWMAP ------------------------------------------ Command ===> Scroll ===> CSR

Available Commands: APPLY, SAVE, LIST, MAP, POPULATE, END when Complete Destination May be any DB2 Tables or Views Column Src CID: PSTDEMO Dest C +---------------- DB2 Tables --------------+ Num Extract Tables Type | | CAL" --- ---------------- ------- | Select Items by Matching 'Num' | --- **************************** | | *** 1 CUSTOMERS TABLE | Num CreatorID.TableName 1 OF 5 | 2 DETAILS TABLE | --- --------------------------- | 3 ITEMS TABLE | ************* TOP ************* | 4 ORDERS TABLE | 1__ SMITH.XXCUSTOMERS | 5 SHIP_TO TABLE | 2__ SMITH.DETAILS | **************************** | 3__ SMITH.ITEMS | *** | 4__ SMITH.ORDERS | | 5__ SMITH.SHIP_TO | | *********** BOTTOM ************ | +------------------------------------------+

Figure 148. Listing Available Destination Tables

As shown in Figure 148. Listing Available Destination Tables, youmap the destination tables to their source counterparts by typing theassigned number from the Num field of the source table, into the Numfield of the appropriate destination table on the DB2 Tables list.

ModifyDestinationTable Names

LIST Command

LIST TABLES

Page 279: Move for DB2 User Guide

4.4 Table Maps

User Manual 265

The list of destination tables can be scrolled using the UP, DOWN,TOP, and BOTTOM commands, or the PF keys assigned thesefunctions.

When you have completed using the selection list to match the tables,use END to remove the DB2 Tables list and return to the Define TableMap panel. As shown in the following figure, MOVE automaticallypopulates the Destination Table Name fields with the selected tablenames. The Type field displays TABLE for the added tables.

-- Define Table Map: PSTDEMO.NEWMAP ------------------------------------------ Command ===> Scroll ===> CSR

Available Commands: APPLY, SAVE, LIST, MAP, POPULATE, END when Complete Source 2 May be any DB2 Tables or Views Column Src CID: PSTCOMP Dest CID ===> SMITH Map ID ===>

Source Table Name Destination Table Name Type Column Map or "LOCAL" --------------------- ------------------------- ------- ---------------------- ************************************* TOP ************************************ CUSTOMERS XXCUSTOMERS TABLE DETAILS DETAILS TABLE ITEMS ITEMS TABLE ORDERS ORDERS TABLE SHIP_TO SHIP_TO TABLE *********************************** BOTTOM ***********************************

Figure 149. Define Table Map - Return from LIST

The APPLY command overlays all or part of the displayed TableMap with the specifications from another Table Map. When thesource table names in the Table Map being applied match the sourcetable names in the currently displayed Table Map, the correspondingdestination table names and their respective Column Maps, if defined,will be copied to the destination fields of the displayed Table Map.

This is useful to build a Table Map that is a composite of existingTable Maps or to create a new Table Map modeled on an existingTable Map. For example, assume a site has a common pool of tablesthat are processed and they create a “master” Table Map establishingdefault table mapping for these tables. Then, users can apply thismaster Table Map for any process. Thus, even though one processinvolves one set of tables and another involves a set that includes onlysome of the first set, the same master Table Map can be applied toboth to obtain consistent mapping with a minimum of effort.

After “applying” a Table Map, the current Table Map can be editedas desired.

APPLY Command

Page 280: Move for DB2 User Guide

4. Definitions

266 Move for DB2

By default, the destination Creator ID and table name fields arecleared prior to applying the named Table Map. Operands on theAPPLY command are provided to:

• Add information from the applied Table Map only to the blankfields of the displayed Table Map.

• Apply table names only, Column Maps only, or both.

For example, to apply only the Column Maps from a Table Mapnamed SMITH.TMAP enter:

APPLY ADD COLMAPS SMITH.TMAP

A Column Map name from the Table Map SMITH.TMAP is insertedin blank Column Map fields when the source table from both TableMaps match. Non-relevant Column Maps defined in SMITH.TMAPare ignored. The Column Maps already named on the currentlydisplayed Table Map are retained.

You can display a selection list of Table Maps using DB2 LIKEsyntax with the APPLY command. For example, APPLY SMITH.%generates a selection list of all Table Maps that have the Map IDSMITH; APPLY %.TMAPS generates a selection list of Table Mapsnamed TMAPS for all Map IDs; and APPLY with no operandsgenerates a selection list of all available Table Maps.

MOVE automatically revises the Type each time you modify adestination table name. If you modify the Dest CID, any tables thatare specified without an explicit Creator ID automatically use the newDest CID. This may change the Type value and require review.

For example, assume the Dest CID is SOFTECH and theDestination Table Name is CUSTOMERS. The fully qualified tablename is SOFTECH.CUSTOMERS. However, when the Dest CID ischanged to COHEND, the table name is COHEND.CUSTOMERSand may be unknown. You can supply the Creator ID with theDestination Table Name. Then, changing the Dest CID does notaffect the table name.

After the Table Map is defined, it can be saved in the PST Directory.Once saved, the Table Map is available to other users.

There are two ways to save a Table Map:

• Use the END command to exit the Table Map editor. Themodifications to the Table Map are automatically saved.

Selection List forAPPLY

Destination TableType

Saving the Map

Page 281: Move for DB2 User Guide

4.4 Table Maps

User Manual 267

• Use the SAVE command. If a name is not specified, the currentTable Map is updated. Specify a new name to save a new TableMap.

By saving the current Table Map definition under a new name,you can use an existing Table Map as a prototype and retain theoriginal version.

When defining a Table Map as part of a process, you can save theTable Map by specifying a fully qualified name. If you do notexplicitly save the Table Map, it is not stored in the Directory and isonly available for the current process.

The following commands are available on this panel:

ATTRIBUTESAPPLY

END LIST

POPULATE SAVE

BOTTOM MAP TOP CANCELDOWN

OPTIONS UP

4.4.5 Including Column Maps

Column Maps are used to define how the source columns correspondto the destination when the default processing is inadequate. (Bydefault, columns with the same name and matching attributes aremapped.) Using Column Maps you can manipulate the data at thedestination as well as map unlike-named columns, columns withcompatible but not exactly matching data types, or eliminate columnsfrom the process.

To specify the name of the Column Map in the Column Map namefield on the Define Table Map panel, you can:

• Type the Column Map name directly. You can specify the nameof an existing Column Map or specify a new Column Map nameto create a new one. You can also specify LOCAL to create aColumn Map to be used only with the current Table Map.

• Use the LIST MAPS command to display a selection list ofexisting Column Maps.

• Use the POPULATE command to automatically insert ColumnMap names for Column Maps that exist for every pair of sourcetables.

AvailableCommands

Page 282: Move for DB2 User Guide

4. Definitions

268 Move for DB2

The Column Map ID field qualifies the Column Map name specified.When a fully qualified Column Map name is entered in the ColumnMap name field, the Column Map ID field is ignored.

The LIST MAPS command displays a selection list of Column Maps.Use DB2 LIKE syntax to specify the selection list criteria. If novalue is specified, the default is %.% indicating all Column Maps.

To use the LIST MAPS command, type the command, position thecursor on the line where you want to specify a Column Map name,and press ENTER. If only one Column Map exists, it isautomatically placed in the Column Map name field. If multipleColumn Maps are available, a selection list is displayed.

The following figure displays the Column Map selection list.

-- Define Table Map: PSTDEMO.NEWMAP ------------------------------------------ Command ===> Scroll ===> CSR

Available Commands: APPLY, SAVE, LIST, MAP, POPULATE, END when Complete Destination May be any DB2 Tables or Views Column Src CID: PSTDEMO Dest CID ===> PSTDEMO Map ID ===> PSTDEMO

Source T +------------------Select One Column Map-------------------+ OCAL" ----------- | Cmd MapID.MapName Source Destination 1 OF 4 | ----- *********** | --- --------------------------------------------- | ***** CUSTOMERS | ********************* TOP *********************** | DETAILS | ___ PSTDEMO.SUEN FULL MATCH FULL MATCH | ITEMS | ___ PSTDEMO.SUEN1 NO MATCH TABLE MATCH | ORDERS | ___ PSTDEMO.SUEN2 NO MATCH TABLE MATCH | SHIP_TO | ___ PSTDEMO.SUPER10 NO MATCH NO MATCH | *********** | ******************** BOTTOM ********************* | ***** +----------------------------------------------------------+

Figure 150. Select One Column Map

The complete Column Map name is provided along with notation thatspecifies how the tables used to create the Column Map match thetables listed on the Define Table Map panel. This is specified for thesource and destination tables separately as:

FULL MATCH The Creator ID and the table name from the table list onthe Define Table Map panel match those in the ColumnMap. In Figure 150. Select One Column Map, both thesource and the destination tables of the first ColumnMap match the source and destination tables on theDefine Table Map panel.

TABLE MATCH The Creator ID from the Define Table Map panel doesnot match the Creator ID in the Column Map, but thetable names do match. In Figure 129 the destinationtable of the second and third Column Maps match thedestination table on the Define Table Map panel, but the

Column Map ID

LIST MAPSCommand

Column MapSelection List

Page 283: Move for DB2 User Guide

4.4 Table Maps

User Manual 269

Creator ID is different.

NO MATCH The Creator ID and table name on the Define TableMap panel do not match those used to create the map.In Figure 129 the Creator ID and the table name of thesecond and third Column Maps do not match thosespecified for source on the Define Table Map panel.These maps are probably not viable candidates for use.

Use the Select line command, S, to select a Column Map and END orENTER to return to the Define Table Map panel. The name of theselected Column Map is inserted in the Column Map name field onthe line where the cursor had been positioned.

Use the POPULATE command to automatically insert Column Mapnames for each pair of source and destination tables specified on theDefine Table Map panel. The command begins with the first pair oftables and processes each pair of tables in turn until all are processed.The processing sequence is as follows:

1. MOVE checks the Column Maps for a full match. (ThoseColumn Maps are comprised of a pair of tables where the fullyqualified names exactly match the Creator ID and the table namesof the source and destination.) If only one is identified, that nameis inserted in the Column Map name field on the Define TableMap panel and processing continues with the next pair.

If there is more than one full match, a selection list of thoseColumn Maps is displayed. (The selection list of Column Mapsis similar to the one shown in Figure 150. Select One ColumnMap. The source and destination column of every Column Mapis listed as FULL MATCH.)

2. If there are no full matches, MOVE checks for table matches.(Those Column Maps are comprised of a pair of tables where thenames exactly match the table names of the source tables but donot match the Creator ID of either or both tables.) If only one isidentified, that name is inserted in the Column Map Name fieldon the Define Table Map panel and processing continues with thenext pair.

If there is more than one table match, a selection list is displayed.(The selection list of Column Maps is similar to the one shown inFigure 150. Select One Column Map. Either or both the sourceor the destination of every Column Map is listed as TABLEMATCH.)

3. If there are no Column Maps for a pair of source and destinationtables, processing continues with the next pair.

POPULATECommand

Page 284: Move for DB2 User Guide

4. Definitions

270 Move for DB2

Regardless of whether a Column Map name is inserted, whenPOPULATE processing for a specific pair is complete, the displayscrolls to the next pair of source and destination tables on the DefineTable Map list and processing begins for that pair. This is repeateduntil all are processed. When processing is complete, the list of tablesis redisplayed with the appropriate Column Map name fieldspopulated.

When a selection list is displayed by the POPULATE command,select the desired Column Map using the S line command and pressENTER or END. The name of the selected Column Map is insertedfor the current pair and processing continues with the next pair.

Use CANCEL to terminate POPULATE processing and return to theDefine Table Map panel. Any Column Map names that have beeninserted are retained.

You can limit the search for Column Maps performed by POPULATEusing DB2 LIKE syntax. For example, to populate the Table Map withColumn Map names having the Map ID COHEND, type:

POPULATE COHEND.%

To populate the Table Map with Column Map names that begin withINV and have the Map ID COHEND, type:

POPULATE COHEND.INV%

Operands are available on the POPULATE command to enable you tospecify whether or not existing Column Map names are replaced onthe panel and whether or not existing Column Map names are clearedprior to beginning the POPULATE command processing. You canalso specify that the POPULATE processing should only insert thoseColumn Maps whose fully qualified table names match those on theDefine Table Map panel. (See the Relational Tools CommandReference Manual for details.)

Naming conventions can be used to identify logical groups of ColumnMaps and to make best use of the POPULATE command. For example,Column Maps created to test data for the inventory system could all beprefixed with INV and the Map ID could identify individualprogrammers. Then, the POPULATE command, with a name operandusing DB2 LIKE syntax, can automatically identify and insert the desiredset of uniquely named Column Maps for all of the listed table pairs.

For example, assume five Column Maps have been defined for a pairof source and destination tables:

COHEND.CHGCUSTCOHEND.INVCUST

Selection Lists forPOPULATE

Using DB2 LIKESyntax withPOPULATE

POPULATEOperands

Consideration forNamingConventions

Page 285: Move for DB2 User Guide

4.4 Table Maps

User Manual 271

COHEND.TSTCUSTKEBLERD.INVCUSTNADELSS.INVCUST

Further, assume that the names of the tables defined in each of thesemaps are a FULL MATCH. By specifying the POPULATEcommand with no operand, a selection list containing these five tablesis displayed. However, by specifying POPULATE COHEND.INV%only the Column Map named COHEND.INVCUST is identified andautomatically inserted. This feature is especially useful when there isan extensive list of source tables on the Define Table Map panel andall of the desired Column Maps have been named following a specificconvention. MOVE automatically proceeds through the pairs of tablesand populates the Column Map name field.

The following figure shows a Table Map with Column Mapsspecified for three of the five tables listed.

-- Define Table Map: PSTDEMO.NEWMAP ------------------------------------------- Command ===> Scroll ===> CSR

Available Commands: APPLY, SAVE, LIST, MAP, POPULATE, END when Complete Destination May be any DB2 Tables or Views Column Src CID: PSTCOMP Dest CID ===> PSTDEMO Map ID ===> PSTDEMO

Source Table Name Destination Table Name Type Column Map or "LOCAL" --------------------- ----------------------- -------- ----------------------- ************************************* TOP ************************************ CUSTOMERS CUSTOMERS TABLE CUSMAP DETAILS DETAILS TABLE DETMAP ITEMS ITEMS TABLE ITMMAP ORDERS ORDERS UNKNOWN SHIP_TO SHIP_TO TABLE *********************************** BOTTOM ***********************************

Figure 151. Column Maps Specified

To create a new Column Map, specify a new name in the ColumnMap field and press ENTER. (If the name is not fully qualified, youmust enter a Map ID in the Column Map ID field.) A confirmationprompt is displayed. Use END to terminate the request or ENTER tocreate the Column Map. If you create the Column Map, the DefineColumn Map panel is displayed.

If you specify LOCAL as the Column Map name and one has notbeen previously defined for that pair of tables, MOVE assumes youare creating a new Column Map. (A Map ID is not required for a'local' Column Map.)

Use the MAP command to edit an existing Column Map. You canspecify the Column Map name with the command or position thecursor to the Column Map field. (It may be desirable to assign theMAP command to a function key.)

Table Map withColumn Maps

New Column Map

MAP Command

Page 286: Move for DB2 User Guide

4. Definitions

272 Move for DB2

MOVE compares the Column Map table names with the names on theDefine Table Map panel. If the table names and the column namesmatch, the selected Column Map is displayed on the Modify ColumnMap panel.

If there is a discrepancy, a confirmation prompt is displayed. Forexample assume that one or both tables in a selected Column Mapnamed PSTDEMO.TEST1 do not match the pair of tables on theTable Map, the following confirmation message is displayed:

-- Modify Table Map: PSTDEMO.NEWMAP ------------------------------------------- Command ===> Scroll ===> CSR

Available Commands: APPLY, SAVE, LIST, MAP, POPULATE, END when Complete Destination +----------Edit Column Map Confirmation---------+ Src CID: PS | | ===> PSTDEMO |Column Map PSTDEMO.TEST1 is defined with | Source Ta |tables that do not match specified pair of | Map or "LOCAL" ------------ |tables. | --------------- ************ |CHANGE TABLES command will be automatically | *************** CUSTOMERS |performed. | DETAILS |Press ENTER key to Proceed with Column Map Edit| ITEMS |Enter END Command to Return to Table Map | ORDERS +-----------------------------------------------+ SHIP_TO SHIP_TO TABLE *********************************** BOTTOM ***********************************

Figure 152. Edit Column Map Confirmation

Press ENTER to proceed with the edit; use END to abandon the edit.If you elect to proceed with the edit, MOVE automatically changesthe table names in the Column Map to those names on the DefineTable Map panel and displays the Modify Column Map panel.

If you are using an existing Column Map as a prototype, you canretain the original version of the Column Map. Use the SAVEcommand and specify a new Column Map name or LOCAL prior toreturning to the Define Table Map panel. MOVE inserts the newColumn Map name appropriately.

See Section 4.3 Column Maps for detailed information on definingColumn Maps. See the Relational Tools Command Reference Manualfor details on the LIST MAPS, POPULATE, MAP, and SAVEcommands.

When you have completed modifying the Column Map, use END toreturn to the Define Table Map panel.

Table Map Complete

When you have completed specifying the Table Map, use END toredisplay Choose a Definition Options panel.

SAVE Command

AdditionalInformation

Column MapComplete

Page 287: Move for DB2 User Guide

4.5 Export and Import Processes

User Manual 273

4.5 Export and Import Processes

The Export and Import Processes are provided to transport theRelational Tools object definitions from one DB2 subsystem toanother. The Relational Tools object definitions are stored in thePST Directory. Each subsystem has a unique PST Directory,therefore, the object definitions are available to only one subsystem.Many sites maintain several similar DB2 databases on differentsubsystems. (For example, sites may have similar but separatedatabases on different subsystems to support production and testingenvironments or to support multiple clients.) Using the Export andImport Processes, the PST Directory object definitions such as AccessDefinitions, Table Maps, Column Maps, primary keys, relationships,and Compare Definitions (Compare for DB2 only) can be transportedto other subsystems without the need to recreate them on each. Thissaves time and, more importantly, promotes consistent, reliable datahandling.

Although the Extract Process combined with the Create Process isavailable to migrate table definitions and related object definitions(primary keys and relationships regardless of whether defined in theDB2 Catalog or the PST Directory), these processes cannot be usedto migrate the objects unique to Relational Tools. The Export andImport Processes must be used to migrate Access Definitions, TableMaps, Column Maps, and Compare Definitions.

The PST Directory object definitions are migrated in two steps:

1. Export ProcessCopy the object definitions to a data set. This data set may beused repeatedly by the Import Process to copy the objectdefinitions to any number of PST Directories making thesedefinitions available to several subsystems. To execute theExport Process, select option E on the Choose a DefinitionOption panel.

Note that a single execution of this process copies objectdefinitions from the PST Directory for the current subsystemonly.

2. Import ProcessCopy the object definitions in the specified data set to the currentsubsystem. To execute the Import Process, select option I on theChoose a Definition Option panel.

Page 288: Move for DB2 User Guide

4. Definitions

274 Move for DB2

Note that this process adds the exported object definitions to thePST Directory for the current subsystem only.

Normally, you perform the Export Process to copy the object definitionsfrom the current subsystem to a data set. Then, you return to theRelational Tools Main Menu to switch to the receiving subsystem byrespecifying the DB2 subsystem at the SUBSYS prompt. Once you haveswitched the subsystem, you perform the Import Process to load theobject definitions from the data set.

When you export an object, the security status is included. However,security is only relevant within the database. For example, an AccessDefinition stored as PRIVATE can only be exported by the owner.The status is exported as PRIVATE, but any user can attempt toimport the object stored in the Export File. A user cannot import anyPRIVATE object to a subsystem in which it already resides, but canimport it to a different subsystem. Then, the object is assigned thePRIVATE status and the importing user is the owner.

4.5.1 Using the Export Process

When you select E on the Choose a Definition Option menu, thefollowing panel is displayed:

----------------------------- EXPORT Process ---------------------------Command ===>

Definition Type ===> (ALL - All Types, PK - Primary Keys, R - Relationships, CM - Column Maps, TM - Table Maps, AD - Access Definitions, CD - Compare Definitions)

Subordinate Definitions ===> NO (Y-Yes, N-No)

Output DSN ===>Disposition ===> (A-Append, R-Replace)

Enter Report File Name or Leave Blank For a Temporary File: Report DSN ===>

Prompt To Delete Exported Objects ===> NO (Y-Yes, N-No)

Figure 153. Export Process Panel

The fields on the panel are:

Definition Type Indicate the type of definition to process. Specify:

ALLPKRCM

All typesPrimary KeysRelationshipsColumn Maps

About ObjectSecurity

Panel Fields

Page 289: Move for DB2 User Guide

4.5 Export and Import Processes

User Manual 275

TMADCD

Table MapsAccess DefinitionsCompare Definitions (Only available whenCompare for DB2 is installed.)

Specify ALL to select all or specific objects fromeach type.

The definition type you specify may have subordinateobject definitions associated with it. The subordinateobject definitions are included based on your responseto the following prompt.

SubordinateDefinitions

Specify whether the subordinate definitions are to beexported. The subordinate object definitions for eachare as follows:

Object

Primary Keys

Relationships

Column Maps

Table Maps

Access Definitions

Compare Definitions

Subordinate Object

none

none

none

Column Maps

Relationships

Access DefinitionsRelationships

For example, if you specify AD as the type and YESto this prompt, the Access Definitions are copied andany relationships referenced in the Access Definitionare copied. If you specify CD, the CompareDefinitions are copied and the subordinate AccessDefinitions and relationships are copied. Anyadditional relationships subordinate to the AccessDefinitions are also copied.

Output DSN Specify the name of a sequential or partitioned dataset to contain the object definitions that are to beexported. You can specify the name of an existingdata set or request a selection list by specifying anasterisk as the last character of the name.

You can specify the name of a new data set. You willbe prompted for allocation information and the dataset will be allocated for you.

Page 290: Move for DB2 User Guide

4. Definitions

276 Move for DB2

Disposition Specify whether the definitions in the currentexecution are to replace or be appended to the currentcontents of the output data set.

APPEND is valid only when the Output DSN is asequential file.

Report DSN Specify the name of a sequential data set to containthe report resulting from the current Export Process.You can specify the name of an existing data set orrequest a selection list by specifying an asterisk as thelast character of the name.

You can specify the name of a new data set. You willbe prompted for allocation information and the dataset will be allocated for you.

If you do not specify a name, the report is written to atemporary file. Therefore, if you want to view thereport, you must use the REPORT command whenthe EXPORT Process Report panel is displayed.

Prompt To DeleteExported Objects

Specify whether the objects selected for the ExportProcess are to be deleted from the source PSTDirectory. Specify:

YN

Delete objectsDo not delete objects

The delete request is processed after the objects areexported. A panel prompts you to indicate whichobjects are to be deleted from the source PSTDirectory. You select the individual objects using theS line command.

Select the Objects for Export

After you have completed the EXPORT Process panel, you areprompted to select which definitions you want to export for eachdesignated type. If you specify a type such as AD or TM, anappropriate Choose panel is displayed. However, if you specify ALL,a prompt to choose specific object definitions is displayed for eachobject type.

Page 291: Move for DB2 User Guide

4.5 Export and Import Processes

User Manual 277

In the following figure, the prompt for Access Definitions isdisplayed.

------------------ Choose an Access Definition to EXPORT -------------Command ===>

ACCESS DEFINITION: GROUP ===> USER ===> NAME ===>

USE '_' FOR DB2 LIKE CHARACTER ===> NO (Y-Yes, N-No)

These commands are available when the Selection list is displayed: S - Select an Access Definition U - Unselect an Access Definition

Figure 154. Choose an Access Definition to Export

This panel is very similar to the panel displayed when Option 5 ADSis selected on the Main Menu and you are prompted for the name ofan Access Definition to edit. You can specify the name of an AccessDefinition by specifying the three-part name in the provided fields.Alternatively, you can request a selection list by leaving one or morefields blank or using DB2 LIKE syntax in one or more of the fields.You are also prompted to specify whether the underscore character isused for DB2 LIKE syntax.

Use ENTER to indicate that you are ready to continue. If an object isnot explicitly specified in the provided fields, a selection list isdisplayed. If a name is specified, the next panel is dependent onwhich Definition Type is specified on the EXPORT Process panel.If a specific type is specified, the Export Process is performed and theEXPORT Summary panel is displayed next. If ALL is specified, theChoose panel for the next object type is displayed.

When ALL is specified, you can bypass any of the object types byusing END to proceed to the next object type. When a specific type isspecified and END is used, the Export Process is not performed andthe EXPORT Process panel is redisplayed.

Page 292: Move for DB2 User Guide

4. Definitions

278 Move for DB2

Assume a selection list is requested by specifying the GROUP asCOHEND and the USER as COHEND on the Choose an AccessDefinition to EXPORT panel. The following selection list isdisplayed:

--------------Select Access Definitions to EXPORT-----------------------Command ===> Scroll ===> CSR

Use S to Select an Entry, U to Unselect an Entry 1 OF 6 Use the SELECT ALL Command to Select all Entries Use the END Command to Indicate that Selections are Complete

----- Access Definition ----- ------ Last Modified --------Cmd Status Group User Name By Date--- ------ -------- -------- ------------ -------- -------------------*** ************************* TOP ************************************___ SELECT COHEND COHEND CUSTOMER COHEND 1998-09-21 16.36.59___ SELECT COHEND COHEND DEMO1 COHEND 1998-10-15 12.15.22___ SELECT COHEND COHEND DEMO3 COHEND 1998-10-22 10.45.01___ SELECT COHEND COHEND DETLTEST COHEND 1998-09-09 09.52.55___ SELECT COHEND COHEND SAMPLE COHEND 1998-12-19 04.21.10___ SELECT COHEND COHEND SAMPLE2 COHEND 1998-12-26 10.44.10*** ************************ BOTTOM **********************************

Figure 155. Select Access Defintions to Export

The Access Definitions that satisfy the selection list criteria aredisplayed in alphabetical order. The user that last modified theAccess Definition and the date on which it was modified is alsodisplayed. The list can be scrolled.

The Status field to the left of the Access Definition indicates whetheran Access Definition has been selected. On initial display, the field isblankno Access Definitions are selected. You can select individualAccess Definitions using the Select line command, S. Conversely,you can unselect individual Access Definitions using the Unselect linecommand, U.

When many Access Definitions are listed and you want to select orunselect the majority of them, use the primary commands SELECTand UNSELECT. For example, assume 100 Access Definitions arelisted, use SELECT ALL to select all of them. Then, use the U linecommand to unselect specific definitions. Conversely, if all of theAccess Definitions have the SELECT status, use UNSELECT ALLto unselect all of the Access Definitions and the S line command toselect the few you want.

Use END to signal that your selections are complete. The resultingaction depends on the Definition Type specified on the EXPORTProcess panel:

• If you specified ALL and selected at least one object on theselection list, the Choose prompt for the next object type isdisplayed. (The order in which the panels for each type are

Selection List

Status field

Page 293: Move for DB2 User Guide

4.5 Export and Import Processes

User Manual 279

displayed is the same as the list of types on the EXPORTProcess panel.)

If you have not selected any objects for the current type, theChoose prompt for the current type is redisplayed. You canrespecify criteria for the selection list, specify the name of anobject, or use END again to indicate that none of the currentdefinition type are to be exported. If you specify END, theChoose prompt for the next object definition type is displayed.

If the Choose panel for the last definition type is displayed, theExport Process is invoked.

• If you specified a single Definition Type and selected at least oneobject from the list, the Export Process is invoked.

If you have not selected at least one object from the list, thechoose prompt is redisplayed. You can respecify criteria for theselection list, specify the name of an object, or use END withoutspecifying any objects. If you use END with no entries, theChoose a Definition Option menu is redisplayed and the ExportProcess is not executed.

The following primary commands are available when the selection listis displayed:

BOTTOMCANCELDOWNEND

FINDLOCATEOPTIONSRESET

RFINDSELECTSHOWSORT

TOPUNSELECTUP

Build the Output File

It may be desirable to export object definitions in several steps orfrom several subsystems to import to another subsystem. Forexample, you may want to copy one Compare Definition and all of thesubordinate objects and another Compare Definition and none of thesubordinate objects. As another example, you may want to use theAccess Definitions in one subsystem and supplement that with therelationships in a second and the Table Maps in a third. For eitherexample, you can export these objects to separate output files andthen execute the Import Process multiple times on each targetsubsystem. You could also export to a single output file by specifyingAPPEND to the Disposition prompt with each Export Processrequest. When the definitions are in a single output file, the ImportProcess can be executed once.

The Export Process copies the object definitions from the PSTDirectory for the current subsystem only. To build an output file

AvailableCommands

Page 294: Move for DB2 User Guide

4. Definitions

280 Move for DB2

containing object definitions from several subsystems, you mustswitch the current subsystem before each execution of the ExportProcess. (You can change the subsystem on the Definitions Menu.)

Export Summary

When the Export Process has completed, the Export Summary isdisplayed. The following is a sample Export Summary:

--------------------- EXPORT Summary ------------------------------Command ===>

Output File DSN: PSTDEMO.TEST2

Summary of Results

Primary Keys Processed : 0 Relationships Processed : 1 Column Maps Processed : 1 Table Maps Processed : 1 Access Definitions Processed : 6 Compare Definitions Processed: 1

Report File DSN: TEMPORARY

No error conditions were found

Enter REPORT Command to View the Report FilePress ENTER Key to Continue ProcessingEnter END Command to Exit

Figure 156. Export Summary

This report provides the following:

Output File DSN Name of the sequential or partitioned data setcontaining the exported object definitions.

Summary of Results A list of the object definitions and the totalnumber of each copied to the output file.

Report File DSN Name of the sequential data set containingthe results of the Export Process. This fieldcontains “Temporary” if a data set namewas not specified for the report.

This is followed by a message indicating whether any error conditionshave been encountered. If errors have been encountered, explanatorytext for each is provided in the report file.

When the EXPORT Summary panel is displayed, use ENTER toredisplay the EXPORT Process panel or END to return to theChoose a Definition Option menu.

Page 295: Move for DB2 User Guide

4.5 Export and Import Processes

User Manual 281

You can display the contents of the report file using the REPORTcommand. This command automatically invokes the ISPF browsefacility and displays the contents of the report.

The report lists the exported object definitions by category and thenames of each exported object. Any error messages are also includedin the report.

***************************** Top of Data************************* EXPORT Process Report Created on Wednesday, July 28, 1999 at 08:55 AM File: PSTDEMO.TEST2

PRIMARY KEY EXPORTED : PSTDEMO.CUSTOMERSRELATIONSHIP EXPORTED : PSTDEMO.ORDERS.CUSORDCOLUMN MAP EXPORTED : PSTDEMO.DEMOMAPTABLE MAP EXPORTED : PSTDEMO.TESTMAPACCESS DEFINITION EXPORTED : PSTDEMO.PSTSP.TEST1******************************** Bottom of Data******************

Figure 157. EXPORT Process Report

Use END to terminate the ISPF browse session and return to theRelational Tools session.

4.5.2 Using the Import Process

When you select I on the Choose a Definition Option menu, thefollowing panel is displayed:

--------------------------------- IMPORT Process -------------------------Command ===>

Definition Type ===> (ALL – Import All Definitions, PK - Primary Keys, R - Relationships, CM - Column Maps, TM - Table Maps, AD - Access Definitions, CD - Compare Definitions)

Input DSN ===>Overwrite Existing Defs ===> (Y-Yes, N-No)Continue Import on Error ===> (Y-Yes, N-No)

Enter Report File Name or Leave Blank for a Temporary File: Report DSN ===>

Figure 158. Import Process Panel

REPORTCommand

Page 296: Move for DB2 User Guide

4. Definitions

282 Move for DB2

The fields on the panel are:

Definition Type Specify the type of definition to process. Theavailable types are:

ALL

PK

R

CM

TM

AD

CD

All types

Primary Keys

Relationships

Column Maps

Table Maps

Access Definitions

Compare Definitions (Only displayed ifCompare for DB2 is installed.)

If you specify ALL, all object definitions in theinput data set are imported.

Input DSN Specify the name of the sequential or partitioneddata set containing the object definitions that are tobe imported. You can specify the name of anexisting data set or request a selection list byspecifying an asterisk as the last character of thename.

OverwriteExisting Defs

Specify what action should be taken if an importedobject definition has the same name as an objectdefinition already in the current PST Directory.Specify YES to overwrite existing definitions inthe Directory; NO to ignore the conflictingimported object definition and proceed with thenext.

Definitions in the DB2 catalog are neveroverwritten. If a primary key or relationship nameconflicts with a name in the DB2 Catalog, an errormessage is written to the report file. Processingcontinues based on the specification for ContinueImport on Error.

Continue Importon Error

Specify whether the Import Process shouldcontinue if an error is encountered when importingan object definition. If you specify YES, the objectdefinition in error is bypassed, and the ImportProcess continues with the next definition. Theerror messages are written to the report file.

Panel Fields

Page 297: Move for DB2 User Guide

4.5 Export and Import Processes

User Manual 283

Report DSN Specify the name of the sequential data set tocontain the report resulting from the current ImportProcess. You can specify the name of an existingdata set or request a selection list by specifying anasterisk as the last character of the name.

You can specify the name of a new data set. Youwill be prompted for allocation information and thedata set will be allocated for you.

If you do not specify a name, the report is writtento a temporary file. If the report is written to atemporary file, you must use the REPORTcommand when the IMPORT Summary panel isdisplayed.

Use ENTER to perform the Import Process. Use END or CANCELto abandon the process. If you use END, your specifications areprofiled.

Import Summary

When the Import Process has completed, the IMPORT Summarypanel is displayed.

-------------------- IMPORT Summary ---------------------------Command ===>

Input File DSN: PSTDEMO.TEST2

Summary of Results

Primary Keys Processed : 0 Relationships Processed : 1 Table Maps Processed : 1 Column Maps Processed : 1 Access Definitions Processed : 6 Compare Definitions Processed : 1

Report File DSN: PSTDEMO.TEST3

No error conditions were found

Enter REPORT Command to View the Report FilePress ENTER Key to Continue ProcessingEnter END Command to Exit

Figure 159. Import Summary

This panel provides the following:

Input File DSN Name of the sequential or partitioned data setcontaining the exported object definitions.

Summary of Results A list of the object definitions and the total

Panel fields

Page 298: Move for DB2 User Guide

4. Definitions

284 Move for DB2

number of each added to the Directory.

Report File DSN Name of the sequential data set containing theresults of the Import Process.

This is followed by a message indicating whether any error conditionshave been encountered. If errors have been encountered, explanatorytext for each is provided in the report file.

When the IMPORT Summary panel is displayed, use ENTER toredisplay the IMPORT Process panel or END to return to the Choose aDefinition Option menu.

You can display the contents of the report file using the REPORTcommand. This command automatically invokes the ISPF browsefacility and displays the contents of the report.

The report lists the imported object definitions by category and thenames of each imported object. Any error messages are also includedin the report.

********************************* Top of Data ********************* IMPORT Process Report Created on Wednesday, July 28, 1999 at 09:45 AM File: PSTDEMO.TEST2

PRIMARY KEY IMPORTED : PSTDEMO.CUSTOMERSRELATIONSHIP IMPORTED : PSTDEMO.ORDERS.CUSORDCOLUMN MAP IMPORTED : PSTDEMO.DEMOMAPTABLE MAP IMPORTED : PSTDEMO.TESTMAPACCESS DEFINITION IMPORTED : PSTDEMO.PSTSP.TEST1******************************** Bottom of Data *******************

Figure 160. IMPORT Process Report

Use END to terminate the ISPF browse session and return to theRelational Tools session.

4.5.3 File Format

The Export Process copies each selected object definition from thePST Directory and generates a set of SQL-like statements for theseobjects. These statements are stored in the output file and used as theinput to the Import Process. This section documents the format ofthese statements.

You can use the ISPF facilities to browse and edit this file. Usecaution when editing. The Import Process requires specific formatsfor these statements. Any deviations will cause errors.

REPORTCommand

Page 299: Move for DB2 User Guide

4.5 Export and Import Processes

User Manual 285

The general format rules are:

• Each statement begins in the first position of a line with thekeyword CREATE.

• Each statement is terminated with a semicolon. The ExportProcess inserts a blank line after the semicolon but this is notrequired.

• At least one space is inserted between parameters.

• The qualifiers for individual objects in sets of specifications, suchas the table list entries for an Access Definition, are enclosed inparentheses.

• If the length of the statement exceeds the length of the line, abreak occurs before or after a parameter and its qualifiers. Theremaining text is continued on the next line. The Export Processindents the continued text, but this is not required. (Continuationcharacters are not used except as noted for the SQL WHEREClause.) As many lines as are needed are used.

• If the first two non-blank characters on the line are dashes (-), theentire line is treated as a comment and ignored. Comments can beplaced within an object definition or between definitions.

The format of the statements for each object type is documented in thefollowing pages. The syntax used for these statements is:

KEYWORD Statement keywords are shown in uppercase andmust be supplied as shown.

Text Variable text is shown in lowercase italics.

( ) Required statement delimiter to group a series ofqualifiers for a parameter.

[ ] Indicates an optional parameter.

{ } Indicates a choice of two or more settings fromwhich one must be selected.

Primary Keys

The following statement is generated for each primary key:

CREATE PK table[DESCRIPTION //description//]COLS (column [,column])

Page 300: Move for DB2 User Guide

4. Definitions

286 Move for DB2

The fully qualified table name is specified followed by:

DESCRIPTION The description of the primary key. The textmay be from 1 through 40 characters long andmust be enclosed in double slashes.

COLS The list of columns participating in the primarykey enclosed in parentheses. The column namesmust be separated by commas.

The standard DDL CREATE TABLE and ALTER TABLEstatements are also acceptable.

Relationships

The following statement is generated for each relationship:

CREATE REL relationship [DESCRIPTION //description//] SECURITY security

CHI child PAR parent(parent-expr = child-expr [,parent-expr = child-expr])

The relationship name is specified followed by:

DESCRIPTION The description of the relationship. The text maybe from 1 through 40 characters long and mustbe enclosed in double slashes.

SECURITY The security assigned to the object. Specified asone of the following:

PUBLIC All can use and modify. Default.

READONLY All can use but only owner canmodify

PRIVATE Only owner can use and modify

CHI The fully qualified name of the child table.

PAR The fully qualified name of the parent table.

The list of corresponding columns or expressions participating in therelationship must conform to the following rules:

• The entire expression must be enclosed in parentheses.

• The parent table expression is on the left of the equal sign and thechild table expression is on the right.

Relationshipexpressions

Page 301: Move for DB2 User Guide

4.5 Export and Import Processes

User Manual 287

• The entries must be separated by commas.

• If the length of these expressions exceeds the length of the line,the break is placed before or after the expression or the equal signor after a comma or any space within the expression.(Continuation characters are not used.)

The standard DDL CREATE TABLE and ALTER TABLEstatements are also acceptable.

Column Maps

The following statement is generated for each Column Map:

CREATE CM columnmap [DESCRIPTION //description//] SECURITY security [EXTDSN dsname] SRC table DEST table VAL {ON | OFF} SRCTYPE value source-expr = dest-col [, SRCTYPE value source-expr = dest-col ]

Every parameter corresponds to a value that can be specified for aColumn Map.

DESCRIPTION The description of the Column Map. The text maybe from 1 through 40 characters long and must beenclosed in double slashes.

SECURITY The security assigned to the object. Specified asone of the following:

PUBLIC All can use and modify. Default.

READONLY All can use but only owner canmodify.

PRIVATE Only owner can use and modify.

EXTDSN Name of the Extract File from which the columndefinitions are taken. If the file was uploaded fromOS/2, check the file name.

SRC Fully qualified name of the source table.

DEST Fully qualified name of the destination table.

VAL Validation setting as either ON, validation wasperformed when the map was created, or OFF,validation was not performed.

Parameters

Page 302: Move for DB2 User Guide

4. Definitions

288 Move for DB2

SRCTYPE Each source and destination mapping. value is aninternal code based on the content of the mappedcolumns and can be one of the following:

ABCDEFHIJKLM

NUTX

numeric literalstring literalvalid column namecurrent time registercurrent date registercurrent timestamp registercurrent user registercurrent SQLID registera defaultExit routinebad errorColumn Map column source is the same asthe destinationcolumn will receive NULLcolumn is unusablecurrent TSOID registervalid expression for source

source-expr Specified source expression.

dest-column Name of the destination column.

Table Maps

The following statement is generated for each Table Map:

CREATE TM tablemap [DESCRIPTION //description//] SECURITY security SRCCID sourceid DESTCID destid [COLMAPID colmapid] [SRCEXT dsname | SRCAD ad] [DESTEXT dsname | DESTAD ad] [VALRULES {C|M}] [SRCTYPE {X|A|T}] [DESTTYPE {X|A|T}] (sourcetable = desttable [CM mapname | LOCALCM (mapdef)] [,sourcetable = desttable [CM mapname | LOCALCM (mapdef) ] ] )

Every parameter corresponds to a value that can be specified for aTable Map.

DESCRIPTION The description of the Table Map. The text maybe from 1 through 40 characters long and must beenclosed in double slashes.

Parameters

Page 303: Move for DB2 User Guide

4.5 Export and Import Processes

User Manual 289

SECURITY The security assigned to the object. Specified asone of the following:

PUBLIC All can use and modify. Default.

READONLY All can use but only owner canmodify.

PRIVATE Only owner can use and modify.

SRCCID Default Creator ID for the source.

DESTCID Default Creator ID for the destination.

COLMAPID Default Column Map ID.

The source and destination determine which of the following are included.

SRCEXT Name of the data set containing an Extract Fileused as the source. If the file was uploaded fromOS/2, check the file name.

SRCAD Fully qualified name of the Access Definition usedas the source in the Table Map.

DESTEXT Name of the data set containing an Extract Fileused as the destination in the Table Map.

DESTAD Fully qualified name of the Access Definition usedas the destination in the Table Map. If the file wasuploaded from OS/2, check the file name.

VALRULES Indicates whether the Table Map was created toconform to MOVE or Compare for DB2 rules.The value is M for MOVE or C for Compare forDB2.

SRCTYPE Source type as Extract File (X), Access Definition(A), or table (T).

DESTTYPE Destination type as Extract File (X), AccessDefinition (A), or table (T).

The following source table to destination table mapping information isprovided for every pair of tables on the Table Map. At least one pairof tables must be specified.

sourcetable Source table name. The Creator ID is included onlyif it differs from the default specified for SRCCID.

desttable Destination table name. The Creator ID is includedonly if it differs from the default specified forDESTCID. The words "NOT-SPECIFIED" areinserted when the destination table is omitted in a

Table Mapping

Page 304: Move for DB2 User Guide

4. Definitions

290 Move for DB2

table pair.

One of the following is included only when a Column Map has beenspecified for a pair of tables.

CM Name of the Column Map for the pair of tables. TheMap ID is included only if it differs from theCOLMAPID value.

LOCALCM Column Map definition enclosed in parentheses.Only the column mapping (source-expr = dest-column) is included here. For details on the contentsof the Column Map specification see the explanationfor Column Maps in this section.

Access Definitions

The following statement is generated for each Access Definition:

CREATE AD group.user.ad [DESCRIPTION //description//} SECURITY security DEFCID defaultcreatorid START starttable ADDTBLS {Y|N} MODCRIT {Y|N} BEGINDISP {D|S|A} ADCHGS {T|P} USENEW {Y|N} [ROWLIST dsname] [ GRPCOL column GRPROWS n GRPVALS n ] TABLE (table ACCESS {S|U|I|D} REF {Y|N}

[EXTRFREQ n] [EXTRLIMIT n] PREDOP {A|O} [SQL //sqlwhereclause//] [CORRELNAME correlnam] COLFLAG {Y|N}

ARCIXTAB {Y|N} ARCDAA {Y|N} ARCOP {A|O} [COLUMN (column DISP {Y|N} ACCESS {S|U}

HEADING {N|L}{L|R|C} [SORT n {A|D}]

[PRED //selectioncriteria//]) ] )[ARCIXCOL {Y|N}][ARCFMT ‘formatparam’][ARCDATE ‘explicitdate’][ARCPIVOT n][ARCYRS n][ARCMOS n][ARCWKS n][ARCDAYS n] ) ] )

REL (relationship STATUS {NEW|SEL|UNSEL|UNK} Q1 {Y|N} Q2 {Y|N} CHILDLIMIT {n|NOCHILDREN|UNLIMITED} TYPE {DB2|PST} DUPRELS {Y|N} PAR parent CHI child )

Every parameter corresponds to a value that can be specified for anAccess Definition.

Parameters

Page 305: Move for DB2 User Guide

4.5 Export and Import Processes

User Manual 291

DESCRIPTION The description of the Access Definition. Thetext may be from 1 through 40 characters longand must be enclosed in double slashes.

SECURITY The security assigned to the object. Specified asone of the following:

PUBLIC All can use and modify. Default.

READONLY All can use but only owner can modify.

PRIVATE Only owner can use and modify.

DEFCID Default Creator ID.

START Start Table. The Creator ID is included only when itdiffers from the default Creator ID.

The following parameters correspond to those specified on the AccessDefinition Parameters panel:

ADDTBLS Dynamically add tables. This is specified as Y toenable users to dynamically add tables during anedit or browse session; otherwise it is N.

MODCRIT Modify selection criteria. This is specified as T toenable users to modify criteria during an edit orbrowse session; otherwise it is P.

BEGINDISP Initial display when Access Definition used to editor browse. This is specified as: D for data, S forthe selection criteria prompt for the Start Tableonly, or A for the selection criteria prompt foreach accessed table including the Start Table.

ADCHGS Changes to Access Definition during edit. This isspecified as T to enable users to savemodifications to an Access Definition during anedit or browse session; otherwise it is P.

USENEW Use NEW relationships. This is specified as T toalways select new relationships for traversalduring an Extract Process; otherwise it is P to notselect new relationships.

Page 306: Move for DB2 User Guide

4. Definitions

292 Move for DB2

The following parameters indicate whether a row list or group selectionprocessing has been defined for the Start Table.

ROWLIST Name of the data set containing the row list from aPoint-and-Shoot session. This is included onlywhen a row list is defined.

GRPCOL Name of the column specified for group selectionprocessing.

GRPROWS Maximum number of rows to be selected for eachunique column value for group selection processing.

GRPVALS Maximum number of unique column values forgroup selection processing.

The following parameters are specified once for each of these objectincluded in the Access Definition:

TABLE Table in Access Definition. (See below)REL Relationship in Access Definition. (See below)

A TABLE entry is provided for every table in the Access Definition.The set of keywords for one table is enclosed in parentheses. Everykeyword corresponds to a value that can be specified in the AccessDefinition for a table.

ACCESS Access rights.

REF Designates a reference table.

EXTFREQ Random selection by every nth row.

EXTRLIMIT Maximum number of rows to be extracted.

PREDOP Indicates whether selection criteria is ANDed orORed.

COLFLAG Indicates whether or not specifications on theDefine Columns panel were modified.

SQL Text of the SQL WHERE Clause. This isincluded only when an SQL WHERE Clause isdefined.

CORRELNAME Correlation name specified on the SQL WHEREClause panel.

COLUMN Specifications for the columns in a table.

Tables

Page 307: Move for DB2 User Guide

4.5 Export and Import Processes

User Manual 293

ARCIXTAB This is specified as Y if the table contains atleast one column that is an index column;otherwise it is N. (Archive for DB2 use only.)

ARCDAA This is specified as Y if the delete-after-archiveoption has been specified for this table; otherwiseit is N. (Archive for DB2 use only.)

ARCOP This is the operator between date specificationsfor archiving; A is AND, O is OR. (Archive forDB2 use only.)

A COLUMN entry is provided for every column in a table only whenthe defaults have been modified for the Access Definition. The set ofkeywords is enclosed in parentheses. Every keyword corresponds to avalue that can be specified for a column.

DISP Designates display or nondisplay setting.

ACCESS Access rights.

HEADING Two values indicating: -- whether the column heading or DB2 label is used. -- the position of the column.

SORT Two values indicating whether the column: -- participates in the sort and the sort level. -- is sorted in ascending or descending order.

This is included when sort criteria is specified.

PRED Text of the selection criteria. This is includedwhen selection criteria is specified.

ARCIXOL This is specified as Y if the column is an indexcolumn; otherwise it is N. (Archive for DB2 useonly.)

ARCFMT Format parameter for archiving. Must beenclosed in single quotes. (Archive for DB2 useonly.)

ARCDATE Explicit date for archiving. Must be enclosed insingle quotes. (Archive for DB2 use only.)

ARCPIVOT Value specifies Pivot Year for archiving.(Archive for DB2 use only.)

Columns

Page 308: Move for DB2 User Guide

4. Definitions

294 Move for DB2

ARCYRS Value specifies Years for archiving. (Archivefor DB2 use only.)

ARCMOS Value specifies Months for archiving. (Archivefor DB2 use only.)

ARCWKS Value specifies Weeks for archiving. (Archivefor DB2 use only.)

ARCDAYS Value specifies Days for archiving. (Archivefor DB2 use only.)

The SQL WHERE Clause and the selection criteria text must bedelimited by slashes “//”. If the text exceeds the length of one line,continuation is indicated by slashes at the end of the line to becontinued and at the beginning of the continuation line. The text canbe broken anywhere because when imported, these continuation linesare appended without inserting blanks.

A REL entry is provided for each relationship that can be used by theAccess Definition as listed on the Specify Relationship Usage panel.The set of keywords is enclosed in parentheses. Every keywordcorresponds to a value that can be specified to determine the use of arelationship by an Access Definition.

STATUS Current status of relationship.

Q1 Value specified for Question 1.

Q2 Value specified for Question 2.

CHILDLIMIT Specifies the maximum number of childrenextracted for a relationship. Specify:

NNOCHILDRENUNLIMITED

Explicit number of rows.No child rows.All related child rows.

TYPE Indicates whether the relationship is defined toPST or DB2.

DUPRELS Indicates whether there is at least one otherrelationship with the same parent and child table.

PAR Parent table.

CHI Child table.

Continuation

Relationships

Page 309: Move for DB2 User Guide

4.5 Export and Import Processes

User Manual 295

Compare Definition

The following statement is generated for each Compare Definition:

CREATE CD group.user.name [DESCRIPTION //description//} SECURITY security SRC1TYPE {EXTR dsname | AD ad | LOCALAD (addef)} SRC2TYPE {EXTR dsname | AD ad | LOCALAD (addef)} TM (tablemap) [ REL (relname STATUS {SEL|UNSEL|REF} SOURCE {1|2} TYPE {DB2|PST} PAR parent CHILD child ) ] [CMPDSN dsname]

Every parameter corresponds to a value that can be specified for anCompare Definition.

DESCRIPTION The description of the Compare Definition. Thetext may be from 1 through 40 characters longand must be enclosed in double slashes.

SECURITY The security assigned to the object. Specified asone of the following:

PUBLIC All can use and modify. Default.

READONLY All can use but only owner canmodify.

PRIVATE Only owner can use and modify.

SRC1TYPE Specifies the type of source and name for Source1 as one of the following:

EXTR Name of the Extract File.

AD Fully qualified name of the AccessDefinition.

LOCALAD Entire Access Definitionspecification.

SRC2TYPE Specifies the type of source and name for Source2 as one of the following:

EXTR Name of the Extract File.

AD Fully qualified name of the AccessDefinition.

Parameters

Sources

Page 310: Move for DB2 User Guide

4. Definitions

296 Move for DB2

LOCALAD Entire Access Definitionspecification.

ALL All tables in the database. Thetables are listed in the Table Mapspecifications.

For details on the contents of the Access Definition specification seethe explanation for Access Definitions in this section.

The complete definition of a Table Map, TM, is always included.The qualifiers are specified within parentheses. For details on thecontents of the Table Map specification see the explanation of TableMaps in this section.

When a data set name has been specified for the results of theCompare Process, that name is included as the parameter CMPDSN.Otherwise, the parameter CMPDSN is not included in the CompareDefinition statement.

Each relationship in the Compare Definition is specified by a RELparameter. The keyword qualifiers correspond to the relationshipspecifications for the Compare Definition:

STATUS Indicates whether the relationship is selected,unselected, or for a reference table.

SOURCE Indicates whether the relationship is taken fromSource1 or Source 2.

TYPE Designates whether the relationship is defined inthe DB2 catalog or the PST Directory.

PAR Fully qualified name of the parent table.

CHI Fully qualified name of the child table.

Table Map

Compare ProcessData Set

Relationships

Page 311: Move for DB2 User Guide

User Manual 297

5. Data Migration

MOVE provides a set of flexible processes for migrating related dataand object definitions from multiple tables. To migrate a related setof data and object definitions, you specify the:

• Source

• Destination

To specify the source you use an existing Access Definition or createa new Access Definition. The created Access Definition can betemporary, for a single use, or permanent, saved for repeated use.The Access Definition is used as input to the Extract Process. (SeeSection 3. Specify Access Definitions for a detailed discussion ofcreating and modifying Access Definitions.)

The Extract Process copies the specified data and object definitions(i.e., table, view, key, index, etc.) to an Extract File. The Extract Fileis saved and can be reused as needed.

The Insert Process copies the source data and object definitions to adestination. MOVE offers flexibility for changing the destinationspecification or automatically inserting the data and object definitionsin a logical manner.

For example, if the destination tables do not exist, MOVE providesthe option of creating tables to match the source followed by insertingthe data. If the named destination tables do exist but do not match thesource tables, you can use Column Maps to specify exactly what datais placed in each column. This includes the source data, literal values,special registers, expressions, exit routines and DB2 defaults. (SeeSection 4.3 Column Maps for a detailed discussion of ColumnMaps. See Section 4.4 Table Maps for a detailed discussion ofTable Maps.)

Specify Source

SpecifyDestination

Page 312: Move for DB2 User Guide

5. Data Migration

298 Move for DB2

5.1 Migration Menu

To migrate data, select Option 7 MIGRATION on the Main Menu.The following panel is displayed.

------------------------------- Data Migration --------------------------OPTION ===> SQLID ===> SUBSYS ===>1 EXTRACT - Extract Data from DB2 (Source) LOCATION ===>2 INSERT - Insert Data into DB2 (Destination)3 DB2 LOAD - Create DB2 Load Files and Load4 DELETE - Delete Data from DB2 Tables5 CREATE - Create Tables and Related Object Definitions6 CONVERT - Convert Extract File Using Table and Column Maps

R RETRY/RESTART - Retry/Restart an Insert or Delete ProcessB BROWSE - Browse Content of Extract File or Control File

Figure 161. Data Migration Menu

The available options are:

1 EXTRACT Specify the set of data to be extracted. Afterthe set of source data is specified, MOVEextracts the data and stores it in an ExtractFile. The extracted data can include the rowsfrom the specified set of source tables and theobject definitions for those tables. You canrequest the object definitions for tables,primary keys and relationships, indexes,views, synonyms, and aliases.

The specifications for the extracted data canbe defined in an Access Definition and storedfor repeated use or defined as temporary forone-time use.

The Extract File is used as the input for theother options. If Compare for DB2 isinstalled, the Extract File can be used as inputfor the Compare Process. The contents of theExtract File can only be modified using theEXTRACT Option. The other options do notmodify it.

If BMC’s UNLOAD PLUS is available, itcan be used to extract the data from theImage Copy files or directly from the DB2

Panel Options

Page 313: Move for DB2 User Guide

5.1 Migration Menu

User Manual 299

VSAM files.

Extract Files created using Relational Toolsfor OS/2 may be used as input to the otherMOVE migration processes. However, DB2Common Server supports the ON UPDATEclause and user-defined data types forcolumns on the CREATE TABLE statement.Since these are not supported by DB2/MVS,the Extract File may need to be modified.

Conversely, the Extract Files created usingthis option can be used by Relational Toolsfor Servers. See Section 7. in the Move forServers User Manual.

2 INSERT Specify the DB2 destination for the sourcedata in an Extract File. This option insertsthe source data into the destination.

When tables involved in the insert do not existat the destination, you may direct MOVE tocreate them. In addition, any other objectdefinitions in the Extract File for objects thatdo not exist at the destination may also beselected. By default, the objects that arecreated are identical to the source objects.

A Table Map is used to specify thedestination table names that correspond tosource table names. Additionally, a ColumnMap can be used for any source anddestination table pair when the column namesor attributes do not match, or when the datavalues are to be altered.

The destination tables do not have to be in thesame subsystem as the source tables.

3 DB2 LOAD Create DB2 load files from the Extract File.These files can then be used for input toIBM's DB2 Load Utility or any other thirdparty load facility. (If BMC’s LOADPLUShas been specified by site or user option asthe load utility to be used, the DB2 LOADoption is replaced with LOADPLUS. See theinformation on user options for informationon specifying the load utility.)

Page 314: Move for DB2 User Guide

5. Data Migration

300 Move for DB2

4 DELETE Delete the data from the DB2 tables asdefined in the Extract File. The Extract Fileis retained. Only rows of data can be deleted.Object definitions are not deleted.

5 CREATE Create DB2 tables and related objects forwhich definitions are contained in the ExtractFile.

6 CONVERT Convert the source data defined in the ExtractFile. The original source data is converted byapplying the Table Map and Column Mapspecifications to obtain a new or revisedExtract File. This new Extract File containsthe converted data to migrate. This is usefulfor masking sensitive data and for migratingDB2 data from MVS to another platform,such as DB2 for OS2 and XDB, where thedatabase design may be different.

R RETRY/RESTART Complete an Insert or Delete that has notsuccessfully processed the entire Extract Fileas specified.

RETRY allows you to process any rows thatmay have been discarded (e.g., due to RIconstraints).

RESTART allows you to "restart" a processthat terminated abnormally because of time orspace limitations or by user request.

B BROWSE Display an Extract File to view the contentsof that file or a Control File to examineextracted data or identify rows in error.

The remainder of this section discusses each of these options.

The following three fields are available:

SQLID Current SQLID. If you modify this value,MOVE will attempt to connect using themodified SQLID. Since you can beconnected with only one SQLID, theconnection with the original SQLID is notmaintained. However, if MOVE cannotconnect with the specified SQLID, arollback is performed and you arereconnected with the original SQLID.

Panel Fields

Page 315: Move for DB2 User Guide

5.1 Migration Menu

User Manual 301

SUBSYS Current subsystem. If you modify thisvalue, MOVE will attempt to connect tothat subsystem. Since you can be connectedto only one subsystem at any time, theoriginal subsystem is disconnected.However, if MOVE cannot connect to thespecified subsystem, a rollback isperformed and you are reconnect to theoriginal subsystem.

LOCATION Current location. This field is onlydisplayed if remote access is available.

If you modify this value, MOVE willattempt to connect to the remote location.Since you can be connected to only onesubsystem at any time, the originalsubsystem is disconnected. However, if theconnection fails, the Relational Toolssession is restarted and the Main Menu isredisplayed.

Page 316: Move for DB2 User Guide

5. Data Migration

302 Move for DB2

5.2 Extract Data

The Extract Process is used to create an Extract File. An Extract Filecontains the selected set of related rows from one or more tables and,if requested, the object definitions for those tables. The Extract File isused as input to the MOVE processes Insert, Update/Insert, Delete,DB2 Load, Create, and Convert. The Extract File can be usedrepeatedly and simultaneously by many users.

To perform the Extract Process you must specify the set of data to beextracted. You can use specifications from an existing AccessDefinition, create a new Access Definition, or specify temporarydefinitions.

An Extract File is created by traversing a set of tables. The tablesand the relationships to use to traverse those tables are specified in anAccess Definition. In addition, the set of extracted rows is determinedby other specifications such as:

• Manual selection of specific rows in the Start Table. Thisselection process is referred to as Point-and-Shoot.

• Selection criteria for one or more tables.

• A maximum number of rows to extract for one or more tables.

• A numeric value used to determine random selection. Forexample, select every twentieth row.

The definitions for tables and columns are always extracted.Additionally, you can request the following object definitions to beincluded in the extract:

Primary Keys and Relationships Indexes AliasesViews Synonyms Column Field Procedure Names

Extract File

Page 317: Move for DB2 User Guide

5.2 Extract Data

User Manual 303

5.2.1 Extract Process Menu

When you select Option 1 EXTRACT on the Data Migration menuto perform the Extract Process, the following menu is displayed.

----------------------------- EXTRACT Process ----------------------------OPTION ===>

1 TABLES - Specify Set of Tables and Selection Criteria 2 PATHS - Specify Traversal Paths via Relationship List 3 OBJECTS - Specify Object Definitions to EXTRACT 4 PERFORM - Specify EXTRACT Parameters and Perform EXTRACT

Type of Access Definition to Use for EXTRACT ===> T (P-Perm, T-Temp)

If Permanent, Specify New or Existing Access Definition Name GROUP ===> USER ===> NAME ===>

Use '_' for DB2 LIKE Character===> N (Y-Yes, N-No)

These commands are available when the AD Selection List is displayed: S - Select a Definition I - Display Information about a Definition D - Delete a Definition AT - Modify Attributes of a Definition

Figure 162. Extract Process Menu

Select one of the options:

1 TABLES Define or modify specifications for the set of tablessubject to the Extract Process. This option displaysthe Select Tables/Views for AD panel, which is usedto specify the names of the tables to be included in theextract in the Table List.

This panel also displays the type of selection criteria,if any, that has been defined for each table. You canspecify a random factor and row limits for each tableon this panel. You can use commands to displayadditional panels for defining selection criteria or anSQL WHERE Clause. This panel also enables you toinvoke the Point-and-Shoot facility to select rowsfrom the Start Table.

For detailed information on how to specify the namesof the tables, see Section 3.3 Table/View Selection.For information on specifying selection criteria andSQL WHERE Clauses, see Section 3.4 SpecifyingCriteria. For information on the Point-and-Shootfacility see Section 3.5 Using the Point-and-ShootFacility.

Menu Options

Page 318: Move for DB2 User Guide

5. Data Migration

304 Move for DB2

2 PATHS Display and modify the relationship list. The SpecifyRelationship Usage panel is used to select therelationships to be traversed when extracting the data.For detailed information on how to specify therelationships and accompanying parameters, seeSection 3.7 Selecting Relationships.

3 OBJECTS Display the Specify Object Definitions toEXTRACT panel from which the objects to beextracted are selected. The selections are profiled andused by default every time an Extract Processincludes object definitions.

4 PERFORM Display the Specify EXTRACT Parameters andExecute panel to specify the parameters and invokethe Extract Process. The parameters include thespecification for whether object definitions are to beextracted. If BMC’s UNLOAD PLUS is available, aprompt is included to specify whether it is to be usedfor the current extract.

Indicates whether the specifications defined for the extract aretemporary, discarded after the extract, or permanent, saved in theAccess Definition. If they are to be temporary, specify T for TEMPin response to the prompt, Type of Access Definition to Use forEXTRACT. If they are to be permanent, specify P. You mustspecify the name of an Access Definition when the specifications areto be stored permanently.

If you decide that the specifications are permanent, specify the nameof the Access Definition to be used for the process. The fields on thepanel correspond to the three parts of the Access Definition name:

GROUPUSERNAME

If the name of the Access Definition you specify does not exist,MOVE automatically prompts you to create a new Access Definition.The Select Tables/Views for AD panel is displayed. See Section 3.Specify Access Definitions for details on how to define an AccessDefinition.

You can leave the fields blank or use DB2 LIKE syntax to display aselection list of available Access Definitions. Use the Select linecommand, S, to select an Access Definition from the list.

Temporary orPermanent

Access DefinitionName

Create a NewAccess Definition

Selection List

Page 319: Move for DB2 User Guide

5.2 Extract Data

User Manual 305

After you have selected the Access Definition and used ENTER, theEXTRACT Process menu is redisplayed. The name of the selectedAccess Definition is displayed in the Access Definition Name field.

You can define or modify the Access Definition specifications,whether temporary or permanent, by selecting Options 1 or 2 again.As noted above, these options display panels discussed in othersections of this manual.

Once the source data has been specified, use Option 3 to specifywhich object definitions are to be extracted if object definitions arerequested with the Extract Process. Use Option 4 to perform theextract.

The following primary commands are available when the EXTRACTProcess menu is displayed:

CANCEL END OPTIONS

5.2.2 Select the Object Definitions

When you select Option 3 from the EXTRACT Process menu toselect the types of object definitions, the Specify Object Definitionsto EXTRACT panel is displayed. By default primary keys,relationships, and indexes are extracted. (These are shown asSELECT status in Figure 163. Specify Object Definitions toEXTRACT.) Table and column definitions are always extracted,even when object definitions are not requested because MOVE alwaysenables users to create non-existent destination tables.

You can select and unselect the object definitions to be extracted. Theselected object definitions are extracted for every table included in theExtract Process. The values you specify are profiled and will be usedautomatically for every subsequent request to extract objectdefinitions.

Specify Options

AvailableCommands

Page 320: Move for DB2 User Guide

5. Data Migration

306 Move for DB2

--------------------Specify Object Definitions to EXTRACT ----------------Command ===>

Use S Line Command to Select ALL Associated Objects of Specified TypeUse U Line Command to Unselect Associated Objects of Specified Type

Cmd Status Object Type--- -------- ----------------------------- _ SELECT Primary Keys and Relationshipss _ SELECT Indexes _ UNSELECT Views _ UNSELECT Aliases _ UNSELECT Synonyms _ UNSELECT Column Field Procedure Names

Note: Catalog Queries to Extract Object Definitions are Expensive Selected Objects Extracted for Tables ONLY Will Always Extract Index Required by DB2 Primary Key

Figure 163. Specify Object Definitions to EXTRACT

The fields on this panel include:

Cmd Line command field. The available line commandsare:

S Select object definition.

U Unselect object definition.

Status Indicate whether an object definition is to beextracted. Displayed as:

SELECT Object definition is to beextracted.

UNSELECT Object definition is not to beextracted.

Object Type List of the types of object definitions that can beextracted. The default selected types, PrimaryKeys and Relationships and Indexes, are shownwith the SELECT status in the Figure 163.Specify Object Definitions to EXTRACT.

The index for the primary key is always extractedwhen Primary Keys and Relationships are selectedregardless of whether Indexes is selected. IfColumn Field Procedure Names is selected, thenthe names of the edit and validation exit routinesfor the table are also extracted.

The object types that are selected are extracted only for table objectslisted on the Select Tables/Views for AD panel. These selectedobject definitions are not extracted when the object on the Select

Panel Fields

Only for Tables

Page 321: Move for DB2 User Guide

5.2 Extract Data

User Manual 307

Tables/Views for AD panel is not a table. Therefore, when an alias,synonym, or view is specified on the Select Tables/Views for ADpanel, that object definition is extracted but none of the related objectdefinitions are. A table containing columns as specified for the alias,synonym, or view is created at the destination for the extracted object.

The DDL for Temporary Tables is extracted and can be used tocreate Temporary Tables at the destination. However, there are nokeys, relationships, etc., associated with Temporary Tables and nodata stored in these tables.

You should consider what is to be created at the destination. If youdo not need the related objects (primary keys, relationships, andindexes, etc.) for object definitions other than tables, you can specifythe alias, synonym, or view on the Select Tables/Views for ADpanel. However, if you need the related objects, you can specify thebase table on the Select Tables/Views for AD and then specify theobject type on the Specify Object Definitions to Extract panel. Bythis means, the desired object and the related objects are extracted.

Generic primary keys and relationships are extracted as genericobjects. Therefore, they are created as generic unless you modify theCreator ID on the Create Object Definitions panel or modify theSQL statements generated to create the objects.

Joined views are only extracted if all tables involved in the view areincluded on the Select Tables/Views for AD panel. For PrimaryKeys and Relationships, the pertinent object definitions for all tableson the Select Tables/Views for AD panel are extracted includingthose for reference tables. For more information about creating objectdefinitions, see Section 5.7 Create Process.

The following commands are available on this panel:

CANCEL END OPTIONS RESET

END returns to the EXTRACT Process menu. CANCEL abandonsyour changes and returns to the EXTRACT Process menu.

AvailableCommands

Page 322: Move for DB2 User Guide

5. Data Migration

308 Move for DB2

5.2.3 Perform the Extract Process

When you select Option 4 from the EXTRACT Process menu toperform the extract, the following panel is displayed.

------------------- Specify EXTRACT Parameters and Execute ----------------Command ===>

Extract File DSN ===>Extract ===> D (D-Data, O-Object Definitions, B-Both)If Extracting Data: Limit Number of Extract Rows ===> _______ (1-10000, Blank-Site Limit) Extract Data using ===> (D-DB2, B-BMC'S Unload Plus)

Perform Convert with Extract ===> (Y-Yes, N-No)

Run Process in Batch or Online ===> O (B-Batch, O-Online) If Batch, Review or Save JCL ===> (N-No, R-Review, S-Save)

Figure 164. Specify EXTRACT Parameters and Execute

The fields on this panel include:

Extract File DSN Name of the Extract File that is to contain theextracted data. This file must be a sequential dataset. The Extract File name can be specifiedexplicitly by enclosing it in quotes; otherwise, thedefault prefix as specified on the User Optionspanel is automatically prepended to the name.

When the Extract Process begins, MOVEsearches for the named data set.

• If the data set exists, MOVE checks todetermine whether it is suitable for an ExtractFile.

If it is, the current Extract Process overlays thedata.

If it is not an Extract File, MOVE does notperform the extract and prompts you to respecifythe data set name.

• If the data set does not exist, MOVE promptsfor the necessary information to allocate thefile. See Appendix B. Allocating ExternalFiles for a description of the allocationprompts.

You can obtain a selection list of data sets using

Panel Fields

Page 323: Move for DB2 User Guide

5.2 Extract Data

User Manual 309

either of the wild card characters, % or *, in thelast position of the name in this field. Use theSelect line command, S, on the selection list toselect the file.

Extract Extract is to include data and/or objectdefinitions. Specify:

DOB

Only data rows are extracted. Only object definitions are extracted. Both data and object definitions extracted.

Select Start TableRows by

Values to be used to determine which data rowsare to be extracted from the Start Table. Specify:

RB

Use only the Row List values. Use both the Row List and the selectioncriteria. That is, extract the rowsidentified in the Row List and then anyadditional rows that satisfy the selectioncriteria.

This prompt is displayed only if both selectioncriteria and a Row List have been defined for theStart Table. If only one of these has been defined,it is automatically used for the Extract Processand the prompt is omitted.

Limit Number ofExtract Rows

Maximum number of rows of data that can beextracted. This applies to data rows only and notto object definitions. The Extract is terminated ifthe number of extracted rows exceeds this limit.Specify:

valueblank

0 - 99999999Site-defined limit

The figure shows the distributed defaultmaximum of 10,000. The site-defined limit is seton the Site Options panel.

Extract Data using Specify whether DB2 or BMC's UNLOAD PLUSis to be used to extract the data. Specify:

DB

DB2 is used.BMC's UNLOAD PLUS is used.

Page 324: Move for DB2 User Guide

5. Data Migration

310 Move for DB2

Perform Convertwith Extract

Specifies whether the Convert Process isperformed before the data is written to the ExtractFile. The Convert Process can mask sensitivedata or alter data values.

Y

N

Convert Process is performed. (AfterENTER is pressed, the Specify ConvertParameters panel is displayed.)

Convert Process is not performed.

Run Process inBatch or Online

Specify whether execution of the Extract Processis performed in batch or online. Specify:

BO

BatchOnline

If site management has established a maximumnumber of rows for online processing and thisrequest exceeds that limit, this option is forced toBatch and cannot be changed. Site managementmay have guidelines.

If Batch, Reviewor Save JCL

For batch execution, indicate whether JCL shouldbe submitted, reviewed prior to job submission orsaved for submission at a later time. Since theJCL is displayed in the ISPF editor, you canmodify it for the current request and save it tosubmit later. Specify:

N Submit job, do not display or save theJCL.

R Display the JCL for review prior to jobsubmission.

S Save the JCL. Prompts are provided foryou to specify the name of a file in whichto store JCL.

The following commands are available on this panel:

CANCEL END OPTIONS

AvailableCommands

Page 325: Move for DB2 User Guide

5.2 Extract Data

User Manual 311

The following figure shows the selection list panel that is displayedwhen you request a list of Extract File data set names. This figureshows a full-screen display.

------------------------- Select Extract Data Set -----------------------Command ===> Scroll ===> CSR

Cmd ---------------- Data Set Name --------------- 1 OF 5 ******************** TOP *********************___ PSTDEMO.COHEND.XFILE___ PSTDEMO.CUST.XCUST___ PSTDEMO.NAD.XFILE___ PSTDEMO.SENTNER.XFILE___ PSTDEMO.SHIP_TO.TEST ******************* BOTTOM *******************

Figure 165. Select Extract Data Set

Use the Select line command to select a data set. Use END to returnto the Specify EXTRACT Parameters and Execute panel.

5.2.3.1 UNLOAD PLUS

Users can indicate whether the data is to be extracted from DB2directly or from BMC’s UNLOAD PLUS utility only when the utilityis installed and site management has made it available to MOVE.(Release 2.0 and greater of UNLOAD PLUS is supported.)

If UNLOAD PLUS is used, the following prompts are displayed.

------------------- Specify EXTRACT Parameters and Execute ----------------Command ===>

+------------------- Specify BMC UNLOAD PLUS Parameters -------------------+ | | | Source for Extract Data ===> I (I-IMAGE COPY, D-DB FILES) | | | | If using an Image Copy, specify which Image Copy datasets should be used.| | Image Copy DSNs ===> (A-First On or After Date/Time, | | B-First On or Before Date/Time,) | | L-Latest Image Copy | | S-Specific Image Copy DSN) | | | | If selecting an Image Copy by Date and Time: | | Date (YYYY-MM-DD) ===> | | Time (HH.MM.SS) ===> | | | | If selecting an Image Copy by data set name: | | Image Copy DSN: ===> | | | | If Start Table is partitioned, you may use a subset of the partitions | | Use Subset ===> N (Y-Yes, N-No) | +--------------------------------------------------------------------------+

Figure 166. Specify BMC UNLOAD PLUS Parameters forExtract

Extract FileSelection List

Page 326: Move for DB2 User Guide

5. Data Migration

312 Move for DB2

The panel prompts for the following:

Source forExtract Data

Specify which files are to be used as the datasource. Specify:

I

D

Image Copy files are the source.

Database VSAM files are the source.

Image Copy DSNs Specify which Image Copy datasets are to beused. You indicate whether the most recentImage Copy is used or an Image Copy is selectedby date and time.

A

B

L

S

First Image Copy files on or after thedate and time specified on the panel.

First Image Copy files on or before thedate and time specified on the panel.

Latest Image Copy files. The date andtime specified on the panel are ignored.

Image Copy files named in Image CopyDSN.

Date Specify the date in the format defined for yoursite.

Time Specify the time in the format defined for yoursite.

Use Subset Specify whether or not the Extract Processextracts from all partitions or a specific set ofpartitions when the Start Table is in a partitionedtablespace. Specify:

Y

N

A selection list of partitions is displayedfrom which you select specific partitionsto be included in the process.

All partitions are used.

Panel fields

Page 327: Move for DB2 User Guide

5.2 Extract Data

User Manual 313

If you specify Y for Use Subset, a list of partitions is displayed. Thefollowing is an example.

------------------- Specify EXTRACT Parameters and Execute ----------------Command ===>

+------------------------ Specify Partitions to Use ---------------------+| ||Select the partitions to be used by placing an 'S' in the field provided||below for each partition. Enter 'U' to de-select selected partitions. ||Enter END to proceed with UNLOAD. || ||Partition Partition Values 1 of 10 ||--------- --------------------------------------------------------------||******************************** TOP ***********************************||___ 1 S '01000' ||___ 2 S '10000' ||___ 3 S '20000' ||s__ 4 '30000' ||___ 5 '40000' ||___ 6 '50000' ||___ 7 '60000' ||___ 8 '70000' ||___ 9 '80000' ||___ 10 '99999' |+------------------------------------------------------------------------+

Figure 167. Specify EXTRACT Parameters and Execute

Under the Partition heading, the panel displays a line command fieldto select or unselect partitions. Use S to select and U to unselect apartition. You can select any number of partitions, however, if youdo not select at least one, the Use Subset option on the Specify BMCUNLOAD PLUS Parameters panel is automatically changed to Nand all partitions are used.

The partitions are numbered on the panel as aid when selectingspecific partitions.

The selected partitions are identified by the S to the right of thenumber.

The Partition Values field displays 55 characters. Although DB2limits the useable portion of the partition value to the first 40characters, when the value is converted to external value it may belonger. This field displays only the first 55 characters. You canscroll the list.

Selecting a Subset

Page 328: Move for DB2 User Guide

5. Data Migration

314 Move for DB2

5.2.3.2 Perform Convert with Extract

When you specify YES for the Perform Convert with Extractprompt, the Specify Convert Parameters panel is displayed.

------------------------- Specify Convert Parameters -------------------------Command ===> Scroll ===> PAGE

By default, the converted data will be written to the named Extract File. To retain theoriginal extracted data in this file, specify a Second Extract File to store the converteddata. The second Extract File is optional.

Specify a Control File to view any conversion errors.

Extract File DSN :

Second Extract File DSN ===>Control File DSN ===>

Display Table Map and Column Maps ===> N (Y-Yes, N-No)

Age Date Values ===> N (Y-Yes, N-No)

Limit Number of Discarded Rows ===> (1-999999, Blank-No Limit)

If Destination Tables have a Cluster Index: Sort Extract File Rows: ===> N (Y-Yes, N-No)

Figure 168. Specify Convert Parameters

The panel prompts for the following:

Extract File DSN Name of the Extract File that contains the sourcedata to be converted.

Second Extract FileDSN

Name of second Extract File that is to containthe converted data. If not specified, converteddata replaces the original extracted data.Specify if you need to retain original extracteddata.

Control File DSN Name of Control File that is to contain theprocessing information about the ConvertProcess.

Display Table Mapand Column Maps

Displays Table Map panel. Specify the namesof the destination tables for each table in theExtract File. A Table Map must be specified toperform the Convert Process, therefore if you donot select this option first, MOVE automaticallydisplays the Table Map panel before proceedingwith the selected option. When the Table Map isdisplayed, you must specify the destinationCreator ID, Dest CID. By default, MOVEassumes the base destination table names are thesame as the names defined in the Extract File.

Panel fields

Page 329: Move for DB2 User Guide

5.2 Extract Data

User Manual 315

There is no default destination Creator ID. Onlydestination tables listed on the Table Map areincluded in the Extract File.

You may specify Column Maps for one or moredestination tables. These maps enable you tospecify the destination data column-by-column.

For more information about specifying TableMaps and Column Maps, see Section 4.4 TableMaps and Section 4.3 Column Maps.

Age Date Values Specify whether date values are to be aged aspart of this process. Specify:

Y

N

Date values are to be aged. The SpecifyAging Parameters panel is displayed. Onthis panel, specify aging values to be used.

These values supplement the specificationsfor columns mapped with AGE andFUTURE_YEAR functions and are used,if requested, to age DATE andTIMESTAMP columns not explicit targetsof an AGE or FUTURE_YEAR function.

Date values are not to be aged. Thespecifications for aging on the ColumnMaps included in the process are ignored.

Limit Number ofDiscarded Rows

Specify a maximum number of rows that can bediscarded. When this value is reached, theConvert Process is terminated.

Sort Extract FileRows

Specify whether the data for destination tableswith a cluster index are to be sorted. Specify:

Y

N

Sort rows.

Do not sort rows.

Page 330: Move for DB2 User Guide

5. Data Migration

316 Move for DB2

5.2.4 Extract Processing

After you have completed the Specify EXTRACT Parameters andExecute panel, press ENTER. MOVE evaluates the AccessDefinition to be used and your entries on the Specify EXTRACTParameters and Execute panel. The Extract proceeds as follows:

Online Processing

• The Access Definition is evaluated. If the Access Definitioncontains an invalid entry, an appropriate error or warning isdisplayed. (Details are discussed later in this section.)

• The Extract File is located and the contents evaluated to ensurethat the named file is an Extract File. If it is not an Extract File,an error message is displayed and you are reprompted to specifythe file name.

If the Extract File does not exist, you are prompted for allocationinformation and the file is allocated by MOVE.

• The Extract Process is executed online. A status report isdisplayed and updated periodically during the processing.

• An Extract Process Report is generated and displayed forbrowsing.

Batch Processing (including BMC’s Unload Plus)

• The Access Definition is evaluated. If the Access Definitioncontains an invalid entry, an appropriate error or warning isdisplayed. (Details are discussed later in this section.)

• The Extract File is located and its attributes are evaluated toensure that the named file is suitable as an Extract File. If it isnot suitable, a message is displayed and you are reprompted tospecify the file name.

If the Extract File does not exist, you are prompted for allocationinformation and the file is allocated by MOVE.

• The JCL is built. If you have responded Review to If Batch, Reviewor Save JCL, the JCL is displayed. (You can modify this JCL orsave it and execute the job later. Details are discussed later in thissection.)

If you have responded Save to If Batch, Review or Save JCL, youare prompted for the name of the file in which to save the JCL and

Page 331: Move for DB2 User Guide

5.2 Extract Data

User Manual 317

whether the job should be submitted after saving the JCL. (Detailsare discussed later in this section.)

• The Extract Process is executed as a batch job. Note the ExtractFile must be located again when the process is executed.

• An Extract Process Report is generated and stored in the defaultoutput file specified in the JCL.

There are a few conditions that can be detected in the AccessDefinition that prevent the Extract Process from proceeding and someconditions that present warning messages.

Error conditions can result when an existing Access Definition is usedwithout review. Changes may have been made to the database thatare only detected when the Access Definition is edited or used. Thefollowing error conditions also prevent you from saving an AccessDefinition that you are editing. The error conditions include:

• Duplicate entries are encountered for a single table. A table canbe included on the list only once. You can not specify a table andone or more views, synonyms or aliases of that table, or specifymore than one view, synonym or alias of a table. To perform theextract, delete the duplicate entries.

Note, if the Access Definition was created for Access for DB2,duplicate entries are valid for editing.

• No valid table is specified. The list of tables in the AccessDefinition does not contain any valid tables. This can occur if thetables have been dropped from the database. Also, any tables notfully qualified when named are affected when the default CreatorID is changed. To perform the extract, re-specify the tables in theAccess Definition.

• A WHERE clause is invalid. Selection criteria, for one or moretables, regardless of how it is specified, are invalid. This canoccur if changes have been made to the tables since the AccessDefinition was created. (For example, a column used in an SQLWHERE Clause has been dropped.) To perform the extract,respecify the selection criteria.

• The Start Table is invalid. This can occur if the table is droppedfrom the database or the default Creator ID was changed and theStart Table name was not fully qualified. The table is thenmarked as UNKNOWN and can not be used as a Start Table.

• The primary key is missing in a child table that has multipleparents. The primary key is required to ensure that multiple

Access DefinitionEvaluated

Error Conditions

Page 332: Move for DB2 User Guide

5. Data Migration

318 Move for DB2

copies of the same row are not extracted when the child table isrelated to multiple parents.

• The user requesting the extract does not have authorization toselect data from a table that is to be included.

A warning message is issued for every condition that may requireyour attention, but these conditions do not prevent the extract fromproceeding. When warning messages are issued, you are given theoption of proceeding or aborting the Extract Process. Warningmessages are issued for the following conditions:

• A relationship is in NEW status. This indicates that arelationship has been added to the list and you have not explicitlyselected or unselected it. You can use the Specify RelationshipUsage panel to view the relationship list and specifically select orunselect individual relationships. You can use the prompt UseNEW Relationships on the Access Definitions Parameterspanel to specify whether NEW relationships are selected orunselected as the desired default behavior. In general, you willprobably want to review these relationships before using them.

• A relationship is in the UNKNOWN status. This occurs whenthe Default Creator ID of the Access Definition has beenchanged, and a relationship, defined for tables named with theoriginal Creator ID, does not have a comparable relationshipwhen named with the new Creator ID.

• A table is in UNKNOWN status. This occurs when the DefaultCreator ID has changed causing the name of the table to changeand a table does not exist with this changed name. UNKNOWNalso occurs when the table has been dropped from the database.

• A table specified in the Access Definition is not traversed for theExtract Process. This indicates that a relationship is not selectedto provide a path from the Start Table to this table.

• A relationship specified in the Access Definition is not traversedfor the Extract Process. This indicates that a relationship is notused during the extract.

• A table specified in the Access Definition has not hadRUNSTATS run against it. If the table is large, this could haveperformance consequences when the extract is performed.

• A view, synonym, or alias is to be extracted, but object definitionsfor objects other than primary keys and relationships have beenrequested. These other object definitions will not be extracted forviews, synonyms, or aliases.

Warnings

Page 333: Move for DB2 User Guide

5.2 Extract Data

User Manual 319

If one or more errors or warnings are encountered, the EXTRACTErrors & Warnings panel is displayed. Any error prevents theExtract Process from proceeding. The Extract Process can continuedespite warnings.

You may use the SHOW STEPS command to display additionalinformation about how the Extract Process will proceed.

In the following figure, the EXTRACT Errors & Warnings panel isdisplayed. Three warnings are documented.

------------------- Specify EXTRACT Parameters and Execute ---------------Command ===>

Extract File DSN Name ===> +---------------------- EXTRACT Errors & Warnings -----------------+ | | | EXTRACT Process Can Proceed Despite the Following Warnings: | | 1 Table(s) in UNKNOWN Status | | 2 Table(s) will not be Traversed (See SHOW STEPS) | | 1 Relationship(s) will not be Traversed (See SHOW STEPS) | | | | Press ENTER Key to Proceed Despite Warnings | | Enter END Command to Return to EXTRACT Menu to Correct Problem | | | +------------------------------------------------------------------+

Figure 169. Extract Process Warnings

If specified, the data set containing the primary key values for selectedrows using Point-and-Shoot is checked as part of the validation of theAccess Definition.

A problem is encountered when:

• The Point-and-Shoot file cannot be found.

• The contents of the file specify primary key values for rows thatcannot be found.

If any of these problems are encountered, you are prompted to specifyhow to proceed. You can continue processing without using thePoint-and-Shoot values or respecify the Point-and-Shoot file name.

5.2.4.1 Batch Execution

For batch execution, MOVE builds the necessary JCL. The JOB cardinformation is taken from the JCL specified on the Job Card andPrint Options panel.

If you specified YES to the prompt, Prompt for Changes Before JobSubmission on the Job Card and Print Options panel, the defaultjob card as specified on that panel is displayed prior to job

Error and WarningReporting

Point-and-ShootValidation

Page 334: Move for DB2 User Guide

5. Data Migration

320 Move for DB2

submission. You may edit the job card and specify whether changesare to apply to the current job only or are to be applied permanently.(See Section 6.3 Job Card and Print Options.)

The information on the Job Card and Print Options panel is used,along with the extract parameters, to build the JCL required toperform the Extract Process. If you specify Review to the prompt IfBatch, Review or Save JCL on the Specify EXTRACTParameters and Execute panel, the complete jobstream is displayedin the ISPF editor. It can be edited and saved.

When you have completed reviewing the JCL, you can submit the job.If you have set the option so that jobs are automatically submittedwhen END is used, the job is submitted. Otherwise, you will have toexplicitly SUBMIT the job from the ISPF editor. (See Section 6.1User Options, for information on establishing whether jobs areautomatically submitted when END is used.)

If you do not want to submit the job, use CANCEL to return to theSpecify EXTRACT Parameters and Execute panel. You canmodify the specifications or cancel the extract request from this panel.

If an error is encountered in the job card, a message is displayed. You canreview the job card and correct the error or terminate the Extract Process.

If you save the JCL generated by MOVE to a data set, you can SUBMITthe job directly from the ISPF editor instead of from within a MOVEsession. When you do so, you can override the default Creator ID,selection criteria, and SQL WHERE Clause defined in the AccessDefinition used for the Extract Process. This is especially useful whenseveral extracts are to be performed for a set of tables that vary only byCreator ID or by some set of selection criteria.

You can override these values for batch execution by inserting the DDname PSDFOVRD to point to the desired overrides. The possibleoverrides are DEFCID, SEL, SQL, GROUP, and UNKNOWN.(Examples are presented after the discussion of the overrides.)

To override the Image Copy DSN parameter for BMC UNLOAD PLUS,specify:

BMC_IMAGECOPY_DSN image.file.dsn

To override the Image Copy Date parameter for BMC UNLOAD PLUS,specify:

BMC_IMAGECOPY_DATE yyy-mm-dd

Batch Overrides

BMC_IMAGECOPY_DSN

BMC_IMAGECOPY_DATE

Page 335: Move for DB2 User Guide

5.2 Extract Data

User Manual 321

To override the Image Copy Time parameter for BMC UNLOAD PLUS,specify:

BMC_IMAGECOPY_TIME hh.mm.ss

To override the Image Copy Date Criteria parameter for BMC UNLOADPLUS, specify:

BMC_IMAGECOPY_SELECT [ A | B | L | S]

To override the default Creator ID in the Access Definition, specify:

DEFCID cid

cid The default Creator ID to be used. This applies only totables that are not explicitly qualified in the AccessDefinition.

This override also affects the names of the tables in the relationshipson the Relationship Usage list. If a relationship is not found for theupdated table name, an error occurs when the extract is performed.

Only one DEFCID parameter may be specified for an ExtractProcess.

To override the selection criteria in the Access Definition for a table or tospecify selection criteria for a table that does not have selection criteria inthe Access Definition, specify:

SEL [cid.]table column [ selcriteria ]

cid.table The table name must be specified. If you do not specify theCreator ID (cid.), the default Creator ID defined in the AccessDefinition is assumed.

column The column name must be specified.

selcriteria The selection criteria. This usually begins with an SQLoperator and must conform to the format required on theSpecify Selection Criteria panel (see page 70). Thespecification here is limited to a maximum of 53 characters.

If you do not specify selection criteria, any selection criteriaspecified in the Access Definition is ignored for the currentExtract Process.

Selection criteria can be specified for one or more columns in the table,but when specifying multiple criteria, each must apply to a differentcolumn.

BMC_IMAGECOPY_TIME

BMC_IMAGECOPY_SELECT

DEFCID

SEL

Page 336: Move for DB2 User Guide

5. Data Migration

322 Move for DB2

You can specify only one SEL parameter for each column in a table.You can specify selection criteria overrides for as many of thecolumns in as many of the tables as you want as long as a separateSEL parameter is provided for each column.

To override the SQL WHERE Clause in the Access Definition for atable or to specify an SQL WHERE Clause for a table that does nothave one in the Access Definition, specify:

SQL [cid.]table [ where ]

cid.table The table name must be specified. If you do not specifythe Creator ID (cid.), the default Creator ID defined in theAccess Definition is assumed.

where The SQL WHERE Clause. This must conform to therequirements specified for the Specify SQL WHEREClause panel. However, the keyword WHERE is notrequired and the specification here is limited to amaximum of 425 characters. If you do not specify an SQL WHERE Clause, any SQLWHERE Clause specified in the Access Definition isignored for the current Extract Process.

You can specify the WHERE Clause override for more than one ofthe tables as long as a separate SQL parameter is provided for each.You can specify only one SQL parameter for a table.

To override the Group Selection Processing in the Access Definitionfor the Start Table or to specify Group Selection Processing when ithas not been defined, specify:

GROUP [column VALUES=values ROWS=rows]

column The name of the column in the Start Table for whichGroup Selection Processing is requested. The columnmust exist in the Start Table.

values The number of distinct values to select for the specifiedcolumns.

The value must be in the range 1 and 99999999. Specifyan asterisk to obtain a specific number of rows from alldistinct values of the column. (For additional informationsee Section 3.6 Group Selection Processing.)

rows The number of rows to select for each value of thespecified column.

The value must be in the range 1 and 99999999. Specify

SQL

GROUP

Page 337: Move for DB2 User Guide

5.2 Extract Data

User Manual 323

an asterisk to obtain all rows for each distinct value of theselected column.

Only one asterisk may be specified, therefore an asterisk cannot bespecified for both values and rows.

This specification can be used with most selection criteria. However,the Every Nth specification is ignored.

Specify GROUP with no operands to ignore the Group Selectionspecifications in the Access Definition for the current Extract Process.

To ignore any objects referred to in the Access Definition that do notexist when performing the Extract Process, specify:

UNKNOWN { FAIL | ALLOW }

FAIL Terminate the extract if any tables or relationships namedin the Access Definition are unknown. The report willcontain a message noting the first unknown object. Thisis the default.

ALLOW Bypass the unknown tables and relationships andcontinue with the Extract Process. The report willcontain a message listing the unknown objects.

Since the Extract Process uses existing tables and the existingrelationships between those tables to traverse the database, be awarethat if an unknown table or relationship is bypassed, “related” tablesin the Access Definition may not be included even when these tablesexist.

UNKNOWN ALLOW is most frequently used when you override thedefault Creator ID with DEFCID. Changing the default Creator IDmay result in naming tables that do not exist. The UNKNOWNALLOW parameter enables you to direct the Extract Process to skipthese “unknown” tables.

The following rules apply when specifying these parameters:

• One or more parameters may be specified in the JCL.

• Each parameter keyword must begin in the first space of the line.

• The qualifiers for the parameters must be space separated.

• If a parameter spans multiple lines, continue on the next line.

• You can comment the parameter list by specifying an asterisk, *,in the first position of each comment line.

UNKNOWN

Rules forParameters

Page 338: Move for DB2 User Guide

5. Data Migration

324 Move for DB2

• If multiple selection criteria are specified, they are ANDed orORed based on your response on the Specify Selection Criteriapanel.

• If both an SQL WHERE Clause and selection criteria are specifiedfor an individual table, the clauses are ANDed.

• You can store the parameters in a sequential file or a partitioned dataset. The record length should be 80. If it exceeds 80, only the first80 characters are processed. Sequence numbers are not allowed.

The parameters should conform to the same syntax required whenspecified directly in the jobstream.

To override the default Creator ID and specify selection criteria fortwo of the tables in the extract, insert in the JCL:

//PSDFOVRD DD *DEFCID PSTDEMO2* LIMIT SELECTION TO CUSTOMERS IN NEW JERSEY* WHO HAVE ORDERS FOR WHICH THE* FREIGHT CHARGES EXCEEDED $50.00SEL CUSTOMERS STATE ='NJ'SEL ORDERS FREIGHT_CHARGES >50.00

SEL requires at least one space between the column name and theselection criteria.

1. To override the SQL WHERE Clause for one table in the extract,insert in the JCL:

//PSDFOVRD DD ** LIMIT SELECTION TO CUSTOMERS IN PRINCETON,* NEW JERSEYSQL PSTDEMO2.CUSTOMERS WHERE CITY='PRINCETON' AND STATE='NJ'

2. To specify a sequential file named PST.SAMPLE.PARMS as thesource of the parameter list, insert in the JCL:

//PSDFOVRD DD DSN=PST.SAMPLE.PARMS,DISP=SHR

4. To use an Image Copy file named PST.IMAGE.COPY in anArchive Process utilizing BMC Unload Plus, insert in the JCL:

//PSDFOVRD DD ** CHANGE IMAGE COPY SPECIFICATION TO* A PARTICULAR DATASETBMC_IMAGECOPY_SELECT SBMC_IMAGECOPY_DSN PST.IMAGE.COPYSave JCL

OverrideExamples

Page 339: Move for DB2 User Guide

5.2 Extract Data

User Manual 325

Save JCL

You can save the JCL, modify it and execute the process without re-invoking MOVE. Specify S to the prompt, If Batch, Review or SaveJCL prompt. The following prompts for the information to save the JCL.

. ---------------------------- Save JCL Parameters --------------------------. | | | DSN to Save JCL to ===> | | Member (if PDS) ===> | | | | Submit JCL, or Review? ===> (S-Submit, R-Review, N-Neither) | | Replace Existing Data? ===> (Y-Yes, N-No) | | | | | '---------------------------------------------------------------------------'

Figure 170. Save JCL Options

The following prompts are displayed:

DSN to Save JCL to Name of the dataset to receive the JCL.This can be a sequential file or a partitioneddata set.

If you specify a partitioned data set, specifythe member in the field provided for theMember prompt.

Member (if PDS) Name of the member in the partitioned dataset specified for the DSN prompt. If asequential file is specified and you specify amember name, an error message displays.

Submit JCL or Review? Specify whether the JCL is saved, savedand submitted, or displayed for review.

If you select Submit, the JCL is saved andthe job is submitted.

If you select to review the JCL, use ISPFfacilities to save or submit.

If you select Neither, the JCL is saved, butnot submitted or displayed for review.

Replace Existing Data? Specify whether the generated JCL replacesexisting data in the specified file.

5.2.4.2 UNLOAD PLUS

If UNLOAD PLUS is used, the job can only be executed in batch.However, disregard the error messages and return codes in the BMC

Panel Fields

Page 340: Move for DB2 User Guide

5. Data Migration

326 Move for DB2

report. You should review the Extract Process Report to determinewhether the job executed successfully.

For example, the Extract Process uses UNLOAD PLUS only to read thedata; the data is not written to DDNAME SYSREC. (The Extract Processuses its own facilities to write the data to the Extract File.) Therefore,UNLOAD PLUS sets a return code of 4 to indicate no records werewritten to SYSREC although the Extract Process has performedsuccessfully. As another example, UNLOAD PLUS sets a return code of12 when the Extract Process was successful but terminated prematurelybecause of a user limit for the number of rows from an individual table orfor the number of rows extracted for the entire process.

The Extract Process Report always contains appropriate messages.Usually these messages are sufficient. However, the following messagemay be generated when termination is due to UNLOAD PLUSprocessing.

An Error has been detected by BMC's UNLOAD PLUS.Check the UNLOAD PLUS Message File for Details.

As noted in the message, additional information is provided at the endof the UNLOAD PLUS Message File.

Before invoking UNLOAD PLUS, MOVE checks for errors to ensurethat the selection criteria adhere to the UNLOAD PLUS restrictions.If an error is encountered, MOVE displays a message. Theserestrictions are

1. Expressions before an operator are limited to a single column name.

2. Subselection is not allowed after an operator.

3. Expressions after an operator are limited to a constant or one ofthe following terms: NULL, CURRENT DATE, or CURRENTTIMESTAMP.

4. The EXISTS predicate is not allowed.

Page 341: Move for DB2 User Guide

5.2 Extract Data

User Manual 327

5.2.4.3 Online Execution Status

When an Extract Process is performed online, MOVE provides astatus notification pop-up window. The content of the window variesdepending on whether data and/or object definitions are beingextracted. In the following figure, data is being extracted.

------------------ Specify EXTRACT Parameters and Execute ----------------Command ===>

Extract File DSN Name ===> +--------------------- EXTRACT Process Status ---------------------+ | | | EXTRACT Process in Progress | | | | Total Number of Extracted Rows: 2053 | | | | Completed Table: PSTDEMO.ORDERS Total Rows: 523 | | | +------------------------------------------------------------------+

Figure 171. Extract Process Status

The total number of rows that have been extracted is displayed. Also,the name of the currently processing table and total rows that havebeen extracted from that table are displayed. This is revised:

After every 1000 rows are extracted for each table to displaythe current total number of processed rows.

When the extract for one table is complete and the extract forthe next table begins.

When object definitions are extracted, the status panel includes a listof the object definitions (primary keys and relationships, indexes,etc.), and the status of each as one of the following:

COMPLETED The object definition has been extracted.

IN PROGRESS The object definition has been selected and is inthe process of being extracted.

SELECTED The object definition has been selected but hasnot been extracted yet.

UNSELECTED The object definitions have not been selected.

Page 342: Move for DB2 User Guide

5. Data Migration

328 Move for DB2

5.2.5 Extract Process Report

An EXTRACT Process Report is generated as part of the process.This report contains general information and statistics about theprocess.

The contents of the EXTRACT Process Report can be browsed.When the process is executed online, the EXTRACT Process Reportis automatically displayed.

In batch, the report is placed in the default output file as specified inthe JCL. You can then display the report as you would the outputfrom any job.

The content of the EXTRACT Process Report reflects what has beenextracteddata, object definitions, or both. The report in thefollowing figure indicates that both data and object definitions havebeen extracted.

--------------------------- EXTRACT Process Report -----------------------Command ===> Scroll ===> PAGE ROW 0 OF 27******************************** TOP OF DATA *****************************

EXTRACT Process Report

Extract File : PSTDEMO.SAMPLE.EXTRACT.FILE.DSN Access Definition : PSTDEMO.SAMPLE.CUSTOMERS Created by : COHEND Time Started : 01-15-98 09.52.33 Time Finished : 01-15-98 09.52.45

Total Number of Extract Tables : 4 Total Number of Extracted Rows : 3972 Total Number of First Pass Start Table Rows: 132

Extracted Object Types Number ---------------------- ------ 1 Table List Tables 4 2 Related Primary Keys 4 3 Related Relationships 3 4 Related Indexes 4

Extracted Extract Tables Rows ------------------------ --------- 1 PSTDEMO.CUSTOMERS 132 2 PSTDEMO.ORDERS 792 3 PSTDEMO.DETAILS 2176 4 PSTDEMO.ITEMS 872

******************************* BOTTOM OF DATA ***************************

Figure 172. Extract Process Report Format

The report format includes headings to identify the information.General information is provided. This includes the Extract File name,the Access Definition, the user requesting the extract, and the date andtime the process was executed. This is followed by the statistics forthe extracted object definitions and data.

Display the Report

Report Contents

Report Format

Page 343: Move for DB2 User Guide

5.2 Extract Data

User Manual 329

If object definitions are extracted, the report includes the list of typesof object definitions and the number of each type that have beenextracted. However, if object definitions were not explicitlyrequested, the table definitions are always documented in theEXTRACT Process Report.

If data is extracted, the report includes the total number of tables inthe extract and the combined total number of rows extracted fromthese tables.

The Total Number of First Pass Start Table Rows displays thenumber of rows extracted from the Start Table in the initial pass.This value does not include the number of additional rows that mayhave been extracted in subsequent passes. Subsequent passes of theStart Table may be performed as a result of specifications forprompts Q1 and Q2 on the Specify Relationship Usage panel or RIcycles.

The names of the tables from which data was extracted are listed inthe order in which these tables were listed in the Access Definition.The number of rows extracted from each table is also provided.

If you used the Point-and-Shoot facility or otherwise created a row listto select rows in the Start Table for archiving, some rows may havebeen deleted before the Archive Process was executed. If so, theARCHIVE Process Report lists the primary key values for whichrows were not found.

The list of unmatched primary keys follows the list of Archive Tablesand is formatted like the following example:

3 Rows From Start Table Row List not Found

PSTDEMO.CUSTOMERS 07053 07101 07103

While browsing the EXTRACT Process Report online, you can usethe OUTPUT command to direct the contents of the report to anoutput file or the printer. A panel is displayed prompting for thenecessary information based on the specified output destination. (Fordetails on the OUTPUT command, see the Relational ToolsCommand Reference Manual.)

The report can be scrolled using the ISPF scrolling facilities. You canuse the FIND command to locate a specific table.

Object DefinitionsInformation

Data Information

Unmatched Point-and-Shoot Keys

Print Report

Page 344: Move for DB2 User Guide

5. Data Migration

330 Move for DB2

5.3 Control File Overview

Once the Extract File has been created, you can insert and delete dataand create object definitions using the Extract File as input.

The Extract File can be used by any of the processes listed on theData Migration menu: Insert, DB2 Load, Delete, Create, andConvert. Also, since the Extract File is not modified by theseprocesses, it can be used to perform processes by any number of userssimultaneously. The Extract File ensures a consistent set of data.

To distinguish the execution of multiple MOVE processes by severalusers for the same Extract File, a Control File is generated for eachexecution of an Insert, DB2 Load, Delete and Convert Process. TheControl File is a sequential file that contains information about theprocess parameters. This file also documents the success or failure ofthe processing of each row in the Extract File and whether the processcompleted.

The Control File identifies rows that are not successfully processed.An identifier indicates the reason for the failure. For example, rowsmay not be successfully processed when a request conflicts with RIrules (e.g., a row in a parent table cannot be deleted if children existfor that row and there is a DELETE RESTRICT rule). Based on theinformation in the Control File, you can correct the problem andexecute the process again. For Insert and Delete processing you can"retry" the process such that only the rows that were unsuccessful ordiscarded in the original attempt are processed.

The Control File also notes whether an Insert or Delete processcompleted. When the process does not complete, you can “restart”the process at the point at which it was abnormally terminated. AnInsert or Delete Process can be terminated abnormally when the timeor space resources allocated for the process are insufficient.

Abnormal termination can also occur when the process exceeds theuser-specified limits. For example, the INSERT ProcessParameters and Execute panel prompts for a limit to the number ofrows that are discarded because they cannot be processed. When thenumber of discarded rows reaches the limit set by the parameter,Limit Number of Discarded Inserts, the process terminates.

Extract File

Control File

Retry

Restart

Page 345: Move for DB2 User Guide

5.3 Control File Overview

User Manual 331

A Control File is also generated by the DB2 LOAD Process and theConvert Process. The file documents the success of the process. Thisfile can then be browsed. However, the MOVE DB2 LOAD Processand the Convert Process can not be retried or restarted.

DB2 LOADProcess andConvert Process

Page 346: Move for DB2 User Guide

5. Data Migration

332 Move for DB2

5.4 Insert Process

The Insert Process is used to insert source data and object definitionsfrom an Extract File into a destination database. To perform thisprocess you specify the destination for the source data stored in theExtract File.

If you want to create the object definitions at the destination withoutinserting data, use the Create Process, Option 5 on the DataMigration menu.

5.4.1 INSERT Process Menu

When you select Option 2 on the Data Migration menu, the INSERTProcess menu is displayed.

---------------------------- INSERT Process --------------------------OPTION ===>

1 TABLE MAP - Specify Table Map and Column Maps 2 PERFORM INSERT - Specify INSERT Parameters and Perform INSERT 3 PERFORM UPDATE - Specify UPDATE Parameters and Perform UPDATE

Specify Data Set Names for Extract File and Control File: Extract File DSN ===> 'PSTDEMO.SAMPLE.EXTRACT' Control File DSN ===> 'PSTDEMO.INSERT.CONTROL'

Figure 173. Insert Process Menu

The available options are:

1 TABLE MAP Specify the destination tables for each sourcetable in the Insert Process. A Table Mapmust be specified for Options 2 and 3,therefore if you do not select this option first,MOVE automatically displays the TableMap panel before proceeding with theselected option. When the Table Map isdisplayed, you must specify, at least, thedestination Creator ID, Dest CID, for thedestination tables. By default, MOVEassumes the base destination table names arethe same as the source table names defined inthe Extract File. There is no defaultdestination Creator ID.

Panel Options

Page 347: Move for DB2 User Guide

5.4 Insert Process

User Manual 333

You may specify Column Maps for one ormore destination tables. These ColumnMaps enable you to specify, on a column-by-column basis, the source data for eachdestination column.

2 INSERT Specify the Insert Parameters for the processand perform the Insert. Using this option,only those source rows that do not match anexisting row in the destination table areinserted. If the primary key value of anysource row matches an existing row in thedestination table, the source row is marked asdiscarded in the Control File.

3 UPDATE Specify the Update/Insert Parameters for theprocess and perform the Update/Insert.Using this option, rows that do not match anexisting row in the destination table areinserted. Any matching source rows are usedto update the existing destination rows.

In addition to selecting an option, specify:

Extract File DSN The name of the Extract File containing thesource data to be inserted. This file mustexist. By default, the name of the ExtractFile created by the last Extract Process issupplied. You can specify an explicitname by using quotes to delimit the desiredname; otherwise, the default prefix asspecified on the User Options panel isadded to the name you specify.

Control File DSN Name of a sequential file that is to be usedto accumulate information and statisticsabout the Insert Process. To specify anexplicit name, use quotes to delimit thedesired name; otherwise, the default prefixas specified on the User Options panel isadded to the name you specify.

If the named file exists, the Insert Process willoverlay the contents.

If the named file does not exist, you areprompted for allocation information andthe file is created by MOVE. (SeeAppendix B. Allocating External Filesfor details on allocating the file.)

Page 348: Move for DB2 User Guide

5. Data Migration

334 Move for DB2

The Extract File DSN and the Control File DSN values are profiled.

You can obtain a selection list for either the Extract File or theControl File by specifying the wild cards, * or %, as the last characterin the name. When the list is displayed, use the Select line command,S, to select an entry. A sample of the selection list displayed forExtract File or Control File data set names is provided in Figure 165.Select Extract Data Set on page 311.

The following primary commands are available:

CANCEL END OPTIONS

5.4.2 INSERT Process Table Map

When you select Option 1 from the INSERT Process menu, theINSERT Process Table Map panel is displayed. Use this panel tospecify the destination tables and views.

--------------------------- INSERT Process Table Map -----------------------Command ===> Scroll ===> CSR

Available Commands: APPLY, SAVE, LIST, MAP, POPULATE, END when CompleteDestination may be any DB2 Tables or Views Column Src CID: PSTDEMO Dest CID ===> SOFTECH Map ID ===>

Extract Tables Destination Table Name Type Column Map or "LOCAL"------------------ ---------------------------- ------- -------------------*********************************** TOP ***********************************CUSTOMERS CUSTOMERS TABLEORDERS ORDERS UNKNOWNDETAILS DETAILS VIEW********************************** BOTTOM *********************************

Figure 174. Insert Process Table Map

The fields on this panel include:

Src CID The default Creator ID for the source tables asspecified in the Extract File. This value cannotbe modified.

Dest CID The default Creator ID for the destinationtables. Initially, the field is blank. A validvalue must be specified. Specify the Src CIDas the Dest CID only when you want toreinsert or update the data in the source tablesor when inserting into a different subsystemhaving the same name tables.

Selection List

AvailableCommands

Panel Fields

Page 349: Move for DB2 User Guide

5.4 Insert Process

User Manual 335

Column Map ID 1- to 8-character Map ID. DB2 LIKE syntaxcan be used to display a selection list. If thefield is blank or ‘%’ is specified, a list of mapsfor all Map IDs, as specified in the MAPNAME field, is displayed.

Extract Tables Names of the tables included in the ExtractFile. The Creator ID is included only when itdiffers from the Src CID. These values cannotbe modified.

Destination TableName

Names of the destination tables that correspondto the listed source tables. Initially, MOVEsupplies names for the destination tables thatmatch the source table names.

You can specify other names by overtyping thename in the field or by requesting a selectionlist from which to choose. You can request aselection list using the LIST TABLEScommand and placing the cursor on the field tobe populated.

If you leave a destination table name blank, thedata in the Extract File from the correspondingsource table is ignored for the current InsertProcess.

Type The type of the object named in theDestination Table Name field. MOVEsupplies this value and it is not modifiable.The possible values are:

TABLEVIEWUNKNOWNA-TABLEA-VIEWS-TABLES-VIEWUNUSED

TEMPTBL

A tableA viewNon-existent or initial displayAn alias of a tableAn alias of a viewA synonym of a tableA synonym of a viewA destination table is notspecified.Temporary table

MOVE automatically creates any destinationtable that is UNKNOWN. You are promptedfor the required information before the processis performed.

Page 350: Move for DB2 User Guide

5. Data Migration

336 Move for DB2

Column Map or"LOCAL"

Specify the name of a Column Map to be usedto insert the data into the destination table. If aColumn Map ID is not specified, specify thefully qualified Column Map Name.

Specify LOCAL to define a Column Map forthe current Insert Process only.

Specify the Column Map names manually orrequest a selection list using the LIST MAPScommand. If you leave the field blank, aColumn Map is not used.

You can use the POPULATE command toinsert the name of the Column Map in thisfield.

If you specify a new Column Map name orLOCAL, MOVE assumes you want to definethe Column Map and automatically invokes theColumn Map editor. To edit an existingColumn Map, use the MAP command.

The LIST command is available for aliases, maps, synonyms, tables,and views. For example, to obtain a selection list of available tables,use the command LIST TABLES and position the cursor to thedestination table name you want to supply. A selection list ofavailable tables with the destination Creator ID is displayed. You canoverride the destination Creator ID with the LIST TABLES commandas in LIST TABLES SMITH.%.

To insert a table name, type the number of the DB2 Table in the Numfield next to the destination table name in the selection list. You mayselect any number of tables from the list at one time. MOVEautomatically places the selected name in the Destination TableName field with same number.

You can use the APPLY command to populate the Table Map withthe specifications from a previously defined Table Map. If the sourcetables in the process match the source tables in the Table Map,MOVE populates the destination tables from the existing Table Map.APPLY can be specified to populate all table names and the Dest CIDregardless of any entry, or populate only the blank fields.

MOVE automatically revises the Type each time you modify adestination table name. If you modify the Dest CID, any tables thatare specified without an explicit Creator ID automatically use the newDest CID. This may change the Type value and require review.

Selection List ofDestinationObjects

Use Existing TableMap

Destination TableType

Page 351: Move for DB2 User Guide

5.4 Insert Process

User Manual 337

For example, assume the Dest CID is SOFTECH and theDestination Table Name is CUSTOMERS. The resultant tablename is SOFTECH.CUSTOMERS. However, when the Dest CID ischanged to COHEND, the table name becomesCOHEND.CUSTOMERS and may be unknown. MOVE prompts forthe information to create the table COHEND.CUSTOMERS beforeperforming the Insert Process. (This prompt is displayed prior toentry onto the INSERT Process Parameters and Perform panel.)You can explicitly supply the Creator ID with the Destination TableName. Then, changing the Dest CID does not affect the table name.

Duplicate table names are not allowed. Therefore, the same tablename cannot be specified twice as a destination table.

The following commands are available on this panel:

APPLYBOTTOM

DOWNEND

MAPOPTIONS

SAVETOP

CANCEL LIST POPULATE UP

See the Relational Tools Command Reference Manual for details onthese commands.

Section 4.4 Table Maps provides detailed information on definingand storing Table Maps. Section 4.3 Column Maps providesdetailed information on defining Column Maps.

5.4.3 Perform Insert and Update/Insert Process

The distinction between performing an Insert Process or anUpdate/Insert Process is important. The difference rests on howexisting rows in the table are processed when inserting rows that havematching primary key values.

When the primary key value of the source row does not already existin the destination table, there is no conflict and the row is inserted.However, when the primary key value of the source row already existsin the destination table, Insert and Update/Insert perform differently.If you select Insert, the source row is marked as discarded and is notinserted. If you select Update/Insert, the source row replaces orupdates the existing row.

For example, you may want to avoid blindly updating existing rowswith duplicate primary key values. You can specify Insert to identifyall of the rows that are not unique, then review the Extract File usingthe Browse Extract File option to determine which rows wereduplicates and take action based on your findings. You can delete

AvailableCommands

More Information

Page 352: Move for DB2 User Guide

5. Data Migration

338 Move for DB2

specific destination rows in the database to avoid these conflicts andretry the Insert Process. (For details on the Retry Process, seeSection 5.9 Retry/Restart Process.)

When the primary key for the source data is defined in the PSTDirectory and is not unique, more than one row in the Extract Filemay exist with the same primary key value. If this data is then usedto Insert or Update/Insert into a destination table defined with aunique primary key, only the first row with that primary key value inthe Extract File is processed.

The additional rows are not processed and are identified as such in theControl File.

When the primary key for the destination table is also defined in thePST Directory and is not unique, more than one row in the destinationtable may exist with the same primary key value. For Insertprocessing, the rows in the Extract File are inserted. ForUpdate/Insert, the processing is performed as follows:

• If the Extract File contains only one row with a particularprimary key value, only one destination row is updated. Whenmultiple rows with the same primary key are present in thedestination table, it is indeterminate which of the existing rowswill be updated.

• If the Extract File contains multiple rows with the same primarykey, a different destination row is updated with each row in theExtract File. That is, a single destination row is updated oncealthough it is indeterminate which row is updated with a specificrow from the Extract File. When the Extract File contains morerows with the non-unique primary key than are present in thedestination table, the additional rows are inserted.

When Insert or Update/Insert should be used is determined by theresults you want to obtain. Use Insert to insert only new rows andUpdate/Insert to insert new rows and update existing rows. You canalso request that the rows in the destination table are deleted prior toperforming an Insert. This enables you to recreate the original set oftest data exactly.

Non-UniquePrimary Keys

Page 353: Move for DB2 User Guide

5.4 Insert Process

User Manual 339

When you select Option 2 or 3 from the INSERT Process menu, thefollowing panel is displayed to prompt for the parameters needed toperform the Insert Process. (Note, most of the information requiredfor Option 2 and 3 is the same. Only Insert enables you to deleterows at the destination prior to performing the insert and the title onthe panel is different to reflect whether an Insert or an Update/Insertprocess is to be performed.)

----------------------- Specify INSERT Parameters and Execute ---------------Command ===>

Names for Extract File and Control File: Extract File DSN : SAMPLE.PST.INSERT.DATA Control File DSN : EXTRACT.CTRL

Process Options: Delete All Rows in Target Tables ===> N (Y-Yes, N-No) If YES, Commit Frequency ===> T (T-After Each Table, E-At End)

Age Date Values ===> N (Y-Yes, N-No) Lock Tables During Process ===> N (Y-Yes, N-No) Commit Every Nth Row ===> ____ (1-1000, Blank-Site Limit) Limit Number of Discarded Rows ===> _______(1-999999, Blank-No Limit) Review Propagation Key Sets ===> A (A-Always, E-Errors) Run Process in Batch or Online ===> O (B-Batch, O-Online) If Batch, Review or Save JCL ===> (N-No, R-Review, S-Save)

Figure 175. Specify INSERT Parameters and Execute

The fields on this panel include:

Extract File DSN Name of the Extract File that contains thesource data as specified on the INSERTProcess menu. This value cannot be modifiedon this panel.

Control File DSN Name of a sequential file that is to be used toaccumulate information and statistics aboutthe Insert Process as specified on the INSERTProcess menu. This value cannot be modifiedon this panel.

Delete All Rows inTarget Tables

Specify whether all rows in the destinationtables are to be deleted prior to performing theInsert Process. By deleting the rows prior tothe Insert, you can obtain a set of data thatexactly matches the data in the Extract File.Specify:

Y

N

Delete is performed.

Delete is not performed.

Insert ParametersPanel

Panel Fields

Page 354: Move for DB2 User Guide

5. Data Migration

340 Move for DB2

If YES, CommitFrequency

If rows are to be deleted, specify the frequencywith which commit is performed during thedelete as one of the following:

T Commit after deleting the rows fromeach table.

E Commit after deleting the rows from allof the tables.

Age Date Values Specify whether date values are to be aged aspart of this process. Specify:

Y Date values are to be aged. The SpecifyAging Parameters panel is displayed.On this panel, specify aging values to beused. These values supplement thespecifications for columns mapped withAGE and FUTURE_YEAR functionsand are used, if requested, to age DATEand TIMESTAMP columns not explicittargets of an AGE or FUTURE_YEARfunction.

For any column mapped withFUTURE_YEAR(DEF) note that if youspecify an explicit year for the agingvalue on the Specify Aging Parameterspanel, only the year portion is applied tothe column. If you specify values to ageincrementally or semantically, thecolumn is ignored.

N Date values are not to be aged. Thespecifications for aging on the ColumnMaps included in the process areignored.

Additional information about the SpecifyAging Parameters panel is provided on page342.

Lock Tables DuringProcess

Specify whether the entire table is to be lockedduring an Insert Process. Locking the tableensures that other database activity does notinterfere with the Insert Process. It will,however, prevent other users from accessingthe table.

Page 355: Move for DB2 User Guide

5.4 Insert Process

User Manual 341

If you specify YES, a commit is performedonly when MOVE has completed processing atable. This is because a commit causes thetable lock to be relinquished. Site management has the option to establishthat tables are not to be locked during Insert.If so established, this option is set to NO andcannot be modified.

Commit Every NthRow

Specify the frequency of commits. Thecommit points will affect the starting point incase of a RESTART. Frequent commits willkeep page locks to a minimum. Specify:

1-999999 Absolute value to determinecommit point.

Blank Site limit.

Note, this option has no effect if the promptfor Lock Tables During Insert is YES. Thenthe commit is performed when the processingfor a table is completed.

The figure shows the distributed default valueof 1000. The site-defined limit is displayed atyour site to indicate the maximum value youmay specify.

Limit Number ofDiscarded Rows

Specify a limit to the number of rows that canbe marked as discarded. If that limit is met,the process is terminated. You can useRESTART to begin the process at thetermination point. Specify:

1-999999 Terminate the process when amaximum number of rows arediscarded.

Blank No limit.

To terminate the process if any rows arediscarded, specify 1.

Review PropagationKey Sets

Specify whether the Propagate Key Set(s)panel is to be displayed before the InsertProcess is performed. This option is onlydisplayed when the PROP function has beenspecified in one or more Column Maps usedby the Insert Process. Specify:

Page 356: Move for DB2 User Guide

5. Data Migration

342 Move for DB2

A To always display the panel prior toperforming the process.

E To display the panel prior to performingthe process only when the PROPspecifications contain errors. Default.

Run Process in Batchor Online

Specify whether the Insert Process is to be runin batch or online. Specify:

B Batch

O Online

If site management has established a maximumnumber of rows for online processing and thisInsert Process request exceeds that limit, thisoption is set to Batch and cannot be modified.

If Batch, Review orSave JCL

Specify whether JCL is reviewed prior to jobsubmission. This is specified for batchexecution only. Since the JCL is displayed inthe ISPF editor, you can modify it for thecurrent request and save it to submit later.Specify:

N Submit job, do not display or save theJCL.

R Display the JCL for review prior to jobsubmission.

S Save the JCL. Prompts are provided foryou to specify the name of a file inwhich to store JCL.

The available primary commands include:

CANCEL END OPTIONS

Age Date Values

When you specify Y to the prompt Age Date Values, the SpecifyAging Parameters panel is displayed. The Specify AgingParameters panel prompts for the values used to age date values.Date values are identified in Column Maps using the AGE functionand the FUTURE_YEAR function. The values specified on theSpecify Aging Parameters panel are used when explicit values arenot defined with the function in the Column Map. All explicit valuesoverride any specifications on this panel. (For details about the AGE

AvailableCommands

Page 357: Move for DB2 User Guide

5.4 Insert Process

User Manual 343

and FUTURE_YEAR functions, see Section 4.3.7 SpecifyingSource for Destination Columns.)

You have the option of applying these values to DB2-defined DATEand TIMESTAMP columns also.

-------------------------- Specify Aging Parameters ---------------------------Command ===>

Aging Specification Explicit Date ===> YYYY/MM/DD

Or INCREMENTAL, Years ===> (-2500 to +1581) Months ===> (-30000 to +30000) Weeks ===> (-30000 to +30000) Days ===> (-99999 to +99999) Business Rules ===> (0 to 30000) Or TARGET DATING, Base Date ===> YYYY/MM/DD (Default:Today) Target Date ===> YYYY/MM/DD

Default Aging Rule Table ===> (Default: PSAPRULE)Default Aging Rule ===>Century Pivot Year ===> (00 - 99)Process Date Columns ===> (A-All, U-User Defined)Report Invalid Dates ===> (Y-Yes, N-No)Report Skipped Dates ===> (Y-Yes, N-No)Output Rows w/ Invalid Dates ===> (Y-Yes, N-No)Output Rows w/ Skipped Dates ===> (Y-Yes, N-No)

Figure 176. Specifying Aging Parameters

The fields on this panel include:

Explicit Date Specify an explicit date for aging. The datemust be in the form YYYY/MM/DD orYYYY/DDD (a Julian date). The aging rule isapplied to this date.

Years Adjust the date by a number of years.

+nnnn-nnnn

Increment or decrement the value in thecolumn by the year specified as a oneto four digit value in the range -2500to +1581.

A plus sign or a minus sign precedingthe value indicates whether the date isto be incremented or decremented.Increment is the default.

Panel Fields

EXPLICIT

INCREMENTAL

Page 358: Move for DB2 User Guide

5. Data Migration

344 Move for DB2

Months Adjust the date by a number of months.

+nnnnn-nnnnn

Increment or decrement the value in thecolumn by the number of monthsspecified as one to four digit number inthe range -30000 to +30000.

A plus sign or a minus sign precedingthe value indicates whether the date isto be incremented or decremented.Increment is the default.

Weeks Adjust the date by a number of weeks.

+nnnnn-nnnnn

Increment or decrement the value in thecolumn by the number of weeksspecified as one to four digit number inthe range -30000 to +30000.

A plus sign or a minus sign precedingthe value indicates whether the date isto be incremented or decremented.Increment is the default.

Days Adjust the date by a number of days.

+nnnnn-nnnnn

Increment or decrement the value in thecolumn by a number of days specifiedas a one to four digit number in therange -99999 to +99999.

A plus sign or a minus sign precedingthe value indicates whether the date isto be incremented or decremented.Increment is the default.

Business Units Specify the date adjustment by “business” units.

nnnnn Adjust the value in the column by anumber of occurrences of the specifiedbusiness rule date. This number isspecified by a one to four digit value inthe range 0 to 30000. Incrementing anddecrementing is controlled by the rule.

For example, if the Aging Rule is specified asNEXTPAYDAY, the date is adjusted by thespecified number of paydays. Therefore, a 4 in thefield, adjusts the date to the fourth payday after the

Page 359: Move for DB2 User Guide

5.4 Insert Process

User Manual 345

date value in the column.

You can specify either calendar units (years,months, weeks, and days) or business units, notboth.

Base Date Specify an explicit date as the origination orstarting date for calculating the aging amount.The date must be in the form YYYY/MM/DD orYYYY/DDD (a Julian date). If you leave the fieldblank, the current date, is assumed.

Target Date Specify an explicit date as the target forcalculating the aging amount. The date must be inthe form YYYY/MM/DD or YYYY/DDD (aJulian date).

The aging amount is determined by the differencebetween the Base Date and the Target Date.

You must specify a value for only one of the three aging methods:EXPLICT, INCREMENTAL or TARGET DATING.

For INCREMENTAL aging, the combined values of Years, Months,Days, and Weeks cannot result in a year value greater than 3999. Ifthe value for year does exceed 3999, an error occurs when youattempt to age the data and you receive a message indicating the datacannot be aged.

Default AgingRule Table

Specify the name of the aging rule table to be used.If blank, the site default aging rule table is used.

Default AgingRule

Specify the default aging rule to be used for anydate column not explicitly assigned an aging rule.This must be one of the values in the aging ruletable or blank.

To display a selection list of rules in the currenttable, specify an asterisk as the first or onlycharacter in the field. The selection list displays thename of the rule and a brief description. Use S toselect a rule. (For details about aging rule tables,see the Relational Tools Installation andAdministration Guide.)

If this field is blank, an aging rule is not applied toany aged data that is not explicitly assigned a rule.

Century Pivot Indicates the year for determining which century toapply to two-digit year values. For example,

TARGET DATING

Other Parameters

Page 360: Move for DB2 User Guide

5. Data Migration

346 Move for DB2

Year assume the value is 65. All two-digit years that are65 or over are assumed to be in the 20th century(19xx); all two-digit years that are less than 65 areassumed to be in the 21st century (20xx). Thisinformation is necessary to properly age the data.Specify a two-digit value from 00 to 99.

If a value is specified for Pivot Year for anindividual column, the Century Pivot Year value isignored for that column.

Process DateColumns

Specify whether all date columns (those identifiedas dates by function or as a DB2 DATE orTIMESTAMP column) or only those identified byfunction are to be aged. Specify:

A All DATE and TIMESTAMP columns andthe columns mapped to AGE andFUTURE_YEAR are aged.

U Only columns mapped to AGE orFUTURE_YEAR are aged.

If a Column Map is not defined orFUTURE_YEAR or AGE is not specified on theselected Column Map, these date values apply onlyto DATE and TIMESTAMP columns, if yourespond A to this prompt.

Report InvalidDates

Specifies whether details of the invalid datesencountered during the aging step of the process arelisted in the process report.

Report SkippedDates

Specifies whether details of the skipped datesencountered during the aging step of the process arelisted in the process report. (Dates are skippedwhen they cannot be aged because the value is not avalid date but has special meaning to theapplication. For example, “000000” or “999999”are not valid dates but may be special indicators forthe application. Other examples of skipped datesare those containing only spaces, hex zeroes, or hex‘FF’.

For a comprehensive list of values that are handledas skipped fields, see Appendix G.

Output Rows Specifies whether the rows with invalid dates are

Page 361: Move for DB2 User Guide

5.4 Insert Process

User Manual 347

with Invalid Dates written to the destination database.

Output Rowswith SkippedDates

Specifies whether the rows with skipped dates arewritten to the database. For a comprehensive list ofvalues that are handled as skipped fields, seeAppendix G.

When you have completed the aging parameter specifications, useEND to proceed with the Insert Process.

View PROP Specifications

The Propagating Key Set(s) panel is displayed based on yourspecification to the prompt Review Propagation Key Sets. Whenyou specify A to the prompt or E and errors are encountered, thepanel is displayed. This panel groups the tables affected by a singlePROP function together and identifies the table for which the PROPfunction is specified. The specifications for determining the value topropagate are also displayed. (For details on specifying the PROPfunction on the Column Map, see page 246.)

The following figure demonstrates:

• The literal “JONES” defined in the ORDERS table is to bepropagated to the SALES and CUSTOMERS tables.

• The value for the CUST_ID column in the CUSTOMERS table isto be assigned sequence numbers starting with 1 and incrementedby 1. This value is then propagated to the ORDERS table.

• The value in the ORDER_ID column of the ORDERS table is to bepropagated to the DETAILS table.

This ensures that MOVE does not insert child rows inappropriately.Note that if the propagated primary key value duplicates an existingvalue, that row is discarded. MOVE then discards the rows fromrelated tables whose foreign key columns contain the propagatedvalue. Therefore, if changing the CUST_ID in CUSTOMERScauses a duplicate row, the related ORDERS rows are discarded.

Page 362: Move for DB2 User Guide

5. Data Migration

348 Move for DB2

However, to ensure that the related DETAILS rows are alsodiscarded, specify propagate for the ORDER_ID column used torelated ORDERS and DETAILS.

--------------------------- Propagating Key Set(s) ---------------------------- Command ===> Scroll ===> CSR ROW 0 OF 11******************************** Top of Data **********************************Press PF12 to cancel. Press END to continue.

Set No. Table Name Column Column Map Specification ------ -------------------------- ----------------- ------------------------

Set:1 PSTDEMO.SALES SALESMAN_ID PSTDEMO.CUSTOMERS SALESMAN_ID PSTDEMO.ORDERS *ORDER_SALESMAN 'JONES'

Set:2 PSTDEMO.CUSTOMERS *CUST_ID SEQ(1,1) PSTDEMO.ORDERS CUST_ID

Set:3 PSTDEMO.ORDER *ORDER_ID ORDER_ID PSTDEMO.DETAILS ORDER_ID******************************* Bottom of Data ********************************

Figure 177. Propagating Key Set(s)

The fields on this panel are:

Set No Number of the set of tables included in the propagationspecification.

Table Name Names of the tables affected by the propagation. Thesetables are listed from parent to child.

In the figure, in Set 1, propagate is specified on a childtable, ORDERS. In Set 2 and Set 3, it is specified on theparent, CUSTOMERS for Set 2 and ORDERS for Set 3.

Column Name of the column that is the target of the propagation.The column for which the PROP function is specified isidentified by an asterisk (*).

Column MapSpecification

Specification in the Column Map of the value to bepropagated.

If all the propagate specifications do not fit on the panel, you canscroll the display.

Use END to perform the process.

To cancel the process request and return to the Specify INSERTParameters and Execute panel, press PF12. It has been assignedthis special use on this panel only. MOVE automatically restoresyour ISPF values when the Propagating Key Set(s) panel is exited.

Panel Fields

Perform Process

Exit withoutPerform

Page 363: Move for DB2 User Guide

5.4 Insert Process

User Manual 349

Discarded Rows

When MOVE is inserting data, rows may be discarded in two ways:

Immediate discards -During the Insert Process, a row is immediately discardedif a condition exists that cannot be rectified by MOVE.For example, the primary key value for the row alreadyexists in the destination table.

Pending discards -A pending discard occurs when the row cannot beinserted at the present time, but the condition preventingthe insert may not exist later in the Insert Process. Theserows fail the Insert but are held in a pending status whileprocessing continues. As the Insert request proceeds,MOVE will attempt to insert these pending rows one ormore additional times.

This occurs only when there are referential integritycycles. An RI rule may prevent a row from being addedbecause it references another row that is not present in arelated table.

For example, you may not be able to add an ORDERSrow that contains a customer ID for a CUSTOMERSrow that does not exist in the CUSTOMERS table. Laterin the processing, the related CUSTOMERS row isadded. When MOVE re-tries the insert on the pendingORDERS row, the insert completes successfully.

It cannot be determined whether pending discards will bediscarded until the end of the Insert Process. Therefore,there could be many more discarded rows than thediscard limit. For example, assume the discard limit is10. There are 5 immediate discards, but during the Insertthere are 100 pending discards. If all of those pendingdiscards are inserted sometime during the process, thenthe number of discards, 5, is well within the limit. If,however, only 50 of the pending discards are inserted,then the number of discards is 55 and well above the limitbut this cannot be determined until the processterminates.

Each time MOVE completes the Insert Process for a table, it issues aCOMMIT statement. This occurs even when MOVE is processing acycle and will return to a table later in the Insert Process. Thatmeans, table locks are held only during the time MOVE is processinga table. When processing switches to another table, the COMMIT

Commits duringcycles

Page 364: Move for DB2 User Guide

5. Data Migration

350 Move for DB2

causes the table lock to be relinquished. If that table is processedagain, the lock is re-established.

Before starting the Insert Process, MOVE checks for anyUNKNOWN destination tables. If any destination tables areUNKNOWN, MOVE displays the CREATE Object List panel witha message indicating that the unknown tables must be created. Allobject definitions in the Extract File are included. Those objectdefinitions that do not exist, are identified. Assume three tables andtheir primary keys, relationships, and indexes are included in theExtract File. Also assume that the ORDERS table is UNKNOWN atthe destination and the other two tables exist.

The following panel is displayed:

----------------------------- CREATE Object List ------ CREATE MISSING TABLESCommand ===> Scroll ===> CSR

Primary Commands: CREATE ALL, DEFAULTS, SHOW Line Commands: S, U, CR(A), DR, DB2, PST, SQL 1 of 10

Cmd Status Type Object Name Database Tablespace--- -------- --------- ------------------------------ -------- ----------*** ********************************* TOP **********************************___ SELECT TABLE SOFTECH.ORDERS DSOFTECH SSOFTCH2___ SELECT INDEX PSTDEMO.XORDERPK___ SELECT PK(DB2)___ SELECT FK(DB2) RCO___ EXISTS TABLE SOFTECH.CUSTOMERS DSOFTECH SSOFTCH1___ EXISTS INDEX PSTDEMO.XCUSTPK___ EXISTS PK(DB2)___ EXISTS TABLE SOFTECH.DETAILS DSOFTECH SSOFTCH1___ EXISTS INDEX PSTDEMO.XORDETPK___ EXISTS PK(DB2)**** ******************************** BOTTOM *******************************

Review SQL Before Create ===> _ (Y-Yes, N-No)

Figure 178. CREATE Object List when UNKNOWN DestinationTables

The UNKNOWN table and its subordinate objects are identified bythe SELECT status. (For this example, it is the first table listed in thefigure.) The tables and other objects that exist at the destination areidentified by the EXISTS status.

To create any table in SELECT status, a Database Name is required;a Table Space Name is optional. If you do not explicitly specifyvalues, MOVE will use default values if they have been established.If a default is not specified for the database name and you do notsupply a value, MOVE will prompt for a database name. If a defaultis not specified for the table space name and you do not supply avalue, the table space name is automatically generated based on thetable name.

Prompt to CreateTable

Page 365: Move for DB2 User Guide

5.4 Insert Process

User Manual 351

You can establish default values for the database name and the tablespace name using Option 5 Create Process on the Data Migrationmenu or use the DEFAULTS command. Either displays a menu fromwhich you select the defaults you want to establish. See Section 5.7Create Process for more information on specifying defaults.

You can select and unselect individual objects using the Select linecommand, S, and the Unselect line command, U. Any unselectedobject definitions are assigned the status UNSEL and are not includedwhen the SQL to create the objects is generated by MOVE.

You can scroll the list using the UP, DOWN, TOP, and BOTTOMcommands.

You can use the CREATE ALL command to direct MOVE togenerate and execute the SQL DDL statements necessary to create thetable and other objects that have the SELECT status. Alternatively,you can use the CR line command to create selected objectsindividually or the CRA line command to create a table and theobjects related to it.

You can display the generated SQL statements prior to execution byspecifying Yes to the prompt Review SQL. (This prompt is providedafter the last object on the list.) The SQL statements are displayed inthe ISPF editor and may be saved or edited as desired. The SQL isexecuted when you use END. Use CANCEL to abandon executingthe SQL.

For more information on the CREATE Object List panel, seeSection 5.7.4 Perform Create Process on page 406. This panel isalso displayed when you explicitly request the PERFORM option ofthe Create Process and the details of this panel are discussed in thatsection.

If the missing tables are successfully created, the Insert Processproceeds to load the data after the SQL is executed. (If objects arenot created, the Insert Process cannot proceed and a message isdisplayed. If you do not want to create the missing tables, you canremove their names from the Destination Table Name field on theINSERT Process Table Map panel.)

Establish Defaults

Select Objects

Create Objects

Review SQL

Details aboutCreating Objects

Inserting Data

Page 366: Move for DB2 User Guide

5. Data Migration

352 Move for DB2

If the Insert Process is executed online, a panel is displayed noting theprogress of the process.

----------------- Specify INSERT Parameters and Execute -----------------COMMAND ===>

Data Set Names for Extract File and Control File:Extract File DSN : SAMPLE.PST.INSERT.DATA

Pr +----------------------- INSERT Process Status ----------------------+ | | | INSERT Process in Progress | | | | Number of Rows Processed: 2053 of 10340 | | Completed Table: PSTDEMO.CUSTOMERS Inserted Rows: 523 | | Failed Rows: 0 | | | +--------------------------------------------------------------------+

Figure 179. Insert Process Status

The total number of rows that have been inserted out of the totalnumber of rows to be inserted is displayed. Also, the name of thecurrently processing table and total rows that have been inserted forthat table are displayed. This is revised:

Every 1000 rows for each table to display the current totalnumber of processed rows.

When the processing for a table is complete and theprocessing for the next table begins.

If you specify batch execution, MOVE builds the necessary JCL. TheJOB card information is taken from the JCL specified on the JobCard and Print Options panel.

If you specified YES to the Prompt for Changes Before JobSubmission prompt on the Job Card and Print Options panel, thedefault Job card, as specified on that panel, is displayed prior to jobsubmission. You may edit the Job card and print options and specifywhether your changes are to apply only to the current job submissionor to be applied permanently. (See Section 6.3 Job Card and PrintOptions.)

The information on the Job Card and Print Options panel is used,along with the Insert parameters, to build the JCL required to performthe Insert Process. If you specify Review to If Batch, Review orSave JCL on the Specify INSERT Parameters and Execute panel,the entire JCL is displayed in the ISPF editor. This JCL can be editedand saved.

If you have responded Save to If Batch, Review or Save JCL, youare prompted for the name of the file in which to save the JCL and

Online Execution

Batch Execution

Page 367: Move for DB2 User Guide

5.4 Insert Process

User Manual 353

whether the job should be submitted after saving the JCL. (Detailsare discussed later in this section.)

END is used to return from the ISPF editor to MOVE, however yourspecification for the prompt, Submit Jobs with END on the UserOptions panel, determines whether the job is automatically submitted.If you specify NO to the prompt, you must submit the job explicitlyfrom the ISPF editor using the SUBMIT command.

If you specify YES, the job is automatically submitted. Use theCANCEL command to return to the Specify INSERT Parametersand Execute panel without submitting the job. You can modify thespecifications or cancel the insert request from this panel.

(See Section 6.1 User Options, for information on establishingwhether jobs are automatically submitted when END is used.)

If you submit the job and an error is encountered in the Job Card, amessage is displayed. You can review the Job Card and correct the erroror terminate the Insert Process.

If you save the JCL generated by MOVE to a data set, you can SUBMITthe job directly from the ISPF editor instead of from within a MOVEsession. When you do so, you can override the default destination CreatorID defined in the Table Map used for the Insert Process. This is especiallyconvenient when you want to apply different Extract Files to a single set oftables or a single Extract File to multiple sets of tables using commonInsert Process JCL.

Any Extract File can be used in an Insert Process as long as at least one ofthe table names on the file matches one of the table names on the TableMap. The Creator IDs do not have to match. If any table does not matchon the Table Map, it is not included in the process.

You include the overrides by inserting the DD name PSDFOVRD in theJCL followed by the overrides.

To override the default destination Creator ID specified on the Table Mapspecify:

DEFCID cid

where cid is the default Creator ID to be used. This applies only todestination tables that are not explicitly qualified in the Table Map.Only one DEFCID parameter may be specified for an Insert Process.

To override the year processing criteria defined for the Insert Processspecify:

YEAR year [A|S ]

Batch Overrides

Creator ID

Year

Page 368: Move for DB2 User Guide

5. Data Migration

354 Move for DB2

year The value to be inserted into the year portion of DATEand TIMESTAMP columns.

Specify:

nnnn Four-digit absolute numeric value.

+nnn Value in the range of 1 through 999 to incrementthe year value.

-nnn Value in the range of 1 through 999 to decrementthe year value.

0 Ignore date processing parameters for the currentInsert Process.

A | S Specifies whether all columns or only columns identifiedin a Column Map are affected.

A All DATE and TIMESTAMP columns notspecifically mapped in a Column Map areaffected.

S Columns mapped to the FUTURE_YEAR(DEF)function are affected. (If a value has not beenspecified, S is the default.)

With release 3.0, the YEAR override is being replaced with a set ofpowerful data aging overrides. However, it is included to ensureupward compatibility with previous releases. Although YEAR iscurrently supported for Extract Files created with release 2.5, it is notsupported for Extract Files created with release 3.0 and greater. Tooverride the date value, check the overrides provided for date aging.

To override the date aging specifications for the Insert Process specifyone or more of the following:

AGE_AMT_YEAR For incremental aging, the amount toincrement by years.

AGE_AMT_MONTH For incremental aging, the amount toincrement by months.

AGE_AMT_WEEK For incremental aging, the amount toincrement by weeks.

AGE_AMT_DAY For incremental aging, the amount toincrement by days.

Date Aging

Page 369: Move for DB2 User Guide

5.4 Insert Process

User Manual 355

The value must be numeric. Specifywhether the value increments (+) ordecrements (-). Increment is the default.For example, +15 or 15 increments thedates and -15 decrements the dates.

The combination of AGE_AMTparameters specifies the aging.

• To specify an explicit date, specify avalue for YEAR that is greater than orequal to 1582. Then, values must bespecified for MONTH and DAY todefine an explicit date. (A value forWEEK is invalid for an explicit date.)

• To specify a date other than an explicitdate, you can specify values for any orall of the units. The valid ranges forthe values are:

YEAR -2500 to +1581MONTH -30000 to +30000WEEK -30000 to +30000DAY -99999 to +99999

AGE_AMT_RULE For incremental aging, the amount ofoccurrences of an aging rule to increment.For example, assume the specified rule isNEXTPAYDAY, specify 4 to age to thefourth payday from the current date in thecolumn.

AGE_BASE_DATE Specify a base date used by MOVE todetermine the difference between this valueand the AGE_TARGET_DATE. Thedifference is used as the number of days toage the data.

This must be specified in the format:

yyyy/mm/dd or yyyy/ddd

The current date is the default.

AGE_TARGET_DATE Specify the target date used by MOVE todetermine the difference between this valueand the AGE_BASE_DATE. Thedifference is used as the number of days to

About AGEParameters

Page 370: Move for DB2 User Guide

5. Data Migration

356 Move for DB2

age the data.

This must be specified in the format:

yyyy/mm/dd or yyyy/ddd

This is required if AGE_BASE_DATE isspecified.

TABLE Specifies the name of the aging rule table tobe used. Specify the name of a validpartitioned data set member.

AGE_RULE Specifies the default aging rule to be usedfor any date field not explicitly assigned anaging rule. Specify any of the values in theaging rule table specified for the TABLEstatement. (For more information about theaging rule table, see the Relational ToolsInstallation and Administration Guide.)

If not specified, no aging rule is applied.

PIVOT_YEAR Indicates which century to apply to two-digit year values. This information is usedfor aging rules and to provide the century inthe output if so formatted.

Specify a two-digit value from 00 through99. This value determines the threshold. Ifnot specified, a pivot year is not used.

For example, assume the value is 65. Alltwo-digit years 65 or over are assumed tobe in the 20th century (19xx); all two-digityears that are less than 65 are assumed tobe in the 21st century (20xx).

LIST_INVALID Specifies whether details of the invaliddates encountered during the aging arelisted at the top of the process report.

Specify Y to list the details or N to not listthem. The default is Y.

LIST_SKIPPED Specifies whether details of the skippeddates encountered during the aging arelisted at the top of the process report.(Dates are skipped when the date cannot beaged because the value is not a valid date

Page 371: Move for DB2 User Guide

5.4 Insert Process

User Manual 357

but has special meaning to the application.

For example, “000000” or “999999” are notvalid dates but may be special indicators forthe application. Other examples of skippedfields are those containing only spaces, hexzeroes, or hex ‘FF’.

Specify Y to list the details or N to not listthem. The default is Y.

PUT_INVALID Specifies whether the rows with invaliddates are written to the database.

Specify Y to write the rows or N to notwrite them. The default is Y.

PUT_SKIPPED Specifies whether the rows with skippeddates are written to the database. SpecifyY to write the records or N to not writethem. The default is Y.

PROCESS_DATE_COLUMNS Specifies whether date columnsnot explicitly mapped are to beaged.

To ignore any tables referred to in the Table Map that do not existwhen performing the Insert Process, specify:

UNKNOWN { FAIL | ALLOW }

FAIL Terminate the insert if any tables or relationships namedin the Extract Process are unknown. The report willcontain a message listing the first unknown object. Thisis the default.

ALLOW Bypass the unknown tables and relationships andcontinue with the Insert Process. The report will containa message listing the unknown objects.

UNKNOWN ALLOW is most frequently used when you override thedefault Creator ID with DEFCID. Changing the default Creator IDmay result in naming destination tables that do not exist. TheUNKNOWN ALLOW parameter enables you to direct the InsertProcess to skip these “unknown” tables.

You can store these parameters in a sequential file or a partitioneddata set rather than specify it directly in the jobstream. However,these parameters must be the only data in the file. (You cannot usethe same file used for a batch Extract Process if selection criteria,

UNKNOWN

Store Overrides

Page 372: Move for DB2 User Guide

5. Data Migration

358 Move for DB2

SQL WHERE Clause, or Group Selection Processing parameters arealso included. Also you cannot use this file for an Extract Process ifthe YEAR parameter is included.)

Save JCL

You can save the JCL, modify it and execute the process without re-invoking MOVE. Specify S to the prompt, If Batch, Review or SaveJCL prompt. The following prompts for the information to save the JCL.

.+--------------------------- Save JCL Parameters ---------------------------+ | | | DSN to Save JCL to ===> | | Member (if PDS) ===> | | | | Submit JCL, or Review ===> S-Submit, R-Review, N-Neither | | Replace Existing Data ===> Y-Yes, N-No | | | | | +---------------------------------------------------------------------------+

Figure 180. Save JCL Options

The following prompts are displayed:

DSN to Save JCL to Name of the dataset to receive the JCL.This can be a sequential file or a partitioneddata set.

If you specify a partitioned data set, specifythe member in the field provided for theMember prompt.

Member (if PDS) Name of the member in the partitioned dataset specified for the DSN prompt. If asequential file is specified and you specify amember name, an error message displays.

Submit JCL or Review Specify whether the JCL is saved, savedand submitted, or displayed for review.

If you select Submit, the JCL is saved andthe job is submitted.

If you select to review the JCL, use ISPFfacilities to save or submit.

If you select Neither, the JCL is saved, butnot submitted or displayed for review.

Panel Fields

Page 373: Move for DB2 User Guide

5.4 Insert Process

User Manual 359

Replace Existing Data Specify whether the generated JCL replacesexisting data in the specified file.

5.4.4 Insert Process Report

When the Insert Process completes, it generates a reportdocumenting the activity of the process. The contents of theINSERT Process Report can be browsed. When the process isexecuted online, the INSERT Process Report is automaticallydisplayed. Standard ISPF scrolling functions are available. Inbatch, the report is placed in the default output as specified in theJCL. You can then display the report as you would the outputfrom any job.

The INSERT Process Report is formatted as shown in the figure.

----------------------------- INSERT Process Report ----------------------Command ===> Scroll ===> PAGE ROW 0 OF 18******************************** TOP OF DATA *****************************

INSERT Process Report

Extract File : PSTDEMO.SAMPLE.EXTRACT.FILE.DSN Control File : PSTDEMO.SAMPLE.CONTROL.FILE.DSN User ID : COHEND Time Started : 01-15-98 09.52.33 Time Finished : 01-15-98 09.52.42

Totals: Number of Insert Tables : 4 Number of Inserted Rows : 3972 Number of Failed Rows : 104

Inserted Failed Insert Tables Rows Rows ------------------------- --------- ------- 1 PSTDEMO.CUSTOMERS 132 5 2 PSTDEMO.ORDERS 792 23 3 PSTDEMO.DETAILS 2176 76 4 PSTDEMO.ITEMS 872 0

****************************** BOTTOM OF DATA ****************************

Figure 181. Insert Process Report Format

The title indicates whether Insert or Update/Insert was performed.The report format includes headings to identify the information. Thisinformation includes the Extract File name, the Control File name, theuser requesting the insert, the date and time of the insert, the numberof tables in the insert, the number of successfully inserted rows, andthe number of discarded rows.

Report Contents

Report Format

Page 374: Move for DB2 User Guide

5. Data Migration

360 Move for DB2

The sequence in which the tables are listed is the order in which thesetables were found in the Extract File. The number of successful andunsuccessful rows is provided on a table-by-table basis.

The UPDATE/INSERT Process Report also includes the total number ofupdated rows and the number of rows updated in each destination table.

If aging parameters have been specified for the process, the reportalso includes:

• Any exception conditions encountered for each table. (This isincluded only when you specify Yes to Report Skipped Dates andReport Invalid Dates.) The following is a sample list of exceptionconditions for aging ORDER_SHIP_DATE in the ORDERS table:

Exception Conditions for Table PSTDEMO.ORDERS

Row 1: Field ORDER_SHIP_DATE (MM/DD/YY) cannot age date: X’0’Row 78: Field ORDER_SHIP_DATE (MM/DD/YY) cannot age date: X’1’

• The aging parameters specified for the process. These are listed afterthe summary information. For example, the following listsspecifications for an Insert Process that uses many of the defaults.

Processing Parameters: Default Aging Amount: =’2000/01/31’ Default Aging Table: PSAPRULE Default Aging Rule: NEXTWORKDAY Century Pivot Year: 65 Process Date Columns: Y Report Invalid Dates: YES Report Skipped Dates: YES Output Rows With Invalid Dates: YES Output Rows With Skipped Dates: YES

• The aging results for each table include the information as

specified on the Specify Aging Parameters panel. Theinformation includes:

Destination Column/Source Column namesNumber of valid datesNumber of invalid datesNumber of skipped datesMinimum value encounteredMaximum value encounteredDate formatAging Rule applied to columnRule Table containing Aging Rule applied to columnAging Amount applied to columnPivot year specifications for column

(The format for DB2 DATE and TIMESTAMP columns isdisplayed as DB2 DATE and DB2 TMSTAMP.)

Aging Information

Page 375: Move for DB2 User Guide

5.4 Insert Process

User Manual 361

While browsing, you can use the OUTPUT command to direct thecontents of the report to an output file or the printer. A panel isdisplayed prompting for the necessary information based on thespecified output destination. (For details on the OUTPUT command,see the Relational Tools Command Reference Manual.)

Print Report

Page 376: Move for DB2 User Guide

5. Data Migration

362 Move for DB2

5.5 DB2 Load Process

The DB2 Load Process is used to transform the contents of an ExtractFile to DB2 Load utility format and execute a DB2 Load utility. TheLoad utility can be from IBM or from another software vendor.Those sites using BMC’s LOADPLUS can be presented with a set ofpanels specific to LOADPLUS. (These are discussed beginning onpage 371.)

The Load utility functionally can be used in place of MOVE's InsertProcess. This may be desirable when:

• The number of rows to be inserted is so large that the speed of theLoad utility offsets the advantages of the Insert Process.

• The data contains RI cycles that make it impossible for the InsertProcess to successfully insert all of the data.

• The site-defined Maximum Insert Rows limit is less than thenumber of rows in the Extract File.

• You want to insert data without DB2 logging. The DB2 LoadProcess prompts for you to specify whether the logging isperformed. (If you disable logging, the loaded tables are put intoCopy-Pending status. You may request execution of the DB2COPY utility or the DB2 REPAIR utility to resolve this.)

The DB2 Load utility and the LOAD phase of LOADPLUS requireexclusive control of the database. When using MOVE's InsertProcess, the database is available to all users. Many of the facilitiesof the Insert Process are available when using a Load utility. TableMaps can be used to specify different Creator IDs and table names forthe destination. Column Maps can be used to specify differentcolumn names and to transform data. The Load utility does notprovide for Update/Insert processing. It only performs InsertProcessing. Also, it cannot be performed online.

Generally, the rows in the Extract File are loaded into the database inthe order in which they are processed. However, when using the DB2Load utility, if a cluster index has been defined for the table, the rowswill be sorted based on that index before being loaded. When usingLOADPLUS, sort options are available and you may select theappropriate one when defining the parameters for the load.

Sorting

Page 377: Move for DB2 User Guide

5.5 DB2 Load Process

User Manual 363

The following panel is displayed when Option 3 is selected from theData Migration menu and DB2 LOAD is to be used.

The text on the panel will reflect whether IBM’s DB2 Load Utility orBMC’s LOADPLUS is to be used. The default load utility isspecified as a site option. A user option enables you to override this.(For more information, see Section 6. Specify Options.) Asdistributed, IBM’s DB2 Load utility is the default and, thereforedisplayed in the figure.

------------------------------ DB2 LOAD Process --------------------------OPTION ===>

1 TABLE MAP - Specify Table Map and Column Maps 2 PERFORM - Specify DB2 LOAD Parameters and Perform DB2 LOAD

Specify Data Set Name for Extract File and Control File: Extract File DSN ===> 'PSTDEMO.SAMPLE.EXTRACT' Control File DSN ===> 'PSTDEMO.SAMPLE.CONTROL'

Figure 182. DB2 LOAD Process Menu

The available options are:

1 TABLE MAP Specify the destination tables for each sourcetable in the Load Process. By default, MOVEassumes that the destination base table names arethe same as the source table names defined in theExtract File. However, you must specify adefault destination creator ID using this option.

When you specify a Table Map, you may alsospecify Column Maps for one or more of thedestination tables. These maps allow you tospecify on a column-by-column basis the sourcedata for each destination column.

For more information about specifying TableMaps, see Section 4.4 Table Maps, and forColumn Maps see Section 4.3 Column Maps.Note that only table names are valid whenspecifying Table Maps for the Load Process.Views, synonyms, and aliases are not acceptable.(This is a DB2 restriction.)

2 PERFORM Specify the parameters for the Load Process andperform.

DB2 LOAD Menu

Page 378: Move for DB2 User Guide

5. Data Migration

364 Move for DB2

Prior to selecting Option 1 or 2, specify:

Extract FileDSN

The name of the Extract File containing thesource data to be transformed into DB2 load fileformat. This file must exist, must be a sequentialdata set, and must contain extract data.

Control FileDSN

The name of the Control File that is to be used toaccumulate information and statistics about thetransformation of the Extract File to the DB2load file format. The Control File keeps track ofthe rows that are discarded due to columnmapping problems during the transformationprocess.

If the named file exists, the DB2 Load Processwill overlay any previous data.

If the named file does not exist, you are promptedfor allocation information and the file is createdby MOVE for you. (See Appendix B.Allocating External Files for details on fileallocation.)

To specify the name of an Extract File or a Control File explicitly, usequotes to delimit the desired name; otherwise, it is prefixed based onthe user option chosen.

You can obtain a selection list of Extract Files or Control Files usingthe wild card characters * or % as the last character when specifyingthe name. A sample of the selection list displayed for Extract File orControl File data set names is provided in Figure 165. SelectExtract Data Set on page 311.

If only one file matches the selection criteria, it is automaticallyassumed to be the selected name and a selection list is not provided.

Select Option 2 PERFORM to specify the parameters and perform theprocess. Either the Specify DB2 LOAD Parameters and Executepanel or the Specify LOADPLUS Parameters and Execute panel isdisplayed based upon which load utility is being used.

Explicit Names

Selection List

Perform the Load

Page 379: Move for DB2 User Guide

5.5 DB2 Load Process

User Manual 365

5.5.1 DB2 Load Utility Parameters

The following panel is displayed when IBM’s DB2 Load Utility is tobe used:

----------------- Specify DB2 LOAD Parameters and Execute -----------------Command ==>

Extract File DSN: Z13600MP.PST.XFILE Control File DSN: Z13600MP.PST.CFILE

Delete All Rows in Tablespace (REPLACE) ===> N (Y-Yes, N-No) If NO, Can Tablespace have Rows (RESUME ===> Y (Y-Yes, N-No)Perform Logging During Load ===> Y (Y-Yes, N-No) If NO, Reset Copy Pending (REPAIR) ===> Y (Y-Yes, N-No)Enforce RI Constraints During Load ===> N (Y-Yes, N-No)Create Full Image Copy after Load ===> N (Y-Yes, N-No) If YES, Number of Local Copies (COPYDDN)===> 1 (0, 1, 2) Number of Remote Copies (RECOVERYDDN)===> 0 (0, 1, 2)Invoke RUNSTATS after Load is Completed ===> N (Y-Yes, N-No)Age Date Values ===> N (Y-Yes, N-No)Sort rows on Cluster Index (if it exists) ===> Y (Y-Yes, N-No)Allow Restart on (Keep SYS* Work DSNs) ===> W (W-Warnings, E-Errors, N-Never)Stop if there are 'N' Discards ===> (1-2147483647, Blank-No Limit)Review Propagation Key Sets ===> A (A-Always, E-Errors)Review or Save JCL Before Job Submission ===> N (N-No, R-Review, S-Save)

Figure 183. Specify DB2 LOAD Parameters and Execute

The default values are shown in this figure.

The fields on the panel are provided to enable users to supply severalparameters for the LOAD DATA statement generated by MOVE andto specify whether the DB2 REPAIR, COPY, or RUNSTATS utilitiesare to be executed after the LOAD.

The combination of the following two prompts determine theRESUME parameter of the LOAD DATA statement.

Delete All Rows inTablespace

Specify whether or not all rows in the tablespace are to be deleted. Specify:

Y All rows are to be deleted. TheREPLACE clause is included onthe LOAD DATA statement.

N All rows are not to be deleted. TheRESUME YES or RESUME NOclause is included based onresponse to the next prompt.

Panel Fields

RESUME

Page 380: Move for DB2 User Guide

5. Data Migration

366 Move for DB2

If NO, CanTablespace haveRows

Specify whether the table space must beempty for the process to be performed.This is only relevant if the Delete All Rowsin Tablespace prompt is NO.

Y Table space can have rows. TheRESUME YES clause is includedon the LOAD DATA statement.

N An empty table space is required.The RESUME NO clause isincluded.

Perform LoggingDuring Load

Specify whether logging is performedduring the load.

Y Logging is performed during theload. The LOG YES clause isincluded on the LOAD DATAstatement.

N Logging is not performed duringthe load. The LOG NO clause isincluded. If NO is specified, thetable space is placed in CopyPending status. Considerspecifying YES to the prompt forreset copy pending or to the promptfor a full image copy.

If NO, Reset CopyPending

Specify whether the DB2 REPAIR utility isto be executed after the Load is performed.This is only relevant if Perform Logging isNO. Use this to reset the Copy Pendingstatus that occurs when LOG NO isspecified.

Y REPAIR is invoked and the CopyPending is reset.

N REPAIR is not invoked.

The REPAIR utility will reset the COPYPENDING flag without establishing arecoverable set of data. Since the CreateFull Image Copy option resets the flag andestablishes a recoverable set of data, it takesprecedence over this option if both are set toYES. That is, if both are selected, theCOPY Utility is performed and the

LOG

REPAIR

Page 381: Move for DB2 User Guide

5.5 DB2 Load Process

User Manual 367

REPAIR Utility is not.

Enforce RIConstraints DuringLoad

Specify whether Referential Integrityconstraints should be enforced during theload.

Y Any invalid row that is encounteredduring the load is discarded. TheENFORCE YES clause is includedon the LOAD DATA statement.

N The ENFORCE NO clause isincluded on the LOAD DATAstatement. This may be desirable ifRI cycles are involved because thismay be the only way to insert all ofthe data.

Referential Integrity rules are notchecked on a row by row basis.Instead, the checks are suspendedand the table is left in 'CheckPending' status. (For moreinformation about the 'CheckPending' status see the discussionon page 379.)

Create Full ImageCopy after Load

Specify whether the DB2 COPY Utility isexecuted after the Load. Use this toestablish a recoverable data set and reset theCopy Pending status that occurs when LOGis NO.

Y COPY is invoked and the CopyPending is reset.

N COPY is not invoked.

Since the Create Full Image Copy optionestablishes a recoverable data set, it takesprecedence over the option to ResetPending Copy if both are set to YES.

ENFORCE

COPY

Page 382: Move for DB2 User Guide

5. Data Migration

368 Move for DB2

If YES, Number ofLocal Copies

Specify the number of local copies to becreated by the COPY utility:

0 Local copies are not created.

1 The primary local copy is created.

2 The primary and back up local copiesare created.

If Create Full Image Copy after Load isNO, this is ignored.

Number of RemoteCopies

Specify the number of remote copies to becreated by the COPY utility:

0 Remote copies are not created.

1 The primary remote copy is created.

2 The primary and back up remotecopies are created.

If Create Full Image Copy after Load isNO, this is ignored.

Invoke RUNSTATSafter Load isCompleted

Specify whether RUNSTATS is to be invokedafter LOAD to ensure that the statistical datarequired by the DB2 Optimizer is accuratelyupdated. RUNSTATS is invoked at the tablespace level and includes all tables and indexesin the table space.

Y RUNSTATS is invoked.

N RUNSTATS is not invoked.

Age Date Values Specify whether date values are to be aged aspart of this process.

Specify:

Y Date values are to be aged. TheSpecify Aging Parameters panel isdisplayed. On this panel, specifyaging values to be used. These valuessupplement the specifications forcolumns mapped with AGE andFUTURE_YEAR functions and areused, if requested, to age DATE and

COPYDDN

RECOVERYDDN

RUNSTATS

Page 383: Move for DB2 User Guide

5.5 DB2 Load Process

User Manual 369

TIMESTAMP columns not explicittargets of an AGE orFUTURE_YEAR function.

N Date values are not to be aged. Thespecifications for aging on the ColumnMaps included in the process areignored.

Additional information about the SpecifyModification Type and Value panel isprovided on page 342.

Sort Rows on ClusterIndex (if it exists)

Specify whether the data is to be sorted by thecluster index if one exists. Specify:

Y Sort data. Default.

N Do not sort data.

Allow Restart on(Keep SYS* WorkDSNs)

Specify whether and which DB2 work files areretained to enable restartability on a specifiedlevel. Specify:

W Keep the files if warnings or errorsare encountered. (The return code is4 or greater.) Default.

E Keep the files if errors areencountered. (The return code is 8or greater.)

N Always delete the files when the stepcompletes.

Note that each tablespace comprises a separatejob step and generates a set of work files. Thespecification for this prompt applies to eachjob step.

Also, when warnings are encountered,processing continues, but, if an error isencountered, the job is terminated. Thesuccessful processing up to the step thatgenerated the error is retained. You must runthe load for the succeeding steps.

Page 384: Move for DB2 User Guide

5. Data Migration

370 Move for DB2

Stop Load if there are'N' Discards

Specify a maximum number of acceptablediscarded rows. When that limit is reached,the load is terminated. Specify an integerfrom 1 through 2147483547. Specify 1 toterminate the load if any rows arediscarded.

Review PropagationKey Sets

Specify whether the Propagate Key Set(s)panel is to be displayed before the LoadProcess is performed. This option is onlydisplayed when the PROP function hasbeen specified in one or more ColumnMaps used by the Load Process. Specify:

A To always display the panel priorto performing the process.

E To display the panel prior toperforming the process only whenthe PROP specifications containerrors. Default.

For information about the Propagate KeySet(s) panel see page 347.

Review or Save JCLBefore JobSubmission

Specify whether JCL is reviewed prior to jobsubmission. This is specified for batchexecution only. Since the JCL is displayedin the ISPF editor, you can modify it for thecurrent request and save it to submit later.Specify:

N Submit job, do not display or savethe JCL.

R Display the JCL for review priorto job submission.

S Save the JCL. Prompts areprovided for you to specify thename of a file in which to storeJCL.

DISCARDS

ReviewPropagation

JCL Review

Page 385: Move for DB2 User Guide

5.5 DB2 Load Process

User Manual 371

5.5.2 LOADPLUS Utility Parameters

The following panel is displayed when BMC’s LOADPLUS Utility isto be used:

------------------- Specify LOADPLUS Parameters and Execute ------------------Command ==>

Data Set Names for Extract and Control File: Extract File DSN: Z13600MP.PST.XFILE Control File DSN: Z13600MP.PST.CFILE

Delete All Rows in Tablespace (REPLACE) ===> N (Y-Yes, N-No) If NO, Can Tablespace have Rows (RESUME) ===> Y (Y-Yes, N-No) If YES, Reallocate Datasets (REDEFINE) ===> N (Y-Yes, N-No)Reset Copy Pending (REPAIR) ===> Y (Y-Yes, N-No)Create Full Image Copy during Load ===> N (Y-Yes, N-No) If YES, Number of Local Copies (COPYDDN) ===> 1 (1, 2) Number of Remote Copies (RECOVERYDDN) ===> 0 (0, 1, 2)Invoke RUNSTATS after Load is Completed ===> B (B-BMC, I-IBM, N-No)Age Date Values ===> A (Y-Yes, N-No)Check Data for Duplicate Rows ===> A (Y-Yes, N-No)Ignore Discarded Rows ===> N (A-All, D-Dups, V-Validproc, N-No)Stop Load if there are 'N' Discards ===> __________ (1-2147483647, Blank-No Limit)Review Propagation Key Sets ===> A (A-Always, E-Errors)Review JCL or Save Before Job Submission ===> N (N-No, R-Review, S-Save)

Figure 184. Specify LOADPLUS Parameters and Execute

The default values are shown in this figure.

The fields on the panel are provided to enable users to supply severalparameters to determine which tasks are performed by LOADPLUSand to specify whether the DB2 REPAIR or RUNSTATS utilities areto be executed after the data is loaded by LOADPLUS.

The combination of the following two prompts determine theRESUME parameter of the LOAD DATA statement.

Delete All Rows inTablespace

Specify whether or not all rows in the TableSpace are to be deleted. Specify:

Y All rows are to be deleted. TheRESUME NO REPLACE clause isincluded on the LOAD DATAstatement.

N All rows are not to be deleted. Eitherthe RESUME YES or the RESUMENO clause is included based on thenext prompt.

Panel Fields

RESUME

Page 386: Move for DB2 User Guide

5. Data Migration

372 Move for DB2

If NO, CanTablespace haveRows

Specify whether the table space must beempty for the process to be performed. Thisis only relevant if the Delete All Rows inTablespace prompt is NO.

Y Table space can have rows. TheRESUME YES clause is included onthe LOAD DATA statement.

N An empty table space is required.The RESUME NO clause isincluded.

If YES, ReallocateDatasets

Specify whether the table and index spacesare to be deleted and redefined when DeleteAll Rows in Tablespace is YES.

Y Table and index spaces are redefined.The REDEFINE YES clause isincluded with REPLACE on theLOAD DATA statement.

N Table and index spaces are notredefined. The REDEFINE NOclause is included with REPLACE onthe LOAD DATA statement.

Reset Copy Pending Specifies whether the DB2 REPAIR utilityis to be executed after the LOAD isperformed.

Y REPAIR is invoked and the CopyPending is reset.

N REPAIR is not invoked.

The REPAIR utility will reset the COPYPENDING flag without establishing arecoverable set of data. LOADPLUS canbe specified to establish a recoverable dataset and reset the COPY PENDING flagwhile performing the load. This isrequested by the Create Full Image Copyoption that takes precedence when bothoptions are set to YES.

REDEFINE

REPAIR

Page 387: Move for DB2 User Guide

5.5 DB2 Load Process

User Manual 373

Create Full ImageCopy during Load

Specify whether a full image copy iscreated. Use this to establish a recoverabledata set and reset the Copy Pending status.

Y Copy Pending is reset.

N Copy Pending is not reset.

If YES, Number ofLocal Copies

Specify the number of local copies to becreated:

1 The primary local copy is created.

2 The primary and back up localcopies are created.

If Create Full Image Copy during Loadis NO, this is ignored.

Number of RemoteCopies

Specify the number of remote copies to becreated:

0 Remote copies are not created.

1 The primary remote copy is created.

2 The primary and back up remote copiesare created.

If Create Full Image Copy during Load isNO, this is ignored.

RUNSTATS Invoke RUNSTATSafter Load isCompleted

Specify whether RUNSTATS is to be invokedafter LOAD to ensure that the statistical datarequired by DB2 Optimizer is accuratelyupdated. Specify:

B BMC’s UPDATEDB2STATS YESclause is included on the LOADDATA statement, therefore statisticsare gathered during the load.

I IBM’s RUNSTATS utility is executedafter the load.

N RUNSTATS is not executed.

If IBM, RUNSTATS is invoked at the tablespace level and includes all tables and indexes

COPY

COPYDDN

RECOVERYDDN

Page 388: Move for DB2 User Guide

5. Data Migration

374 Move for DB2

in the table space.

Date Handling Age Date Values Specify whether date values are to be aged aspart of this process. Specify:

Y Date values are to be aged. TheSpecify Aging Parameters panel isdisplayed. On this panel, specifyaging values to be used. These valuessupplement the specifications forcolumns mapped with AGE andFUTURE_YEAR functions and areused, if requested, to age DATE andTIMESTAMP columns not explicittargets of an AGE orFUTURE_YEAR function.

N Date values are not to be aged. Thespecifications for aging on the ColumnMaps are ignored.

Additional information about the SpecifyAging Parameters panel is provided on page342.

UNIQUECHECK Check Data forDuplicate Rows

Specify whether data is to be checked forduplicate rows.

Y All rows are to be checked. TheUNIQUECHECK CLUSTER clause isincluded on the LOAD DATAstatement.

N The rows are not checked.

Ignore DiscardedRows

Specify which, if any, discarded rows are to beignored.

A Ignore all discarded rows.

D Ignore discarded duplicate rows.

V Ignore rows discarded because of avalidation procedure check.

N Do not ignore discarded rows.

If A, D or V is specified, the DISCARDSIGNORE clause with an appropriate operand

DISCARDSIGNORE

Page 389: Move for DB2 User Guide

5.5 DB2 Load Process

User Manual 375

is specified on the LOAD DATA statement.

Stop Load if there are'N' Discards

Specify a maximum value, from 1 through2147478347, as the limit for the number ofacceptable discarded rows. When that limit isreached, the load is terminated.

Specify 1 to terminate the load if any rows arediscarded. A discarded row is included in thecount based on the specification for the IgnoreDiscarded Rows prompt.

Review PropagationKey Sets

Specify whether the Propagate Key Set(s)panel is to be displayed before the process isperformed. This option is only displayed whenthe PROP function has been specified in one ormore Column Maps used by the process.Specify:

A To always display the panelprior to performing the process.

E To display the panel prior toperforming the process onlywhen the PROP specificationscontain errors. Default.

For information about the Propagate KeySet(s) panel see page 347.

Review or Save JCLBefore JobSubmission

Specify whether JCL is reviewed prior to jobsubmission. This is specified for batchexecution only. Since the JCL is displayed inthe ISPF editor, you can modify it for thecurrent request and save it to submit later.Specify:

N Submit job, do not display or savethe JCL.

R Display the JCL for review prior tojob submission.

S Save the JCL. Prompts are providedfor you to specify the name of a filein which to store JCL.

DISCARDS integer

ReviewPropagation

JCL Review

Page 390: Move for DB2 User Guide

5. Data Migration

376 Move for DB2

5.5.3 Job Processing

Once you have completed the appropriate panel, either DB2 LoadParameters or LOADPLUS Parameters, the job can be submitted.

The JCL is generated from the specifications on the Job CardOptions panel and the parameters panel. Additional jobsteps for theLOAD, CHECK, REPAIR, COPY and RUNSTATS utilities mayalso be generated. The DSNs for output and input files, for example,are generated, by default, based on the prefix option chosen on theUser Options panel.

If you have not requested to view the JCL before Job submission and,on the User Options panel you have not requested that job cardinformation should be displayed, press ENTER to submit the job.

However, if you have specified YES to Review Job Card on the JobCard and Print Options panel, the job card information is displayedfor your review. You may modify the Job Card information andspecify whether these changes apply to the current request only or areto be permanent.

Use END or ENTER to proceed to edit the JCL or perform the LoadProcess depending on the response to Review JCL Before JobSubmission.

If Review or Save JCL Before JOB Submission on the currentparameters panel is Review, the jobstream generated by MOVE isdisplayed in the ISPF editor. The jobstream can be edited and savedwhile displayed in the ISPF editor.

The changes apply only for the current job and do not affect thespecifications on the Job Card Options panel. You may save theJCL using ISPF facilities.

Note that the COPY Utility requires unique data set names for eachimage copy defined in the COPYDDN and RECOVERYDDNstatements.

No JCL Display

Job Card Review

JCL Review

Page 391: Move for DB2 User Guide

5.5 DB2 Load Process

User Manual 377

You can save the JCL, modify it and execute the process without re-invoking MOVE. Specify S to the prompt, If Batch, Review or SaveJCL prompt. The following prompts for the information to save the JCL.

.+---------------------------- Save JCL Parameters --------------------------+ | | | DSN to Save JCL to ===> | | Member (if PDS) ===> | | | | Submit JCL, or Review ===> S-Submit, R-Review, N-Neither | | Replace Existing Data ===> Y-Yes, N-No | | | | | +---------------------------------------------------------------------------+

Figure 185. Save JCL Options

The following prompts are displayed:

DSN to Save JCL to Name of the dataset to receive the JCL.This can be a sequential file or a partitioneddata set.

If you specify a partitioned data set, specifythe member in the field provided for theMember prompt.

Member (if PDS) Name of the member in the partitioned dataset specified for the DSN prompt. If asequential file is specified and you specify amember name, an error message displays.

Submit JCL or Review? Specify whether the JCL is saved, savedand submitted, or displayed for review.

If you select Submit, the JCL is saved andthe job is submitted.

If you select to review the JCL, use ISPFfacilities to save or submit.

If you select Neither, the JCL is saved, butnot submitted or displayed for review.

Replace Existing Data? Specify whether the generated JCL replacesexisting data in the specified file.

END is used to return from the ISPF editor to MOVE, however yourspecification for the prompt, Submit Jobs with END on the UserOptions panel, determines whether the job is automatically submitted.

Save JCL

Panel Fields

AutomaticSUBMIT

Page 392: Move for DB2 User Guide

5. Data Migration

378 Move for DB2

If you specify NO to the prompt, you must submit the job explicitlyfrom the ISPF editor using the SUBMIT command.

When Submit Jobs with END is YES, use the CANCEL commandto return to the Load Process panel without submitting the job.

Controlling when the job is submitted is especially useful. You canprepare the job to be executed later. For example, to minimizecontention you can prepare the LOAD job during the day and executeit overnight.

Note LOADPLUS users can take advantage of the PRELOAD phasethat does not prevent other users from accessing the database.PRELOAD does identify discarded rows based on the IGNORE andUNIQUE CHECK options. You can then decide whether or not toexecute the LOAD phase based on the return code set by thePRELOAD phase.

The job steps performed are as follows. Note that Step 1 is executedonce, but Step 2 may be executed several times. Steps 3, 4, and 5 areoptional and, if performed, are executed once.

Step 1 Transform the Extract File to one or more Load Utilityinput files. During this operation, the Table Map and theColumn Map are applied to the data. A Load Utilityinput file is needed for each table space. Based on thedestination tables, MOVE will determine how many andwhich table spaces are affected.

Step 2 DB2 LOAD executes a Load Job Step for each tablespace. The number of times Step 2 is performed is equalto the number of table spaces involved in the load.

If the load is successful, a job step is performed to deletethe interim data sets. Whether this step is performed isdetermined by the return code from the Load Job Step.

LOADPLUS executes the load step as twophasesPRELOAD and LOADfor each table space.First the PRELOAD is executed for each table space andprocessing can be paused. Then the LOAD phase isperformed for each table space. If requested, the Copyfunction is performed as part of the LOAD phase.

Step 3 Execute the Check Utility for each table space in CheckPending status that is being loaded.

Step 4 Execute, if requested, the REPAIR Utility or the COPYUtility.

Job Steps

Page 393: Move for DB2 User Guide

5.5 DB2 Load Process

User Manual 379

Using either DB2 Load or LOADPLUS, the REPAIRUtility executes a single jobstep for all table spaces.

Using DB2, the COPY Utility executes a single jobstepfor all table spaces.

Using LOADPLUS, the Copy Utility is executed, ifrequested, as part of the LOAD step and does not requirea separate step.

Step 5 Execute, if requested, the RUNSTATS utility. Thisexecutes a single jobstep for all table spaces.

If the number of jobsteps exceeds 256, Relational Toolsautomatically splits the request into multiple jobs. The jobs must beexecuted in the proper sequence to maintain the steps in the ordergenerated by Relational Tools. To handle this, review the JCL andspecify TYPERUN=HOLD to hold the job. Then manually submitthe jobs in the correct order.

A table space may be placed in Check Pending status when one ormore of the following conditions occur:

• Enforce RI Constraints is set to NO. This indicates that datacan be loaded into dependent tables without DB2 verifying that itmeets RI constraints. Before the database can be used, DB2 mustverify that RI rules have not been violated by the load. Forexample, proper parents must exist for all rows inserted into achild table.

• Delete All Rows in the Table Space is set to YES. There aretwo possible scenarios:

1. If a parent table is involved in the load, any other tablesspaces containing child tables are placed into check pendingstatus. This is because all of the child rows initially becomeorphans and the load process may or may not replace all ofthe parent rows.

2. If a parent table is not involved in the load but is in a tablespace that is cleared, any other table spaces containing childtables are placed into check pending status. If any childtable's table space is not involved in the load, MOVE will notgenerate a check data job for the dependent table space. Toalert you to this potential problem, MOVE compares thenumber of tables to be loaded into the table space and thenumber of tables in the table space. When these numbers aredifferent, MOVE displays a warning. You can terminate theload at this point or proceed. If you proceed, all of the rows

Check PendingStatus

Page 394: Move for DB2 User Guide

5. Data Migration

380 Move for DB2

of the parent tables not involved in the load will be deletedand any child table rows will remain orphans. You may bedeleting more data than you expected.

When the DB2 Load utility is executed with LOG NO, a COPYPENDING restriction is placed on the table space being loaded. Thisprevents updates to any table in the table space. It is intended to forcethe user to establish a point of recoverability for the data which theLOG NO option lost.

MOVE provides two options for clearing the Copy Pending status andprompts for them on the Specify DB2 LOAD Parameters andExecute:

1. The DB2 REPAIR Utility.

This is requested by the If NO, Reset Copy Pending prompt andwill only be executed when LOG NO is specified.

2. The DB2 COPY Utility.

This is requested by the Create Full Image Copy after Loadprompt and can be executed when either LOG NO or LOG YESis specified.

The COPY PENDING status may also occur when LOADPLUS isexecuted based on the site installation options. The DB2 REPAIRutility is requested by the Reset Copy Pending prompt and will onlybe executed if a Full Image Copy is not requested, however a FullImage Copy is created automatically during the PRELOAD phase.

The DB2 REPAIR utility does not establish a recoverable set of data.It is provided here because it is a fast and simple way to reset theCOPY PENDING restriction when loading data into a new tablespace or replacing all of the data in a table space. When used withLOAD REPLACE, the Extract File serves the purpose of a DB2 FullImage Copy. However, when used with LOAD RESUME YES, thedatabase is non-recoverable.

The DB2 COPY Utility establishes recoverability by creating imagecopies of a table space. This is recommended when you are notreplacing all of the data in a table space.

Up to four image copies can be made: main and backup copies forboth local and remote sites. The panel options for COPYDDN andRECOVERYDDN, as documented in the panel field descriptions,determine which copies are created.

The performance of Relational Tools and your applications programsis very dependent on the DB2 statistics, therefore it may be useful to

Copy PendingStatus

DB2 REPAIR

DB2 COPY

RUNSTATS

Page 395: Move for DB2 User Guide

5.5 DB2 Load Process

User Manual 381

execute RUNSTATS to maintain optimum performance. However, ifvarious statistics have been specifically modified (for example, toforce the test system to accurately simulate the productionenvironment), you may choose to bypass RUNSTATS.

After the LOAD is executed, you can browse the Control File toidentify any rows that were discarded when transforming the ExtractFile to the DB2 load format. The Load utility produces a report thatshows the errors encountered while loading the data.

Process Complete

Page 396: Move for DB2 User Guide

5. Data Migration

382 Move for DB2

5.6 Delete Process

The Delete Process is used to delete the data extracted from the sourcedatabase.

You may use the Delete Process in combination with the Extract andInsert Processes to perform a traditional “move” process. That is,you can copy the data to a destination and delete it from the source.

You execute the Delete Process after performing an Extract Process.The Delete Process uses the Extract File as its guide to select the rowsthat are to be deleted from the database. The Delete Process verifiesthat the rows in the source database are exactly the same as the rowsin the Extract File before deleting those rows. Any rows that do notmatch exactly are not deleted.

Select Option 4 DELETE on the Data Migration menu. Thefollowing panel is displayed.

------------------- Specify DELETE Parameters and Execute -------------------Command ===>

Provide Data Set Names for Extract File and Control File: Extract File DSN ===> Control File DSN ===>

Process Options: Lock Tables During Process ===> (Y-Yes, N-No) Commit Every Nth Row ===> (1-1000, Blank-Site Limit) Limit Number of Discarded Rows ===> (1-999999, Blank-No Limit) Run Process in Batch or Online ===> (B-Batch, O-Online) If Batch, Review or Save JCL ===> (N-No, R-Review, S-Save)

Figure 186. Specify DELETE Parameters and Execute

The fields on the panel are:

Extract File DSN Name of the Extract File that contains thesource data. This file must exist and mustbe a sequential data set. You can obtain aselection list of Extract Files using eitherwild card character, * or %, as the lastcharacter in the name.

Control File DSN Name of a sequential file to be used toaccumulate information and statistics aboutthe Delete Process.

If the data set exists, MOVE overlays the

Panel Fields

Page 397: Move for DB2 User Guide

5.6 Delete Process

User Manual 383

previous data.

If the named file does not exist, you areprompted for the allocation information andthe file is created.

You can obtain a selection list of ControlFiles using either the wild card characters, *or %, as the last character in the name.

Lock Tables DuringProcess

Specify whether locks should be applied tothe tables involved in the Delete Process.Locking the tables ensures that the otherdatabase activity does not interfere with theDelete Process. However, it will preventother users from accessing the table.Specify:

Y Lock tables for the process.

N Do not lock tables.

If site management has established thattables are not to be locked, this option is setto NO and cannot be modified.

Commit Every NthRow

Specify the frequency of commits. Thecommit points affect the starting point incase of a Restart. Frequent commits willkeep page locks to a minimum. Specify:

1-999999 Commit each n deletes where nis a value from 1 through999999 inclusive.

BLANK Use site limit.

The value specified for Commit Every NthDelete is not relevant if Lock TablesDuring Delete is YES. Then, the commit isperformed as the processing for each tableis completed.

The figure shows the distributed defaultvalue of 1,000. At your site, the maximumvalue defined by site management isdisplayed.

Limit Number ofDiscarded Rows

Specify a limit to the number of rows thatcan be marked as discarded.

If that limit is met, the process is

Page 398: Move for DB2 User Guide

5. Data Migration

384 Move for DB2

terminated. You can use Restart to beginthe process at the termination point.Specify:

1-999999 Maximum number of discards.

BLANK No limit.

To terminate the process if any rows arediscarded, specify 1.

Run Process in Batchor Online

Specify whether execution of the DeleteProcess is performed in batch or online.Specify:

B BatchO Online

If site management has established amaximum number of rows for onlineprocessing and this request exceeds thatlimit, this option is forced to Batch andcannot be changed. Site management mayhave guidelines.

If Batch, Review orSave JCL

Specify whether JCL is reviewed prior tojob submission. This is specified for batchexecution only. Since the JCL is displayedin the ISPF editor, you can modify it for thecurrent request and save it to submit later.Specify:

N Submit job, do not display orsave the JCL.

R Display the JCL for review priorto job submission.

S Save the JCL. Prompts areprovided for you to specify thename of a file in which to storeJCL.

The available primary commands include:

CANCEL END OPTIONS

AvailableCommands

Page 399: Move for DB2 User Guide

5.6 Delete Process

User Manual 385

When you have completed your specifications, press ENTER and theDelete Process begins. If the process is executed online, a panel isdisplayed noting the progress of the process.

----------------- Specify DELETE Parameters and Execute ----------------Command ===> +----------------------- DELETE Process Status ----------------------+ | | | DELETE Process in Progress | | | | Number of Rows Processed: 2053 of 10340 | | | | Completed Table: PSTDEMO.CUSTOMERS Deleted Rows: 523 | | Rows Not Found: 0 | | Failed Rows: 0 | | | +--------------------------------------------------------------------+

Figure 187. Delete Process Status

The total number of rows that have been deleted out of the totalnumber of rows to be deleted is displayed. Also, the name of thecurrently processing table, total number of rows that have beendeleted from that table, total number of rows that could not be foundto be deleted from that table, and total number of rows that could notbe deleted for that table are displayed.

This is revised:

• Every 1000 rows for each table to display the current totalnumber of processed rows.

• When the processing for a table is complete and the processingfor the next table begins.

Batch Execution

If you specify batch execution, MOVE builds the necessary JCL. TheJOB card information is taken from the JCL specified on the JobCard and Print Options panel.

If you specified YES to Prompt for Changes Before JobSubmission on the Job Card and Print Options panel, the job cardis displayed prior to job submission. You may edit the job card andspecify whether your changes are to apply only to the current jobsubmission or are to be applied permanently. Then, the job card andthe Delete parameters are used to build the JCL required to performthe Delete Process.

SpecificationComplete

Page 400: Move for DB2 User Guide

5. Data Migration

386 Move for DB2

If you specify Review to If Batch, Review or Save JCL on theSpecify DELETE Parameters and Execute panel, the completejobstream is displayed in the ISPF editor. You can edit and save theJCL.

END is used to return from the ISPF editor to MOVE, however yourspecification for the prompt Submit Jobs with END on the UserOptions panel, determines whether the job is automatically submitted.If you specify NO to the prompt, you must submit the job explicitlyform the ISPF editor using the SUBMIT command.

If you specify YES, the job is automatically submitted when END isused. You can use CANCEL to return to the Specify DELETEParameters and Execute panel without submitting the job. You canmodify the specifications or cancel the insert request from this panel.(See Section 6.1 User Options, for information on establishingwhether jobs are automatically submitted when END is used.)

If you responded Save to If Batch, Review or Save JCL, you areprompted for the name of the file in which to save the JCL andwhether the job should be submitted after saving the JCL. (Detailsare discussed on page 358.)

If you submit the job and an error is encountered in the job card, amessage is displayed. You can review the job card and correct theerror or terminate the Delete Process.

Rows are discarded when an attempt to delete the row is unsuccessful.This can occur when RI rules prevent the row from being deleted. Forexample, a row is not deleted if this table has a Delete Restrictrelationship to another table that still contains rows. This can onlyoccur if that table was not part of the original Extract since MOVEwill delete rows in the proper order. These discarded rows are notedin the Control File.

If the Delete Process is being performed on rows for which theprimary key is defined as non-unique in the Princeton SoftechDirectory, a row is deleted at the destination only when all of the datain all of the columns in the source row and destination row match.Therefore, each row in the Extract File containing an occurrence ofthe primary key, is compared to each potentially matching row. Whena successful match is encountered the row is deleted and the ExtractFile row marked OK. If none of the destination rows match theExtract File row, a delete is not performed and the row is marked asNOT FOUND.

If you attempt to delete tables which are parents in a relationshipdefined with cascade delete, MOVE warns you that descendant rows

Review

Save

Job Card Error

Discarded Rows

Important Note

Cascade Delete

Page 401: Move for DB2 User Guide

5.6 Delete Process

User Manual 387

may be deleted regardless of whether those tables were selected fordeleting. MOVE displays a pop-up to confirm the cascade delete.

A DELETE Process Report is generated as part of the process. Thisreport contains information including various statistics about theexecution of the process.

The contents of the DELETE Process Report can be browsed. Whenthe process is executed online, the DELETE Process Report isautomatically displayed. Standard ISPF scrolling functions areavailable.

In batch, the report is placed in the default output as specified on theJCL. You can then display the report as you would the output fromany job.

The DELETE Process Report is formatted as shown in the followingfigure.

---------------------------- DELETE Process Report -----------------------Command ===> Scroll ===> PAGE ROW 0 OF 18******************************** TOP OF DATA *****************************

DELETE Process Report

Extract File : PSTDEMO.SAMPLE.EXTRACT.FILE.DSN Created by : Job COHEND, using SQLID COHEND on DB2 Subsystem DSNA Control File : PSTDEMO.SAMPLE.CONTROL.FILE.DSN Processed by : Job COHEND, using SQLID COHEND on DB2 Subsystem DSNA Time Started : 01-15-98 09.52.33 Time Finished : 01-15-98 09.53.15

Totals: Number of Delete Tables : 4 Number of Deleted Rows : 3972 Number of: Failed Rows : 0 Number of Rows not Found : 0

Deleted Failed Not Delete Tables Rows Rows Found ------------------------- --------- -------- --------- 1 PSTDEMO.CUSTOMERS 132 0 0 2 PSTDEMO.ORDERS 792 0 0 3 PSTDEMO.DETAILS 2176 0 0 4 PSTDEMO.ITEMS 872 0 0

******************************* BOTTOM OF DATA ***************************

Figure 188. Delete Process Report Format

The report format includes headings to identify the information. Thisincludes the Extract File name, the Control File name, the userrequesting the Delete, the date and time the process was executed, thenumber of tables in the delete, the number of successfully deletedrows, the number of discarded rows, and the number of rows notfound.

DELETE ProcessReport

Display ReportContents

Report Contents

Report Format

Page 402: Move for DB2 User Guide

5. Data Migration

388 Move for DB2

The sequence in which the tables are listed is the order in which thesetables were specified in the Extract File. The number of successfuland unsuccessful rows is provided on a table-by-table basis.

When MOVE deletes a row, the entire row is checked to ensure that itmatches the row in the Extract File exactly. If another user hasupdated the row between the time the Extract Process was performedand the time the Delete Process is performed, that row is not deleted.

MOVE normally deletes rows from the child table before attemptingto delete rows in the parent table. However, for cascading deletes,MOVE deletes the parent table first and DB2 deletes the child rows.If any of the deleted child rows are included in the Extract File,MOVE attempts to delete them later. Since they have been previouslydeleted by DB2, these child rows are marked as NOT FOUND in theDELETE Process Report.

While browsing the DELETE Process Report online, you can use theOUTPUT command to direct the contents of the report to an outputfile or SYSOUT. A panel is displayed prompting for the necessaryinformation based on the specified output destination. (For details onthe OUTPUT command, see the Relational Tools CommandReference Manual.)

If Row Updated

DB2 RI Rules

Print Report

Page 403: Move for DB2 User Guide

5.7 Create Process

User Manual 389

5.7 Create Process

The Create Process is used to migrate object definitions from oneDB2 subsystem or database to another. The object definitions areextracted from the source using the Extract Process and stored in theExtract File. (MOVE supports object definitions created using DB2releases up through and including 4.1.) The Create Process uses theseextracted object definitions to create the objects at the destination.You can select which objects in an Extract File are created.

The Create Process does not load any data. Use the Insert and DB2Load processes to load data. These processes will create anydestination tables that do not exist along with any other objectdefinitions for these tables, such as primary keys and relationships,indexes, etc. that have been extracted. However, Insert and DB2Load Processes do not automatically create any additional objects forexisting destination tables. The Create Process must be used to createthe additional objects when all of the destination tables exist.

5.7.1 CREATE Process Menu

When you select Option 5 from the Data Migration menu, thefollowing panel is displayed.

------------------------------- CREATE Process ----------------------------OPTION ===>

0 DEFAULTS - Specify Object Creation Defaults

1 TABLE MAP - Specify Table Map 2 PERFORM - Specify Objects to Create and Perform CREATE

3 GRANT - Grant Table and View Authorizations 4 SYNONYMS - Create Additional Synonyms 5 OUTPUT - Specify File for Output of SQL

Extract File DSN ===> 'Z13600MP.PSTND.XFILE'

Figure 189. CREATE Process Menu

The options on this panel include:

0 DEFAULTS Specify default values to be used to create tables,tablespaces, and indexes. You can also specifydefault Creator IDs for views and aliases.

1 TABLE MAP Specify the names of the destination tables foreach source table in the Extract File. You must

Panel Options

Page 404: Move for DB2 User Guide

5. Data Migration

390 Move for DB2

select this option to specify the DestinationCreator ID. By default, MOVE assumes thebase destination table names are the same as thenames defined in the Extract File. There is nodefault Destination Creator ID.

2 PERFORM Presents the CREATE Object List panel fromwhich you select the object definitions to becreated.

3 GRANT Specify table and view authorizations. Thisoption applies to existing tables and views,therefore it is selected after performing thecreate.

4 SYNONYMS Specify additional synonyms for existing tables.This option applies to existing tables and views,therefore it is selected after performing thecreate.

5 OUTPUT Specify the name of a file to contain the SQLgenerated by the Create request so that the SQLcan be saved and reused. The stored SQL canalso be edited directly.

Extract File DSN Specify the name of the Extract File containingthe source object definitions. (The Extract Filemust be one created with Release 2.0 or later ofMOVE.)

You must be appropriately authorized to create any object definitionsand to grant authority.

5.7.2 CREATE Process Defaults

Before using MOVE to migrate object definitions, you may want toestablish several default values. These defaults will then be usedevery time an object is created by the Create Process, the InsertProcess, or the DB2 Load Process. If you do not specify defaultvalues, you will be prompted as necessary for these values wheneverobjects are to be created.

Page 405: Move for DB2 User Guide

5.7 Create Process

User Manual 391

When you select Option 0 Defaults from the CREATE Processmenu, the following panel is displayed.

------------------------------ CREATE Defaults ----------------------------OPTION ===>

1 TABLE DEFAULTS - Specify Default Table Parameters 2 TABLESPACE DEFAULTS - Specify Default Tablespace Parameters 3 INDEX DEFAULTS - Specify Default Index Parameters 4 CREATOR ID DEFAULTS - Specify Default View and Alias Creator IDs

Figure 190. CREATE Defaults Menu

The options on this panel include:

1 TABLE DEFAULTS Specify default values for severalparameters required to createtables.

2 TABLESPACE DEFAULTS Specify default values for thecreation of tablespaces.

3 INDEX DEFAULTS Specify default values for thecreation of indexes.

4 CREATOR ID DEFAULTS Specify default values for theCreator IDs used when creatingviews and aliases.

Table Defaults

Use Option 1 Table Defaults on the CREATE Defaults menu tospecify default values for several parameters used when creatingtables.

You can specify values for any of the prompts on the following panel,but all values are optional. If the DATABASE NAME is omitted, itwill be prompted for when a table is to be created. If you leave anyother field blank, MOVE omits that parameter when generating theSQL. Therefore, the DB2 default is used when the object is created.

Panel Options

Page 406: Move for DB2 User Guide

5. Data Migration

392 Move for DB2

The specifications on the Table Defaults panel are profiled.

------------------------------ Table Defaults ----------------------------Command ===>

DATABASE NAME ===>TABLESPACE NAME ===>

EDITPROC ===> * (Pgm Name, *-Same as Source Table)VALIDPROC ===> * (Pgm Name, *-Same as Source Table)AUDIT ===> * (N-None, C-Changes, A-All, *-Same as Source)OBID ===> (0 – 32767)DATA CAPTURE ===> * (N-None, C-Changes, *-Same as Source)

Figure 191. Table Defaults

The fields on this panel include:

DATABASE NAME Default name for the database in which a tableis created, as displayed on the Create ObjectList panel. Specify a literal, use one or morekeywords, or combine literal and keywords togenerate a default database name that followsnaming conventions for your site. Leave blankif a default database name is not desired. Notethat you can modify a default database namedisplayed on the Create Object List. Keywordsare:

<CID> Creator ID of the table.

<TBL> Table name.

For example, for a default database name thatbegins with ARE, followed by the Creator ID ofthe user, specify ARC<CID>; for a defaultdatabase name that begins with the Creator IDof the table, followed by the table name, specify<CID><TBL>.

If a generated name exceeds the DB2, 8-character requirement it is truncated on the rightand a message is displayed.

TABLESPACE NAME Default name for the tablespace in which atable is created, as displayed on the CreateObjects List panel. Specify a literal, use oneor more keywords, or combine literal andkeywords to generate a default tablespace namethat follows naming conventions for your site.Leave blank if a no default tablespace name is

Panel Fields

Page 407: Move for DB2 User Guide

5.7 Create Process

User Manual 393

desired.

If you do not specify a default tablespace name,the default name is derived from the table namewhen the table is created. (The INDATABASE clause is used.) Note you canmodify a default tablespace name displayed onthe Create Object List. Keywords are:

<DB> Database name for the table.

<CID> Creator ID of the table.

<TBL> Table name.

For example, for a default tablespace name thatbegins with ARC, followed by the Creator IDof the user, specify ARC<CID>; for a defaulttablespace name that begins with the Creator IDof the table followed by the database name,specify <CID><DB>.

If a generated name exceeds the DB2, 8-character requirement it is truncated on the rightand a message displayed.

EDITPROC Specify the name of an edit procedure or exitroutine that DB2 invokes when a row in thetable is accessed. Specify:

pgmname Explicit name of the exitroutine.

* Name of the exit routinespecified for the source table.

If the field is blank, an edit procedure is notspecified.

VALIDPROC Specify the name of a validation procedure orexit routine DB2 invokes when a row in thetable is updated. Specify:

pgmname Explicit name of the exitroutine.

* Name of the exit routinespecified for the source table.

If the field is blank, a validation procedure isnot specified.

Page 408: Move for DB2 User Guide

5. Data Migration

394 Move for DB2

AUDIT Specify which table activity is to be audited.Specify:

NONE No auditing is performed.

CHANGES Audit insert, update and deleteoperations.

ALL Audit all table access.

* The assignment specified for thesource table determines whetherthe table activity is to beaudited.

OBID Specify the OBID to be used for the table.

DATA CAPTURE Specify whether additional information islogged for SQL INSERT, UPDATE andDELETE operations. Specify:

NONE Data capture is not performed.

CHANGES Write additional data aboutSQL updates to the log.

* The assignment specified for thesource table determines whetherdata capture is performed.

Tablespace Defaults

Select Option 2 Tablespace Defaults on the CREATE Defaults menuto specify default values for several parameters used when creating atable space. Although MOVE does not extract object definitions fortable spaces, a table space may need to be created based onspecifications for the tables you explicitly want to create.

On the following panel you can specify values for any of the promptsfor default parameters for table spaces, but all values are optional. Ifyou leave any field blank, MOVE omits that parameter whengenerating the SQL and the DB2 default values are used.

Page 409: Move for DB2 User Guide

5.7 Create Process

User Manual 395

The values on the Tablespace Defaults panel are profiled. For theinitial display, the panel fields are blank. The following figure isdisplayed when Version 5 of DB2 is installed:

--------------------------- Tablespace Defaults -----------------------------Command ===>

USING STOGROUP ===> PRIQTY ===> SECQTY ===> ERASE ===> (Y-Yes, N-No) or VCAT ===>

FREEPAGE ===> (0-255)PCTFREE ===> (0-99)SEGSIZE ===> (4, 8, 12, ... 64, Blank - Not Segmented)BUFFERPOOL ===> (BP0-49, BP32K, BP32K1-9)LOCKSIZE ===> (A-Any, P-Page, TS-Tablespace, T-Table, R-Row)CLOSE ===> (Y-Yes, N-No)DSETPASS ===>COMPRESS ===> (Y-Yes, N-No)LOCKMAX ===> (0-2147483647 or SYSTEM)CCSID ===> (E-EBCDIC or A-ASCII)LARGE ===> (Y-Yes, N-No)NUMPARTS ===> (1-254)MAX ROWS ===> (1-255)

Figure 192. Tablespace Defaults

The fields on this panel include:

USING STOGROUP Name of the storage group. This specifiesthat DB2 will define and manage the datasets for the table space. If specified, youmay also specify values for the followingprompts:

PRIQTY Indicates the primary allocationfor the data set as an integervalue. The default value isbased on the BUFFERPOOLspecification.

For 4K, PRIQTY must bebetween 12 and 4194304. For32K, the minimum is 96.Minimums for DB2 version 6.1and later are: 8K – 24 and 16K– 48.

SECQT Indicates the secondaryallocation for the data set as aninteger value. The defaultvalue must be greater than orequal to 0 and less than orequal to 4194304 for anyBUFFERPOOL specification.

Panel Fields

Page 410: Move for DB2 User Guide

5. Data Migration

396 Move for DB2

ERASE Specify whether the data sets inthe table space are to be erasedwhen they are deleted. Specify:

YES EraseNO Do not erase.

VCAT Name of the identifier of the VSAM catalogwhere the data sets defined for the tablespace are catalog. This indicates that thetable space is user-managed.

You may specify a value for USINGSTOGROUP or a value for VCAT, notboth.

FREEPAGE Frequency with which a page of free spaceis left when the table space is loaded orreorganized. Specify:

0-255 Any integer in this range. TheDB2 default is 0.

Specify 0 for no free pages, 1 for a freepage after every page, 2 for a free pageafter every two pages, and so forth.

If the table space is segmented, the numberof pages left free must be less than theSEGSIZE value.

PCTFREE Percentage of each page that is to be left asfree space when the table space is loaded orreorganized. Specify:

0-99 Any integer in this range. TheDB2 default is 5 meaning 5%.

SEGSIZE Specify whether the table space is to besegmented. If an integer is specified, thetable space is assumed to be segmented.Specify:

4-64 Any integer that is a multipleof 4 in this range. The valuespecifies the number of pagesassigned to each segment.

Blank Table space is not segmented.

Page 411: Move for DB2 User Guide

5.7 Create Process

User Manual 397

BUFFERPOOL Name of the buffer pool used as the defaultfor tablespaces. The panel shows the validselections when version 5.1 is installed.However, if DB2 version 6.1 is installed,BP0-49, BP8K0-9, BP16K0-9, BP32K,and BP32K1-9 are valid. If version 3.1 ofDB2 is installed, BP0-49, BP32K, andBP32K1-BP32K9 are valid. If version 2 isinstalled, BP0, BP1, BP2, BP32K arevalid. The adjustment to the correct DB2version is automatic.

LOCKSIZE Locking level for the tablespace. Specify:

A Any locking level.

P Page is the locking level.

TS Tablespace is the locking level.

T Table is the locking level. T canbe specified for a segmentedtablespace only.

R Row is the locking level. (Thislocking level is availablebeginning with release 4.1 ofDB2. It is not displayed if you areusing an earlier release.)

CLOSE Indicates whether data sets can be closedwhen not in use if the number of open datasets has reached the limit.

DSETPASS Master level password. (For DB2 version5.1 or earlier.)

COMPRESS Specify whether or not data compression isperformed. Specify:

YES Data is compressed when theLOAD or REORG utility is runon the table in the table space.

NO Data is not compressed.

This prompt is only displayed for release 3or greater of DB2.

LOCKMAX Maximum number of locks that can be ineffect simultaneously in the table space.

Page 412: Move for DB2 User Guide

5. Data Migration

398 Move for DB2

Specify:

0 Unlimited number of locks.

1-2147483647 Explicit number of locks.

SYSTEM System value is used.

This prompt is only displayed for release4.1 or greater of DB2.

CCSID Table is EBCDIC or ASCII data. (ForDB2 version 5.0 or higher.)

LARGE Default established as LARGE or not.(For DB2 version 5.0 or higher.)

NUMPARTS Number of partitions. (For DB2 version5.0 or higher.)

MAX ROWS Maximum number of rows per page.(For version 5.0 or higher.)

MEMBER CLUSTER Clustering of inserted data. (For DB2version 6.1 or later.)

Y Inserted data is clusteredby the implicit or explicitclustering index.

N DB2 chooses the locationof data in the tablespaceon the basis of variablespace.

Page 413: Move for DB2 User Guide

5.7 Create Process

User Manual 399

Index Defaults

Select Option 3 Index Defaults on the CREATE Defaults menu tospecify default values for several parameters used when creating indexes.

You can specify default values for the parameters for indexes, but allvalues are optional. If you leave any field blank on the following panel,the DB2 default value is applied.

------------------------------ Index Defaults -----------------------------Command ===>

INDEX CREATOR ID ===> *TABLE *TABLE - Same as Corresponding Table *SOURCE - Same as Source Index's Creator ID Blank - Current SQLID Other - Explicit Creator ID

USING STOGROUP ===> PRIQTY ===> SECQTY ===> ERASE ===> (Y-Yes, N-No) or VCAT ===>

FREEPAGE ===> * (0-255, * - Same as Source Index)PCTFREE ===> * (0-99, * - Same as Source)SUBPAGES ===> * (1, 2, 4, 8, or 16, * - Same as Source)BUFFERPOOL ===> * (BPO-49, * - Same as Source)CLOSE ===> * (Y-Yes, N-No, * - Same as Source)DSETPASS ===> * (Explicit Value, * - Same as Source)DEFER ===> (Y-Yes, N-No)INDEXTYPE ===> * (1 or 2, * - Same as Source)

Note: PRIQTY and SECQTY may be specified as Explicit Quantities or as aPercentage of Extracted Source Index, e.g. 25%.

Figure 193. Index Defaults

The fields on this panel include:

INDEXCREATOR ID

Creator ID to be used for the name of theindex. Specify:

*TABLE Creator ID from the tablefor which the index isbeing created.

*SOURCE Creator ID from theoriginal source index.

Blank Current user’s SQLID.

Other An explicit Creator IDvalue is supplied.

Panel Fields

Page 414: Move for DB2 User Guide

5. Data Migration

400 Move for DB2

USING STOGROUP Name of the storage group. This specifiesthat DB2 will define and manage the datasets for the table space. If specified, youmay also specify values for the followingprompts:

PRIQTY Indicates the primaryallocation for the data set asan integer value. PRIQTYmust be between 12 and4194304.

SECQTY Indicates the secondaryallocation for the data set asan integer value. Thedefault value must begreater than or equal to 0and less than or equal to4194304.

ERASE Specify whether the datasets in the table space are tobe erased when they aredeleted. Specify:

YES

NO

Erase.

Do not erase.

VCAT Identifier of the VSAM catalog where thedata sets defined for the table space arecataloged. This indicates that the tablespace is user-managed.

You may specify a value for USINGSTOGROUP or for VCAT, not both.

FREEPAGE Frequency with which a page of free spaceis left when the table space is loaded orreorganized. Specify:

0-255 An integer in this range. Thedefault is 0.

* The value assigned to thesource index is to be used.

When specifying an integer, 0 indicates nofree pages, 1 indicates a free page afterevery page, 2 indicates a free page after

Page 415: Move for DB2 User Guide

5.7 Create Process

User Manual 401

every two pages, and so forth.

PCTFREE Percentage of each page that is to be left asfree space when the table space is loaded orreorganized. Specify:

0-99 An integer in this range. Thedefault is 5.

* The value assigned to thesource index is to be used.

SUBPAGES Number of subpages for each physicalpage. (For DB2 version 5.1 or earlier.)Specify:

1, 2, 4, 8,or 16

An integer indicating thenumber of subpages. Thedefault is 4.

* The value assigned to thesource index is used.

BUFFERPOOL Name of the default buffer pool for indexes.The panel shows the valid selections whenDB2 version 3.1 and higher is installed. Ifversion 2 is installed, BP0, BP1, and BP2are valid. The adjustment to the correctDB2 version is automatic.

Specify * to use the value assigned to thesource index.

CLOSE Specify whether the data sets can be closedwhen they are not in use and the number ofopen data sets has reached the limit.Specify:

YES Eligible for closing.

NO Not eligible for closing.

DSETPASS Master level password to access the index.(For DB2 version 5.1 or earlier.)

DEFER Specify whether the index is built duringthe CREATE INDEX statement.

YES Index is not built.

Page 416: Move for DB2 User Guide

5. Data Migration

402 Move for DB2

NO Index is built. This option is displayed only when Version

3 or greater of DB2 is installed.

INDEXTYPE Indicates the type of index created. (ForDB2 version 4.1 to version 5.1.) Specify:

1 Type 1 index is created.

2 Type 2 index is created.

* Type matches type of sourceindex.

COPY Indicates whether copy option is used. (ForDB2 version 6.1 or later.) Specify:

Y Index space can be image copied.Target index also includes copyoption.

N Index space cannot be imagecopied.

Creator ID Defaults

Select Option 4 Creator ID Defaults on the CREATE Defaults menuto specify a default Creator ID for the views and aliases you create.The following panel is displayed.

--------------------------- Creator ID Defaults ---------------------------Command ===>

VIEW CREATOR ID ===> *TABLE - Same as Base Table *SOURCE - Same as Source View's Creator ID Blank - Current SQLID Other - Explicit Creator ID

ALIAS CREATOR ID ===> *TABLE - Same as Base Table or View Name *SOURCE - Same as Source Alias' Creator ID Blank - Current SQLID Other - Explicit Creator ID

Figure 194. Creator ID Defaults

Page 417: Move for DB2 User Guide

5.7 Create Process

User Manual 403

The fields on this panel include:

VIEW CREATOR ID Creator ID to be used for the name ofthe index. Specify:

*TABLE Creator ID from thebase table.

*SOURCE Creator ID from thesource view.

Blank Current user’s SQLID.

Other An explicit Creator IDvalue is supplied.

ALIAS CREATOR ID Creator ID to be used for the name ofthe alias. Specify:

*TABLE Creator ID from the basetable or the view.

*SOURCE Creator ID from thesource alias.

Blank Current user’s SQLID.

Other An explicit Creator IDvalue is supplied.

5.7.3 CREATE Process Table Map

A Table Map is used to specify the names of the tables to be createdat the destination. By default, MOVE assumes the base names of thetables in the Extract File are to be used. You must specify aDestination Creator ID. This option is required in order to executethe Create Process, grant privileges, specify synonyms, use theOUTPUT option.

Panel Fields

Page 418: Move for DB2 User Guide

5. Data Migration

404 Move for DB2

When you select Option 1 Table Map from the CREATE Processmenu, the CREATE Process Table Map panel is displayed.Assume the object definitions for three tables are specified in anExtract File. The following panel is displayed:

-------------------------- CREATE Process Table Map -----------------------Command ===> SCROLL ===> CSR

Available Commands: APPLY, SAVE, LIST, END when CompleteDestination May be any DB2 Tables or Views

Src CID: PSTDEMO Dest CID ===>

Extract Tables Destination Table Name Type------------------ ---------------------------- --------*************************** TOP ************************CUSTOMERS CUSTOMERS UNKNOWNORDERS ORDERS UNKNOWNDETAILS DETAILS UNKNOWN************************* BOTTOM ***********************

Figure 195. Create Process Table Map

The fields on this panel include:

Src CID The default Creator ID for the source tablesas specified in the Extract File. This valuecannot be modified.

Dest CID The default Creator ID for the destination.Initially, the field is blank. A valid valuemust be specified.

Extract Tables Names of the tables included in the ExtractFile. The Creator ID is included only when itdiffers from the Src CID. These valuescannot be modified.

Destination TableName

Names of the destination tables thatcorrespond to the listed source tables.Initially, MOVE supplies the source tablenames for the destination tables.

You can specify other names by overtypingthe name in the field, by requesting a selectionlist from which to choose, or using theAPPLY command. If you leave the fieldblank, the corresponding object definitions inthe Extract File are ignored for the currentCreate Process.

Panel Fields

Page 419: Move for DB2 User Guide

5.7 Create Process

User Manual 405

Type The destination type supplied by MOVE andindicated as:

TABLEVIEWUNKNOWNA-TABLEA-VIEWS-TABLES-VIEWUNUSED

TEMPTBL

A tableA viewNot found or initial displayAn alias of a tableAn alias of a viewA synonym of a tableA synonym of a viewA destination table is notspecified.Temporary table

The following commands are available on this panel:

APPLYBOTTOM

DOWNEND

OPTIONSTOP

CANCEL LIST UP The LIST command is available for aliases, synonyms, tables, andviews. For example, to obtain a selection list of available tables, usethe command LIST TABLES and position the cursor on thedestination table name you want to supply. A selection list ofavailable tables with the destination Creator ID is displayed. You canoverride the destination Creator ID with the LIST TABLES commandas in LIST TABLES SMITH.%.

Use the Select line command, S, to select a table name from theselection list. MOVE automatically places the name in the destinationtable name field on which the cursor is positioned.

Duplicate table names are not allowed. Therefore, the same tablename cannot be specified twice as a destination table.

You can use the APPLY command to populate the Table Map withthe specifications from a previously defined Table Map. If the sourcetables in the process match the source tables in the Table Map,MOVE populates the destination tables from the existing Table Map.APPLY can be specified to populate all table names and the Dest CIDregardless of any entry, or populate only the blank fields.

MOVE automatically revises the Type each time you modify adestination table name. If you modify the Dest CID, any tables thatare specified without an explicit Creator ID automatically use the newDest CID. This may change the Type value and require review. Youcan explicitly supply the Creator ID with the Destination TableName. Then, changing the Dest CID does not affect the table name.

AvailableCommands

Selection List

Use Existing TableMap

Destination TableType

Page 420: Move for DB2 User Guide

5. Data Migration

406 Move for DB2

Additional information about defining Table Maps is provided inSection 4.4 Table Maps.

5.7.4 Perform Create Process

Select Option 2 Perform to invoke the Create Process. You arepresented with the CREATE Object List panel which includesentries for each destination table in the Table Map and all of therelated object definitions contained in the Extract File. You can selectwhich objects are to be created and modify the name to be assigned tothose objects. Use the CREATE ALL primary command to create allof the selected objects, the CR line command to create specificobjects, or the CRA line command to create a single table and all ofits related objects.

Assume the object definitions for three tables, as listed on theCREATE Process Table Map panel in Figure 195, are involved.

The CREATE Object List panel is displayed as follows:

----------------------------- CREATE Object List ----------------------------Command ===> Scroll ===> CSR

Primary Commands: CREATE ALL, DEFAULTS, SHOW Line: S, U, CR(A), DR, DB2, PST, SQL 1 of 14

Cmd Status Type Object Name Database Tablespace--- -------- --------- ------------------------------ -------- ----------*** ********************************* TOP **********************************___ SELECT TABLE SOFTECH.ORDERS DSOFTECH SSOFTCH1___ SELECT INDEX PSTDEMO.XORDERPK___ SELECT PK(DB2)___ SELECT FK(DB2) RCO___ SELECT FK(PST) TRCO___ SELECT TABLE SOFTECH.CUSTOMERS DSOFTECH SSOFTCH1___ SELECT INDEX PSTDEMO.XCUSTPK___ SELECT PK(DB2)___ SELECT FK(DB2) RSC___ SELECT VIEW SOFTECH.V_CUST_ORDS___ SELECT TABLE SOFTECH.DETAILS DSOFTECH SSOFTCH1___ SELECT INDEX PSTDEMO.XORDETPK___ SELECT PK(DB2)___ SELECT FK(DB2) ROD*** ******************************* BOTTOM *********************************

Review SQL before Create ===> _ (Y-Yes, N-No)

Figure 196. CREATE Object List

The fields on this panel include:

Cmd Line command area. The following line commands areavailable:

S Select object. This object is to be created ifthe CREATE ALL command is executed.

AdditionalInformation

Panel Fields

Page 421: Move for DB2 User Guide

5.7 Create Process

User Manual 407

U Unselect object. This object is not created ifthe CREATE ALL command is executed.

CR Create this object regardless of whether it hasthe status SELECT or UNSELECT.

CRA Create this table regardless of the status andall related objects that have the statusSELECT.

DR Drop the existing object. This is normallyused to drop an existing object that is nolonger needed or wanted.

DB2 Switch the type of key to be created from aPrinceton Softech definition (PST) to a DB2definition (DB2). This is only valid for PSTprimary keys and PST relationships that aredefined by a valid DB2 primary key/foreignkey pairing. These relationships are identifiedas FK(PST).

PST Switch the type of key to be created from aDB2 definition (DB2) to a Princeton Softechdefinition (PST). A relationship is identifiedas FK(PST) after it is created.

SQL Display the SQL that would be used to createan object (for SELECT or UNSELECTstatus only) or the SQL that was used tocreate an object during this create session (forCREATED status).

Status Status of the object definition. The possible statusesare:

CONFLICT An object exists with the specifiedname, but it does not correspond to theobject on the list.

CREATED The object was created during thissession.

EXISTS The object exists.

PENDING The object is a joined view or arelationship and create was requestedbut a prerequisite object does not exist.Create the prerequisite object andMOVE will automatically create the

Page 422: Move for DB2 User Guide

5. Data Migration

408 Move for DB2

pending object.

SELECT Object definition is to be created if theCREATE ALL command is executed.

UNSEL Object definition is not to be created ifthe CREATE ALL command isexecuted.

Type Type of object definition as one of the following:

TABLEVIEWPK(DB2)FK(DB2)

ALIASTEMPTABLE

INDEXJVIEWPK(PST)FK(PSTRELSYNONYM

The source of existing or the destination of non-existing primary keys and relationships is notedappropriately with the type. Thus keys in the DB2Catalog are designated as PK(DB2) and FK(DB2);those in the Princeton Softech Directory are designatedas PK(PST) and FK(PST) or REL. The objectsdesignated FK(PST) follow the rules for DB2 Catalogforeign keys and can be respecified to be created in theDB2 Catalog. The objects designated as REL arerelationships in the Directory that are not based onprimary key/foreign key pairing and therefore cannotbe created in the DB2 Catalog. (For more informationabout the differences in these relationships, see Section4.2 Relationships.)

The table type is left justified in the field. Since all ofthe other object types are directly related to specifictables, their type is indented to indicate thissubordination.

Note that Temporary Tables are available only forDB2 release 5.0 or greater. Therefore, a tableidentified as TEMPTABLE is forced to UNSEL whenusing DB2 4.1 or lower.

ObjectName

Name of the object. The object name may be changedby overtyping this value for any object type exceptTABLE. When the name is changed, the status isautomatically amended. (The name of a table can onlybe changed on the Table Map panel.)

Page 423: Move for DB2 User Guide

5.7 Create Process

User Manual 409

Database If the table exists, the name of the database that thetable belongs to is displayed. If the table does notexist, the default value, as specified on the TableDefaults panel, is specified. If a default value has notbeen established, the field is blank.

You may type the desired database name directly inthis field. This value is retained.

A database name is required, therefore if this field isblank when you request that the table be created, youwill be prompted.

If you enter the name of a database that does not exist,the Create Database panel prompts for theinformation needed to create it. See Section 5.7.4.1Create Database.

Tablespace If the table exists, the name of the table space the tablebelongs to is specified. If the table does not exist, thedefault value, as specified on the Table Defaults panel,is specified. If a default value has not beenestablished, the field is blank.

You may type the desired tablespace name directly inthis field or leave blank. The typed value is retained.

If you enter the name of a tablespace that does notexist, the Create Tablespace panel prompts for theinformation needed to create it. (See Section 5.7.4.2Create Tablespace.)

If you initiate a CREATE for the table and theTablespace field is blank, DB2 automaticallygenerates a tablespace name, based on the table name.

ReviewSQL BeforeCreate

Specify whether the SQL generated by MOVE tocreate the objects is to be displayed in the ISPF editorprior to being executed. Specify:

YES SQL is displayed prior to execution. Youcan edit and save the SQL.

NO SQL is not displayed.

If YES, you must use the RUN command in the ISPFeditor to execute the SQL.

The display includes top and bottom markers to indicate the first andlast entries on the list. A count indicating the relative position of the

Page 424: Move for DB2 User Guide

5. Data Migration

410 Move for DB2

first displayed object on the list and a total number of objects isdisplayed to the right on a line below the SCROLL field.

On initial display, the CREATE Object List panel includes an entrywith the TABLE type for every destination table listed on theCREATE Process Table Map panel. The table names are listed inthe order in which they are specified on the Table Map panel. TheExtract File is checked for the other types of object definitions.

Only the object definitions associated with the listed table definitionsare included on the CREATE Object List panel. Relationships andjoined views are included only if all prerequisite tables are included onthe CREATE Process Table Map panel.

For the initial display, MOVE checks each object definition on the listand assigns a status as follows:

• If an object definition matches an existing object at thedestination, it is assigned the EXISTS status.

• If an object definition name matches an existing object name butthe definition does not match the object, the object definition isassigned the CONFLICT status.

• If an object definition does not exist at the destination, it isassigned the SELECT status.

The status determines which object definitions are created when theCREATE ALL command is entered.

MOVE attempts to create only those object definitions assigned theSELECT status when CREATE ALL is executed. From the initialdisplay, you can specify individual object definitions to be“unselected” or assigned the UNSEL status using the Unselect linecommand, U. The object definitions in UNSEL status are not createdwhen CREATE ALL is executed. You can reassign the SELECTstatus using the Select line command, S.

Note that the CR line command can be used to create individualobjects regardless of status and the CRA line command to create atable, regardless of the status, and all of its related SELECTedobjects.

The CONFLICT status results when the object definition for a namedobject on the CREATE Object List panel conflicts with an existingobject at the destination. This can occur for indexes andrelationships. For example, an index definition on the panel has thesame name as an index defined at the destination but the indexes arefor different tables.

Initial Display

Object DefinitionStatus

SELECT Status

CONFLICT Status

Page 425: Move for DB2 User Guide

5.7 Create Process

User Manual 411

You can handle object definitions with the CONFLICT status by:

• Respecifying the name of the object definition in conflict.

For TABLES, you can respecify the database on this panel or thetable name on the Table Map panel. (Changing the databasename will also affect the status of the object definitions associatedwith that table definition.) When a TABLE is in CONFLICTstatus, all related object definitions are also in CONFLICT status.

For object definitions other than TABLES when the TABLE isnot in CONFLICT status, you can respecify the name of theobject definition on this panel.

• Using the DR line command to drop the conflicting object at thedestination. Then the object definition can be used to create anew object. (You cannot use the DR line command to drop atable that has the WITH RESTRICT ON DROP clause in effect.If you attempt to do so, an appropriate DB2 error is displayed.)You cannot use the DROP ALL primary command to dropobjects in conflict.

Due to performance consequences, MOVE does not perform anycolumn checking for existing tables, primary keys, relationship,foreign keys, and views when creating these objects. If the name andtype of the object definition on the CREATE Object List panelmatches that on the destination, it is assigned the EXISTS status.

All objects successfully created during the current session areassigned the CREATED status.

The PENDING status is assigned to a joined view or a relationship,when an object on which one of these dependent object definitions isbased does not exist at the destination and a request is made to createthis dependent object. (A request to create any other dependent objectsuch as aliases, indexes and primary keys results in an error message.)

If the CREATE ALL command is executed, MOVE can detect thesepotential pending situations and create the dependent objects after therequisite tables.

If the CR or CRA command is executed, MOVE checks the objectdefinitions in pending status and creates them if possible and changesthe status to CREATED. Otherwise, they remain in PENDINGstatus.

You can modify the names of the object definitions for any objectexcept TABLE by overtyping the values provided in the name fields.

CREATED Status

PENDING Status

Modifying the List

Page 426: Move for DB2 User Guide

5. Data Migration

412 Move for DB2

If you do modify the names, MOVE amends the status for each objectdefinition appropriately.

You can redisplay the CREATE Process Table Map panel andmodify the destination table names. Any destination table names thatyou remove from the Table Map are deleted from the CREATEObject List along with their associated object definitions.Conversely, any tables that you add to the Table Map, are included onthe CREATE Object List. You cannot insert or delete objectdefinitions from the list directly.

You can use the DEFAULTS command to display the CREATEDefaults menu. From this menu you can select an option and modifythe defaults. The changes you make on the default panels only affectthose object definitions that have not been explicitly modified by theuser and do not already exist. See Section 5.7.2 CREATE ProcessDefaults for additional information.

Use the DROP ALL command to drop all objects in the destinationbefore creating the new objects. The DROP ALL command does notdrop objects in conflict, however.

You can use the line commands DB2 and PST to switch the type ofprimary key or foreign key that is created. By default, the key iscreated based on the source type. However, using these linecommands you can switch from the DB2 Catalog to the PrincetonSoftech Directory and vice versa.

You can determine the current destination with the type field. Forexample, FK(PST) designates a relationship that adheres to DB2requirements for a foreign key to be defined in the Princeton SoftechDirectory, and PK(DB2) designates a primary key and is to be definedin the DB2 Catalog.

Unlike the DB2 Catalog, the Directory does not require a primarykey/foreign key pairing to define a relationship. However, anyrelationship in the Directory that conforms to the DB2 Catalogrequirements is indicated as FK(PST) on the CREATE Object Listpanel. Indicating these relationships as FK(PST) enables users toswitch the destination from the Directory to the DB2 Catalog. Anyrelationships in the Directory that do not conform to the DB2requirements are indicated as REL and cannot be defined to thecatalog.

These different types are also evident in the SQL statement that isgenerated. The following show the SQL that is generated forrelationships. The first is the SQL for a DB2 foreign key and thesecond for a comparable PST key, and for a PST relationship that isnot based on a primary key/foreign key pairing.

DEFAULTSCommand

DROP ALLCommand

DB2 or PST

Page 427: Move for DB2 User Guide

5.7 Create Process

User Manual 413

PST to DB2 The SQL for a DB2 foreign key generated from aPST relationship always includes the DELETERESTRICT rule. Assume the foreign keyRTCO, where SOFTECH.CUSTOMERS is theparent to SOFTECH.ORDERS and the keycolumn is CUST_ID, is switched to DB2.

The following SQL would be generated.

ALTER TABLE SOFTECH.ORDERS FOREIGN KEY RTCO (CUST_ID) REFERENCESSOFTECH.CUSTOMERS ON DELETE RESTRICT;

PSTRelationshipandDB2 to PST

The SQL to generate a PST relationship eitherfrom a PST relationship or from a DB2 foreignkey lists the corresponding columns. Assume thecolumn CUST_ID in SOFTECH.CUSTOMERSis not the primary key. The following sampleSQL would be generated to create a PSTrelationship named RTCO where the columnCUST_ID in SOFTECH.CUSTOMERS isrelated to the column CUST_ID inSOFTECH.ORDERS.

PST ALTER TABLE SOFTECH.ORDERS RELATIONSHIP RTCO (CUST_ID = CUST_ID) REFERENCES SOFTECH.CUSTOMERS;

Although only one column is listed in theseexamples, multiple columns can be involved.Also, PST relationships can include expressionssuch as substrings of columns, concatenatedcolumns, literals and constants. (For moreinformation about PST relationships, see Section4.2 Relationships.)

As documented later in this section, the SQL can be modified prior tobeing submitted, therefore you can respecify the destination directly.

In addition to scrolling facilities, the SHOW command can be used todisplay only the object definitions for a specific type or a specificstatus. (The object definitions for the type TABLE, regardless ofstatus, are always displayed.)

Handling the List

Page 428: Move for DB2 User Guide

5. Data Migration

414 Move for DB2

For example, the following figure shows the result when SHOWINDEX is entered on the panel in Figure 196. CREATE ObjectList:

---------------------------- CREATE Object List -----------------------------Command ===> Scroll ===> CSR

Primary Commands: CREATE ALL, DEFAULTS, SHOW Line: S, U, CR(A), DR, DB2, PST, SQL 1 of 6

Cmd Status Type Object Name Database Tablespace--- -------- --------- ------------------------------ -------- ----------*** ********************************* TOP **********************************___ SELECT TABLE SOFTECH.ORDERS___ SELECT INDEX PSTDEMO.XORDERPK___ SELECT TABLE SOFTECH.CUSTOMERS___ SELECT INDEX PSTDEMO.XCUSTPK___ SELECT TABLE SOFTECH.DETAILS___ SELECT INDEX PSTDEMO.XORDETPK*** ******************************* BOTTOM ********************************

Review SQL Before Create ===> _ (Y-Yes, N-No)

Figure 197. SHOW INDEX on CREATE Object List

You can display other types of object definitions with repeatedexecutions of the SHOW command or all object definitions with thecommand SHOW ALL.

If you specify Yes, to Review SQL Before Create, the SQLgenerated by MOVE to create the selected objects is displayed. Sincethe SQL is displayed in the ISPF editor, you can edit it directly andsave it. Use RUN to execute the SQL; use END or CANCEL toabandon execution.

You can use the SQL line command to display the SQL for any object onthe list with the UNSEL, SELECT, or CREATED status. This displayis browse-only and the SQL will include any user modifications that weremade to create the object. (The SQL line command is not available todisplay the SQL for existing object definitions because of the lengthycatalog retrieval that would be required.)

After the Create Process has executed, the resulting information fromDB2 is automatically displayed as browse-only data in SPUFI-format.Assume the relationship RTCO for the ORDERS table, as shown inFigure 196. CREATE Object List, is created.

Review SQL

SQL LineCommand

Create Performed

Page 429: Move for DB2 User Guide

5.7 Create Process

User Manual 415

The DB2 output is displayed as shown in the following figure:

------------------------------ Browse DB2 Output ---------------- SUCCESSFUL SQLCommand ===> Scroll ===> CSR Row 0 OF 14************************************* TOP OF DATA ******************************---------+---------+---------+---------+---------+---------+---------+---------+ PST ALTER TABLE SOFTECH.ORDERS FOREIGN KEY RTCO (CUST_ID) REFERENCES SOFTECH.CUSTOMERS;---------+---------+---------+---------+---------+---------+---------+---------+DSNE616I STATEMENT EXECUTION WAS SUCCESSFUL, SQLCODE IS 0---------+---------+---------+---------+---------+---------+---------+---------+DSNE617I COMMIT PERFORMED, SQLCODE IS 0DSNE616I STATEMENT EXECUTION WAS SUCCESSFUL, SQLCODE IS 0---------+---------+---------+---------+---------+---------+---------+---------+DSNE601I SQL STATEMENTS ASSUMED TO BE BETWEEN COLUMNS 1 AND 72DSNE620I NUMBER OF SQL STATEMENTS PROCESSED IS 1DSNE621I NUMBER OF INPUT RECORDS READ IS 2DSNE611I NUMBER OF OUTPUT RECORDS WRITTEN IS 14******************************** BOTTOM OF DATA ********************************

Figure 198. DB2 Output from CREATE

The primary commands available on the CREATE Object List panelinclude:

BOTTOM DROP ALL SHOW CANCEL DOWN TOP CREATE ALL END UP DEFAULTS OPTIONS

5.7.4.1 Create Database

If, on the CREATE Object List, you specify the name of a databasethat does not exist, MOVE prompts for the information to create thedatabase. Note the "DATABASE NOT FOUND" message in theupper right corner of the following panel.

------------------------------ Create Database ------------ DATABASE NOT FOUND Command ===>

DATABASE NAME : TSTDB

BUFFERPOOL ===> (BP0-BP49, BP32K, BP32K1-9) ROSHARE ===> (O-Owner, R-Read, Blank-DB Not Shared) STOGROUP ===>

Review SQL before Create ===> Y (Y-Yes, N-No)

Figure 199. Create Database

AvailableCommands

Page 430: Move for DB2 User Guide

5. Data Migration

416 Move for DB2

The fields on this panel include:

DATABASE NAME Name of the new database. This value isinserted by MOVE and cannot be edited.

BUFFERPOOL Name of the buffer pool used as the default fortablespaces. The panel shows the validselections when DB2 version 5.1 is installed.However, if DB2 version 6.1 is installed, BP0-49, BP8K0-9, BP16K0-9, BP32K, orBP32K1-9 is valid. If version 3.1 of DB2 isinstalled, BP0-49, BP32K, or BP32K1-BP32K9 is valid. The adjustment to thecorrect DB2 version is automatic.

ROSHARE Sharing of read-only data in database. (DB2version 5.1 or earlier.) Leave blank ifdatabase is not shared. Otherwise, specify:

O Current server can update database.

R Current server has read-only access todatabase.

INDEXBUFFERPOOL

Name of the default buffer pool for indexeswithin the database. The panel shows the validselections (BP0-BP49). If a value is notspecified, the default is the name of thedatabase buffer pool. (DB2 version 6.1 orlater, only.)

STOGROUP Name of the storage group.

Review SQL beforeCreate

Specify Yes, to display the SQL generated byMOVE to create the database. The SQL isdisplayed in the ISPF editor, where you canedit it directly and save it. Use RUN toexecute the SQL; use END or CANCEL toabandon execution.

Page 431: Move for DB2 User Guide

5.7 Create Process

User Manual 417

5.7.4.2 Create Tablespace

If, on the CREATE Object List, you specify the name of a tablespacethat does not exist, MOVE prompts for the information to create thetablespace. Note the "TABLESPACE NOT FOUND" message in theupper right corner of the following panel.

---------------------------- Create Tablespace ---------TABLESPACE NOT FOUND Command ===>

DATABASE NAME : TSTDB TABLESPACE NAME : PSTTEST USING STOGROUP ===> PRIQTY ===> SECQTY ===> ERASE ===> (Y-Yes, N-No) or VCAT ===>

FREEPAGE ===> (0-255) PCTFREE ===> (0-99) SEGSIZE ===> (4, 8, 12, ... 64, Blank - Not Segmented) LARGE ===> (Y-Yes, N-No) NUMPARTS ===> (1-254, Blank – Not Partitioned) BUFFERPOOL ===> (BP0-49, BP32K, BP32K1-9) LOCKSIZE ===> (A-Any, P-Page, TS-Tablespace,T-Table,R-Row) CLOSE ===> (Y-Yes, N-No) DSETPASS ===> COMPRESS ===> (Y-Yes, N-No) LOCKMAX ===> SYSTEM (0-2147483647 or SYSTEM) CCSID ===> (E-EBCDIC or A-ASCII) MAX ROWS ===> (1-255)

Review SQL before Create ===> Y (Y-Yes, N-No)

Figure 200. Create Tablespace

The fields on this panel include:

DATABASENAME

Name of the database. This value is inserted byMOVE and cannot be edited.

TABLESPACENAME

Name of the new tablespace. This value isinserted by MOVE and cannot be edited.

USINGSTOGROUP

Name of the storage group. A value in this fieldindicates that DB2 defines and manages the datasets for the tablespace. You may also providevalues for the following prompts:

PRIQTY Indicates the primary allocationfor the data set as an integervalue. The default value is basedon the BUFFERPOOLspecification.

For 4K, PRIQTY must bebetween 12 and 4194304. For32K, the minimum is 96.Minimums for DB2 version 6.1and later are: 8K – 24 and 16K –48.

Panel Fields

Page 432: Move for DB2 User Guide

5. Data Migration

418 Move for DB2

SECQTY Indicates the secondary allocationfor the data set as an integervalue. The default value must begreater than or equal to 0 and lessthan or equal to 4194304 for anyBUFFERPOOL specification.

ERASE Indicates whether data sets in thetablespace are erased whendeleted. Specify:

YES EraseNO Do not erase

or VCAT The identifier of the VSAM catalog where thedata sets defined for the tablespace are cataloged.This parameter indicates that the tablespace isuser-managed. You may specify a value for USING STOGROUP ora value for VCAT, but not both.

FREEPAGE Frequency of a page of free space when thetablespace is loaded or reorganized. Specify:

0-255 Any integer in this range. TheDB2 default is 0.

Specify 0 for no free pages, 1 for a free pageafter every page, 2 for a free page after everytwo pages, and so forth.

If the tablespace is segmented, the number ofpages left free must be less than the SEGSIZEvalue.

PCTFREE Percentage of each page left as free space whenthe tablespace is loaded or reorganized. Specify:

0-99 Any integer in this range. The DB2default is 5, which means 5%.

SEGSIZE Indicates whether the tablespace is segmented.Specify:

4-64 Any integer that is a multiple of 4 inthis range. The value indicates thenumber of pages assigned to eachsegment.

Blank Tablespace is not segmented.

Page 433: Move for DB2 User Guide

5.7 Create Process

User Manual 419

LARGE Default established as LARGE or not. (ForDB2 version 5.1 or later.)

NUMPARTS Number of partitions. (For DB2 version 5.1 orlater.)

BUFFERPOOL Name of the buffer pool used as the default fortablespaces. The panel shows the validselections when version 5.1 is installed.However, if DB2 version 6.1 is installed, BP0-49, BP8K0-9, BP16K0-9, BP32K, andBP32K1-9 are valid. If version 3.1 of DB2 isinstalled, BP0-49, BP32K, and BP32K1-BP32K9 are valid. If version 2 is installed, BP0,BP1, BP2, BP32K are valid. The adjustment tothe correct DB2 version is automatic.

LOCKSIZE Locking level for the tablespace. Specify:

A Any locking level.

P Page is the locking level.

TS Tablespace is the locking level.

T Table is the locking level. T canbe specified for a segmentedtablespace only.

R Row is the locking level. (Thislocking level is availablebeginning with release 4.1 ofDB2. It is not displayed if youare using an earlier release.)

CLOSE Indicates whether data sets can be closed whennot in use if the number of open data sets hasreached the limit.

DSETPASS Master level password. (For DB2 version 5.1 orearlier.)

COMPRESS Indicates if data compression is performed. (ForDB2 release 3 or later.) Specify:

YES Data is compressed when theLOAD or REORG utility is runon the table in the tablespace.

NO Data is not compressed.

Page 434: Move for DB2 User Guide

5. Data Migration

420 Move for DB2

LOCKMAX Maximum number of locks that can be in effectsimultaneously in the tablespace. (For DB2release 4.1 or later.) Specify:

0 Unlimited number of locks.

1-2147483647 Explicit number of locks.

SYSTEM System value is used.

CSSID Table is EBCDIC or ASCII data. (For DB2version 5.1 or later.)

MAX ROWS Maximum number of rows per page. (Forversion 5.1 or later.)

MEMBERCLUSTER

Clustering of inserted data. (For DB2 version6.1 or later.)

Y Inserted data is clustered by theimplicit or explicit clusteringindex.

N DB2 chooses the location ofdata in the tablespace on thebasis of variable space.

Review SQLbefore Create

Specify Yes, to display the SQL generated byMOVE to create the tablespace. The SQL isdisplayed in the ISPF editor, where you can editit directly and save it. Use RUN to execute theSQL; use END or CANCEL to abandonexecution.

5.7.5 Grant Privileges

In addition to creating the desired objects, the Create Process enablesyou to specify the DB2 authorizations for the destination tables andviews listed on the Table Map as long as you are authorized to do so.Although the objects must exist prior to executing a grant request, youdo not have to specify the authorizations immediately after you createthe objects. However, since the Table Map information is not profiledit is usually most convenient to grant privileges directly after youperform the Create Process. If you decide to grant privileges as aseparate step at a later time, you can grant privileges to any existingtables or views specified in the destination table field of the CREATEProcess Table Map panel.

Page 435: Move for DB2 User Guide

5.7 Create Process

User Manual 421

When you select Option 3 GRANT from the CREATE Processmenu the following panel is displayed. This panel shows the initialvalues. Any values you specify are profiled and displayed forsubsequent requests to grant privileges.

-------------------------------- Grant Privileges ---------------------------Command ===>

GRANT ALL ===> Y (Y-Yes, N-No) ALTER ===> N (Y-Yes, N-No) INSERT ===> N (Y-Yes, N-No) DELETE ===> N (Y-Yes, N-No) SELECT ===> N (Y-Yes, N-No) INDEX ===> N (Y-Yes, N-No) UPDATE ===> N (Y-Yes, N-No)

TO PUBLIC ===> N (Y-Yes, N-No) or If NO, Use Following AUTHID(s) ________ ________ ________ ________ _______ ________ ________ ________ ________ ________ ________ ________ _______ ________ ________ ________

Select items from generated Selection List, then press ENTER or use END command to execute GRANT statement or Review SQL

ON Select List of ===> T (T-Tables In Table Map, V-Extracted Views)

Review SQL before Granting Privileges ===> Y (Y-Yes, N-No)

Figure 201. Grant Privileges

The fields on this panel include:

GRANT Specify which authorizations are to beincluded in the grant request. Allauthorizations can be granted by specifyingY to ALL. Specifications for any of theindividual authorizations listed are ignored.The following authorizations are granted byALL or can be granted separately:

ALTERDELETEINDEX

INSERTSELECTUPDATE

For each of these specify:

Y Privilege is included.

N Privilege is not included.

Panel Fields

Page 436: Move for DB2 User Guide

5. Data Migration

422 Move for DB2

TO Specify whether the authorizations for thisrequest are granted to all or specific users.For the prompt PUBLIC specify:

Y Privileges are granted to allusers.

N Privileges are to be granted tospecific users as listed.

An area consisting of 16 8-character fieldsis provided below the prompt on which tospecify the AUTHIDs for up to 16 users. Ifyou want to specify more than 16 users, youmust re-execute the grant request.

ON Select the tables or views that are to beincluded in the grant request. Specify:

T Tables

V Views

A selection list of the specified objectdefinitions is displayed.

Review SQL beforeGranting Privileges

Specify whether the SQL generated by thisrequest is displayed for review prior toexecution. Specify:

Y SQL is displayed.

N SQL is not displayed.

When you specify T or V in response to ON Select List of, aselection list of the specified object type is displayed. The selectionlist of tables is comprised of those tables included on the CREATEProcess Table Map panel that have been created or exist. Theselection list of views is comprised of those views defined in theExtract File and that have been created or exist with the defaultCreator ID applied. (The default Creator ID for views can be definedon the CREATOR ID Defaults panel, page 402.)

Use the S line command to select one or more of the objects to beincluded in the request. After objects are selected, use the U linecommand to unselect a previously selected object. The block form ofthe commands, SS and UU, are available.

You can scroll the list using UP, DOWN, TOP and BOTTOM ifnecessary.

SelectTables/Views

Page 437: Move for DB2 User Guide

5.7 Create Process

User Manual 423

When you are satisfied with your selections, use END or ENTER.

If you have responded N to Review SQL before GrantingPrivileges, the request is executed.

If you responded Y, the SQL is displayed for review in the ISPFeditor. It can be modified and saved. Use RUN to execute the SQL.Use CANCEL or END to abandon execution of the SQL.

After the SQL is executed, the DB2 output is provided in a browse-only display. This output is in SPUFI-like format and includes theexecuted SQL statement, the DB2 SQLCODE, and any otherpertinent execution information. (An example of the display is shownin Figure 198. DB2 Output from CREATE on page 402.)

5.7.6 SYNONYMS

This option enables you to specify additional synonyms by providinga list of the synonyms for the tables in the Extract File. When youselect Option 4 SYNONYMS on the CREATE Process menu, theCREATE Additional Synonyms panel is displayed. Assume theExtract File that has been specified contains six tables and theCREATE Additional Synonyms panel is displayed as shown in thefollowing figure.

------------------------- CREATE Additional Synonyms-----------------------Command ===> Scroll ===> CSR

Use CREATE ALL Primary Command to Create all Selected Synonyms

Available Line Commands: S - Select Synonym to be Created U - Unselect Synonym to bypass Creation.

Synonym Owner ===> 1 of 7

Cmd Status Synonym Name Base Name--- -------- ------------------ ------------------------------*** ************************* TOP *****************************___ SELECT S_CUSTOMERS PSTDEMO2.CUSTOMERS___ UNSEL S_ORDERS PSTDEMO2.ORDERS___ CONFLICT S_ORDS PSTDEMO2.ORDERS___ EXISTS DETAILS PSTDEMO2.DETAILS___ EXISTS ITEMS PSTDEMO2.ITEMS___ SELECT V_SALES PSTDEMO2.V_SALES___ SELECT V_SHIP_TO PSTDEMO2.V_SHIP_TO*** *********************** BOTTOM *****************************

Review SQL before Create ===> _ (Y-Yes, N-No)

Figure 202. CREATE Additional Synonyms

SelectionsComplete

Page 438: Move for DB2 User Guide

5. Data Migration

424 Move for DB2

The fields on this panel include:

Synonym Owner Specify the Authorization ID of the user forwhom the synonyms are being created. Ifthe value specified is different from theSQLID currently in use for the MOVEsession, you must have authorization toswitch to that SQLID.

Cmd Line command entry field. The availableline commands are:

S Select the synonym to be created.

U Unselect this previously selectedsynonym. Do not create thissynonym.

Status Indicates whether or not the synonym exists,and, if not, whether it is to be created. Thepossible values are:

CONFLICT Synonym exists but for adifferent table.

EXISTS Synonym already exists withspecified name.

SELECT Synonym is to be created.

UNSEL Synonym is not to becreated.

Synonym Name 1- to 18-character name to be used as asynonym. This field is initially populatedwith the synonyms extracted with the basetables from the source. It is unprotected sothat you can specify your own names.

Base Name Name of the table as specified in theDestination Table field on the CREATEProcess Table Map panel.

Review SQL beforeCreate

Specify whether you want to review theSQL before it is executed. Specify:

Y Display SQL.

N Do not display SQL.

Panel Fields

Page 439: Move for DB2 User Guide

5.7 Create Process

User Manual 425

The following primary commands are available:

BOTTOM DOWN TOP CANCEL END UP CREATE ALL OPTIONS

When you are satisfied with your selections, use CREATE ALL.

If you have responded N to Review SQL before Create, the requestis executed.

If you responded Y, the SQL is displayed for review in the ISPFeditor. It can be modified and saved. Use END to execute the SQL.Use CANCEL to abandon execution of the SQL.

After the SQL is executed, the DB2 output is provided in a browse-only display. This output is in SPUFI-like format and includes theexecuted SQL statement, the DB2 SQLCODE, and any otherpertinent execution information. (An example of the display is shownin Figure 198. DB2 Output from CREATE on page 415.)

5.7.7 OUTPUT SQL

This option enables you to save the generated SQL in a data set forediting and future use, but more importantly, it enables you to savethe SQL to create all object definitions on the CREATE Object Listregardless of whether they exist or not. With this stored SQL, theobjects can be created any number of times in any subsystem.

When you select Option 5 OUTPUT on the CREATE Process menu,the following panel is displayed.

---------------------------------- Output SQL --------------------------------Command ===>

Output Dataset ===>

Specify which SQL Statements to Output: Output SQL for ===> N (N-Non Existent Objects Only, A-All Objects) Output SQL for ===> S (S-Selected Objects Only, A-All Objects)

Review SQL after Output ===> N (Y-Yes, N-No)

Figure 203. Output SQL

AvailableCommands

SpecificationsComplete

Page 440: Move for DB2 User Guide

5. Data Migration

426 Move for DB2

The fields on this panel include:

Output Dataset Specify the name of the data set to containthe generated SQL statements. You mayspecify a partitioned data set or a sequentialdata set. The data set must be defined with80-character fixed length records.

If the named data set does not exist, MOVEprompts for the information required toallocate the data set and allocates it for you. If the data set does exist, MOVE overlaysany existing data with the SQL statements.

You can display a selection list of data setsusing wild card characters.

Output SQL for(existent ornonexistent objects)

Specify whether the SQL for only the non-existent objects, objects to be created, or theSQL for all objects is to be output. Specify:

N Only the SQL for nonexistentobjects.

A The SQL for all objects.

Output for SQL(selected or allobjects)

Specify whether only the selected objects areto be included or if all object definitions areto be included in the output SQL. Specify:

S Only the SQL for selected objects.

A The SQL for all objects.

Review SQL afterOutput

Specify whether you want to review the SQLafter it is output. Specify:

Y Display SQL.

N Do not display SQL.

The SQL is written in SPUFI format. It is provided for the objectdefinitions as specified by your responses to the Output for SQLprompts. The SQL incorporates the defaults that you haveestablished on the various defaults panels (see Section 5.7.2CREATE Process Defaults.)

Panel Field

Page 441: Move for DB2 User Guide

5.8 Convert Process

User Manual 427

5.8 Convert Process

The Convert Process enables users to apply the data transformationsspecified in a Table Map and a set of Column Maps to the contents ofthe Extract File to obtain a “converted” version of the Extract File.The Convert Process can be performed as part of an Extract Processor at any other time for an existing Extract File. This convertedExtract File can then be used as the input to any MOVE process.

Many sites use Convert to mask sensitive data before inserting it. Inthis way, sensitive data is eliminated from the Extract File. AnExtract File does not have the same level of protection afforded byDB2.

This capability can be used whenever the data is to be inserted intotables in the same subsystem, inserted in another subsystem, ordownloaded to another platform and loaded using Relational Toolsfor Servers on other platforms.

5.8.1 Convert Extract File Panel

When you select Option 6 from the Data Migration menu, thefollowing panel is displayed.

----------------- Specify CONVERT Parameters and Execute ------------------OPTION ===>

1 TABLE MAP - Specify Table Map and Column Maps 2 PERFORM - Execute Extract File Conversion Process

Specify Data Set Names for Source Extract File and Control File: Source Extract File DSN ===> SAMPLE.PST.SRCEXTR Control File DSN ===> EXTRACT.CTRL

Specify Data Set Name for Destination Extract File. If Omitted,Destination Extract DSN will be same as the Source Extract DSN: Destination Extract DSN ===> SAMPLE.PST.DESTEXTR

Age Date Values ===> N (Y-Yes, N-No)

Limit Number of Discarded Rows ===> (1-999999, Blank-No Limit)

If Destination Tables have a Cluster Index: Sort Extract File Rows ===> Y (Y-Yes, N-No)Run Process in Batch or Online ===> O (B-Batch, O-Online) If Batch, Review or Save JCL ===> (N-No, R-Review, S-Save)

Figure 204. CONVERT Extract File

Page 442: Move for DB2 User Guide

5. Data Migration

428 Move for DB2

The options on this panel include:

1 TABLE MAP Specify the names of the destination tables foreach table in the Extract File. A Table Mapmust be specified to perform the ConvertProcess, therefore if you do not select this optionfirst, MOVE automatically displays the TableMap panel before proceeding with the selectedoption. When the Table Map is displayed, youmust specify the destination Creator ID, DestCID. By default, MOVE assumes the basedestination table names are the same as thenames defined in the Extract File. There is nodefault destination Creator ID.

You may specify Column Maps for one or moredestination tables. These maps enable you tospecify the destination data column-by-column.

For more information about specifying TableMaps and Column Maps, see Section 4.4 TableMaps and Section 4.3 Column Maps.

2 PERFORM Perform the conversion request.

The fields on this panel include:

Source ExtractFile DSN

Name of the Extract File that contains the sourcedata to be converted.

Control FileDSN

Name of a sequential file that is to be used toaccumulate information and statistics about theConvert Process.

DestinationExtract DSN

Name of the data set to contain the convertedExtract File. If a name is not specified, the actualtransformations are performed in a temporary filewhich the user is prompted to allocate. Aftersuccessful execution, the Source Extract File isdeleted and the temporary file is saved under thesource file name. Object definitions in the sourceExtract File are lost.

Age Date Values Specify whether date values are to be aged as partof this process. Specify:

Y Date values are to be aged. TheSpecify Aging Parameters panelis displayed. On this panel,specify aging values to be used.

Panel Options

Panel Fields

Page 443: Move for DB2 User Guide

5.8 Convert Process

User Manual 429

These values supplement thespecifications for columns mappedwith AGE and FUTURE_YEARfunctions and are used, ifrequested, to age DATE andTIMESTAMP columns notexplicit targets of an AGE orFUTURE_YEAR function.

N Date values are not to be aged.The specifications for aging on theColumn Maps included in theprocess are ignored.

Additional information about the Specify AgingParameters panel is provided on page 342.

Limit Number ofDiscarded Rows

Specify a maximum number of rows that can bediscarded. When this value is reached, theConvert Process is terminated.

Sort Extract FileRows

Specify whether the data for destination tableswith a cluster index are to be sorted. Specify:

Y Sort rows.

N Do not sort rows.

ReviewPropagation KeySets

Specify whether the Propagate Key Set(s) panelis displayed before the process is performed. Thisoption is only displayed when the PROP functionhas been specified in one or more Column Mapsused by the process. Specify:

ALWAYS To always display the panel priorto performing the process.

ERRORS To display the panel prior toperforming the process only whenthe PROP specifications containerrors. Default.

For information about the Propagate Key Set(s)panel see page 347.

If Batch, Reviewor Save JCL

Specify whether JCL is reviewed prior to jobsubmission. This is specified for batch executiononly.

Page 444: Move for DB2 User Guide

5. Data Migration

430 Move for DB2

Since the JCL is displayed in the ISPF editor, youcan modify it for the current request and save it tosubmit later. Specify:

N Submit job, do not display or save theJCL.

R Display the JCL for review prior to jobsubmission.

S Save the JCL. Prompts are provided foryou to specify the name of a file in whichto store JCL.

You can obtain a selection list of names of Extract File or names ofControl Files by specifying the wild cards, * or %, as the lastcharacter in the name. When the list is displayed, use the Select linecommand, S, to select an entry. A sample of the selection listdisplayed for Extract File or Control File data set names is providedin Figure 165. Select Extract Data Set on page 311.

The following primary commands are available:

CANCEL END OPTIONS

When you select Option 1 TABLE MAP, the CONVERT ProcessTable Map panel is displayed. (As noted previously, a discussion ofTable Maps is provided in Section 4.4 Table Maps.)

5.8.2 Perform Convert Process

When you select option 2 PERFORM, the Convert Process begins.

If the process is executed online, a panel is displayed noting theprogress of the process.

----------------- Specify CONVERT Parameters and Execute ----------------Command ===> +----------------------- CONVERT Process Status ---------------------+ | | | CONVERT Process in Progress | | | | Number of Rows Processed: 2053 of 10340 | | | | Completed Table: PSTDEMO.CUSTOMERS Converted Rows: 523 | | Failed Rows: 0 | | | +--------------------------------------------------------------------+

Figure 205. Convert Process Status

Selection List

AvailableCommands

Option 1TABLE MAP

Online Execution

Page 445: Move for DB2 User Guide

5.8 Convert Process

User Manual 431

The total number of rows that have been converted out of the totalnumber of rows to be converted is displayed. Also, the name of thecurrently processing table, total number of rows that have beenconverted, and total number of rows that could not be converted forthat table are displayed.

This is revised:

• Every 1000 rows for each table to display the current totalnumber of processed rows.

• When the processing for a table is complete and the processingfor the next table begins.

Batch Execution

If you specify batch execution, MOVE builds the necessary JCL. TheJOB card information is taken from the JCL specified on the JobCard and Print Options panel.

If you specified YES to Prompt for Changes Before JobSubmission on the Job Card and Print Options panel, that panel isdisplayed prior to job submission. You may edit the job cardinformation and specify whether your changes are to apply only to thecurrent job submission or are to be applied permanently. (SeeSection 6.3 Job Card and Print Options.) The information on theJob Card and Print Options panel is used, along with the ConvertProcess parameters, to build the JCL required to perform the ConvertProcess.

If you specify Review to If Batch, Review or Save JCL, thecomplete jobstream is displayed in the ISPF editor and can be editedand saved.

When you have completed reviewing the JCL, use END. If you haveestablished that jobs are automatically submitted when END is used,the job is submitted. Otherwise, you will have to explicitly SUBMITthe job from the ISPF editor. (See Section 6.1 User Options, forinformation on establishing whether jobs are automatically submittedwhen END is used.)

If you specify Save to If Batch, Review or Save JCL, you areprompted for the name of the file in which to save the JCL andwhether the job should be submitted after saving the JCL. (Detailsare provided on page 358.)

If you submit the job and an error is encountered in the job card, amessage is displayed. You can review the job card and correct theerror or terminate the Convert Process.

Review

Save

Job Card Error

Page 446: Move for DB2 User Guide

5. Data Migration

432 Move for DB2

5.8.3 CONVERT Process Report

A CONVERT Process Report is generated as part of the process.This report contains information including various statistics about theexecution of the process.

The contents of the CONVERT Process Report can be browsed.When the process is executed online, the CONVERT Process Reportis automatically displayed. Standard ISPF scrolling functions areavailable.

In batch, the report is placed in the output as specified in the JCL. Youcan then display the report as you would the output from any job.

The CONVERT Process Report is formatted as follows:

--------------------------- CONVERT Process Report -----------------------Command ===> Scroll ===> PAGE ROW 0 OF 26******************************** TOP OF DATA *****************************

CONVERT Process Report

Extract File : PSTDEMO.SAMPLE.EXTRACT.FILE.DSN Control File : PSTDEMO.SAMPLE.CONTROL.FILE.DSN Destination Extract File : PSTDEMO.SAMPLE.CONVERT.FILE.DSN User ID : COHEND Time Started : 1998-10-19 12.18.04 Time Finished : 1998-10-19 12.18.06 Due to Successful Completion of Process, Control File is no Longer Valid Totals: Number of Convert Tables : 4 Number of Original Extract Rows : 4972 Number of Converted Rows : 4972 Number of Conversion Errors : 0 Number of Exit Routine Discards : 0

Data Exit Extract Converted Conversion Routine Convert Table Rows Rows Errors Discards ------------------------ -------- -------- ----------- --------- 1 PSTDEMO.CUSTOMERS 132 132 0 0 2 PSTDEMO.ORDERS 792 796 0 0 3 PSTDEMO.DETAILS 2176 2176 0 0 4 PSTDEMO.ITEMS 872 872 0 0

******************************* BOTTOM OF DATA ***************************

Figure 206. Convert Process Report Format

The report format includes headings to identify the information. Theseare: the Extract File name, the Control File name, the destination ExtractFile name, the user requesting the Convert Process, the date and time theprocess was executed. This is followed by: the number of tables, thenumber of rows in the Extract File to be converted, the number of rowssuccessfully converted, and the number of rows having conversion errorsand the number of rows discarded by an exit routine.

Display ReportContents

Report Contents

Report Format

Page 447: Move for DB2 User Guide

5.8 Convert Process

User Manual 433

The tables are listed below this with a complete breakdown of thetotals for each table. The sequence in which the tables are listed is theorder in which these tables were specified in the Extract File.

If aging parameters have been specified for the process, the reportalso includes:

• Any exception conditions encountered for each table. (This isincluded only when you specify Yes to Report Skipped Datesand Report Invalid Dates.) The following is a sample list ofexception conditions for aging ORDER_SHIP_DATE in theORDERS table:

Exception Conditions for Table PSTDEMO.ORDERS

Row 1: Field ORDER_SHIP_DATE (MM/DD/YY) cannot age date: X’0’Row 78: Field ORDER_SHIP_DATE (MM/DD/YY) cannot age date: X’1’

• The aging parameters specified for the process. These are listed afterthe summary information. For example, the following listsspecifications for a Convert Process that uses many of the defaults.

Processing Parameters: Default Aging Amount: =’2000/01/31’ Default Aging Table: PSAPRULE Default Aging Rule: NEXTWORKDAY Century Pivot Year: 65 Process Date Columns: Y Report Invalid Dates: YES Report Skipped Dates: YES Output Rows With Invalid Dates: YES Output Rows With Skipped Dates: YES

• The aging results for each table include the information as

specified on the Specify Aging Parameters panel. Theinformation includes:

Destination Column/Source Column namesNumber of valid datesNumber of invalid datesNumber of skipped datesMinimum value encounteredMaximum value encounteredDate formatAging Rule applied to columnRule Table containing Aging Rule applied to columnAging Amount applied to columnPivot year specifications for column

(The format for DB2 DATE and TIMESTAMP columns isdisplayed as DB2 DATE and DB2 TMSTAMP.)

Aging Parameters

Page 448: Move for DB2 User Guide

5. Data Migration

434 Move for DB2

While browsing the CONVERT Process Report online, you can usethe OUTPUT command to direct the contents of the report to anoutput file or SYSOUT. A panel is displayed prompting for thenecessary information based on the specified output destination. (Fordetails on the OUTPUT command, see Relational Tools CommandReference Manual.)

After the Convert Process has executed, you can review the resultingExtract File to ensure the transformation of the data. Use Option BBROWSE on the Data Migration menu to display the contents of theExtract File.

Rows are discarded when a requested conversion cannot beperformed. For example, a row is discarded if an expression,specified to convert the source, would result in an invalid data typefor the column. The discarded rows are noted in the Control File.Use Option B on the Data Migration menu to display the ControlFile to determine which rows were not converted.

Also, rows can be discarded by user-defined exit routines. Theserows are also included in the Control File.

Print Report

Discarded Rows

Page 449: Move for DB2 User Guide

5.9 Retry/Restart Process

User Manual 435

5.9 Retry/Restart Process

MOVE keeps track of the Insert, Update/Insert and Delete processesthat do not complete successfully and stores this information in thePrinceton Softech Directory. This information includes the type ofprocess, name of the Control File, the date and time the process wasperformed, and whether the process can be retried or restarted.

When one or more rows were discarded during the process, theprocess can be retried. A row might be discarded because of RIconflicts. For example, attempting to insert a child row that refers toa non-existent parent row.

When a process does not execute to completion, the process can berestarted. For example, a process may not complete if it exceeds theallowable CPU limit.

When you select Option R, RETRY/RESTART, from the DataMigration menu, a list of pending processes initiated by the currentuser is displayed.

--------------------- Pending Process List for PSTDEMO ------------------ Command ===> Scroll ===> CSR

Cmd Timestamp Process/Status Control File --- -------------- -------------- --------------------------------------- *** ********************************** TOP ****************************** ___ 12-15-98 11.15 DELETE RESTART Z13600MP.PSTDC.EXTRACT.SAMPLE1 ___ 12-15-98 12.30 INSERT RETRY Z13600MP.PSTDC.EXTRACT.SAMPLE2 ___ 12-16-98 02.35 UPDATE RETRY Z13600MP.PSTDC.EXTRACT.SAMPLE3 ___ 12-16-98 03.23 INSERT RESTART Z13600MP.PSTDC.EXTRACT.SAMPLEX

Figure 207. Pending Process List - User's SQL ID

The fields on the panel are:

Cmd Line command entry field. The following linecommands are available:

I Display information about a pending process.

D Delete a pending process.

S Select a pending process.

Timestamp Date and time the process was performed. The listis arranged by timestamp in ascending order.

RETRY

RESTART

Menu Option

Panel Fields

Page 450: Move for DB2 User Guide

5. Data Migration

436 Move for DB2

Process/Status The process that was being performed and thestatus of that process.

The process is indicated as:

DELETEINSERTUPDATE

The status is indicated as:

RETRY Rows were discarded and can beretried.

RESTART Process did not complete and can berestarted.

*DELETE Process has been deleted using theDelete line command.

If the Extract File has been used since theprocess listed on this panel, MOVE cannotguarantee that its contents applies to the ControlFile therefore it is no longer valid. If you attemptto retry, restart, or display information about thisprocess, the Process and status information isreplaced with *INVALID. This process cannotbe retried or restarted.

RETRY and RESTART can apply to anyprocess as appropriate. For example, a processin RETRY status cannot be restarted.

Control File The name of the Control File created by theprocess and required for the RESTART orRETRY.

Page 451: Move for DB2 User Guide

5.9 Retry/Restart Process

User Manual 437

You can display a list of all pending processes for all users using theALL command. The following is the display for all SQL IDs.

-------------------------- Pending Process List ------------------------ Command ===> Scroll ===> CSR

Cmd SQLID Timestamp Proc/Status Control File --- -------- ------------- --------- -------------------------------- *** ******************************** TOP **************************** ___ PSTDEMO 12-15-98 01.15 DEL RSTRT Z13600MP.PSTDC.EXTRACT.SAMPLE1 ___ PSTDEMO 12-15-98 02.30 INS RETRY Z13600MP.PSTDC.EXTRACT.SAMPLE2 ___ PSTDEMO 12-16-98 02.35 UPD RETRY Z13600MP.PSTDC.EXTRACT.SAMPLE3 ___ PSTDEMO 12-16-98 03.23 INS RSTRT Z13600MP.PSTDC.EXTRACT.SAMPLEX ___ SOFTECH 12-10-98 03.39 INS RSTRT Z13600MP.PSTDC.EXTRACT.SAMPLEY ___ SOFTECH 12-10-98 04.30 INS RSTRT Z13600MP.PSTDC.EXTRACT.SAMPLE4

Figure 208. Pending Process List - All SQL IDs

The display includes the SQL ID and other information as shown inFigure 208. Pending Process List - All SQL IDs. The Process/Statusfield is abbreviated to accommodate the addition of the SQLID field.Therefore, the status RESTART is shortened to RSTRT.

The list of all pending processes is arranged by SQLID in ascendingorder. Within each set of SQLIDs, the list is arranged by timestampin ascending order.

You can toggle between the display of all pending processes and onlythe processes for the current user, by entering ALL, for the completelist, and USER, for the user-specific list.

These pending process lists can be scrolled using the standard ISPFscrolling facilities.

You can display additional information about any of the listed pendingprocesses. Use the Information line command, I. For example, assume Iis entered for the first process, the following panel is displayed.

--------------------- Pending Process Attributes --------------------Command ===>

Control File: Z13600MP.PSTDC.EXTRACT.SAMPLE1Status : RESTART

Extract File: Z13600MP.PSTDC.XFILECreated By : COHEND Job : COHEND SQLID : SOFTECH Run On : 1998-04-13 14.07.10

Last Process: DELETE Job : COHEND SQLID : SOFTECH Run On : 1998-04-13 16.57.53

Figure 209. Pending Process Information

List All PendingProcesses

Information aboutProcess

Page 452: Move for DB2 User Guide

5. Data Migration

438 Move for DB2

Use END to return to the Pending Process List panel.

Use the Select line command, S, to select a process from the list. Theprocess is retried or restarted based on its status.

When the process is retried or restarted, the Parameters panel for theprocess is redisplayed appropriately. The panel title indicates whetherthe process is Insert, Update/Insert, or Delete and whether theexecution will be a retry or a restart. Although you cannot change thenames of the Extract File DSN and the Control File DSN, you canrespecify the other parameters. For example, the following figure isdisplayed when a Delete Process is restarted. (For details, see theinformation about the specific process Parameters panel.)

---------------- Specify Restart DELETE Parameters and Execute -----------Command ===>

Data Set Names for Extract File and Control File: Extract File DSN : PSTDEMO.EXTRACT.SAMPLE1 Control File DSN : Z13600MP.PSTDC.EXTRACT.SAMPLE1

Process Options: Lock Tables During Process ===> Y (Y-Yes, N-No) Commit Every Nth Row ===> 100 (1-1000, Blank-Site Limit) Limit Number of Discarded Rows ===> 1000 (1-999999, Blank-No Limit) Run Process in Batch or Online ===> B (B-Batch, O-Online) If Batch, Review or Save JCL ===> (N-No, R-Review, S-Save)

Figure 210. Restart Delete Process

When the Restart is invoked, the process is restarted with the rowafter the last committed deleted row. Any discarded rows from theoriginal processing are retained. Any rows discarded by thisexecution are marked accordingly.

Processing notification is provided for online execution. Also, aProcess Report is generated.

If the process completes successfully and there are no rows to retry orrestart, the entry is deleted from the Pending Process List. If theprocess does not complete successfully, the entry is retained. Theprocess can then be retried or restarted as required.

Select Process

Parameters PanelRedisplayed

Page 453: Move for DB2 User Guide

5.10 Browse Extract File

User Manual 439

5.10 Browse Extract File

The Browse Extract File option allows you to display the contents ofan Extract File or a Control File. This is useful when an Insert,Delete, Convert, or DB2 LOAD Process did not successfullycomplete. You can examine the discarded rows to determine thenature of the problems that may need to be handled. You can displaythe contents of the Extract File based on the status information in theControl File for discarded rows or incomplete activity.

Browsing the Extract File is also helpful in determining the content ofthat file.

When you select Option B BROWSE on the Data Migration menu,the following panel is displayed.

------------ EXTRACT or CONTROL File Browse Parameters --------------------Command ===>

Specify Extract File or Control File Data Set Name. Use Control File ifrow status information is to be included in browsed data or if row statusinformation is to be used for filtering browsed data.

Provide Extract or Control File Data Set Name: DSN ===>

Provide Table Name to Browse (Blank for ALL Tables in Extract): Table Name ===>

For Control Files Only: Include Row Status ===> X (N-No, Y-Yes, X-Include Explanations) Filter Extract Rows ===> _ (E-Error Rows Only, A-All)

Provide Data Set Name if Output to Disk (Blank for Temporary Data Set): DSN ===>

If Display Length Exceeds File Width ===> (C-Change File, W-Wrap Data)

Figure 211. EXTRACT or CONTROL File Browse Parameters

The fields on the panel are:

Extract or ControlFile DSN

Data set name of the Extract File or theControl File to use for constructing thebrowse output. The Control File containsthe name of the associated Extract File.When the Extract File is to be browsedwithout regard to row status, you canspecify either. However, if row status is tobe displayed or used to selectively displayrows, you must specify the Control File.Only the Control File contains informationabout row status.

Panel Fields

Page 454: Move for DB2 User Guide

5. Data Migration

440 Move for DB2

You can obtain a selection list of ExtractFiles or Control Files using * or % as a wildcard character in the last position of thename. (A sample of the selection listdisplayed for Extract File or Control Filedata set names is provided in Figure 165.Select Extract Data Set on page 311.)

Table Name Name of a single table in the Extract File tobe browsed.

If blank, all tables in the Extract File areincluded in the browse.

If a Creator ID is specified followed by aperiod, as in PSTDEMO, then all tableswith that Creator ID are listed.

Include Row Status Specifies whether the row status defined inthe Control File is displayed with the data.Specify:

YES Row status is included. A ControlFile DSN must be specified,otherwise this choice is ignored.

NO Row status is not included.

X Include explanations of the errorwith the SQL error code and theconstraint or column name if any.For more information about theSQL errors that are documented inthe Control File, see page 423.

The row status will show the result ofprocessing each row. For example, thestatus shows whether the row wasdiscarded.

Filter Extract Rows Specifies whether all of the rows in theExtract File are included or just the rowsthat have been discarded. Specify:

E Only rows in error, the discardedrows, are included. A ControlFile DSN must be specified,otherwise this choice is ignored.

A All rows are included.

Page 455: Move for DB2 User Guide

5.10 Browse Extract File

User Manual 441

Provide Data SetName

Data set name of a sequential file to containthe browse data. Specify only if the data isto be saved. If not specified, the browsedata is put in a temporary data set for thebrowse operation and is not retained.

If the specified data set does not exist,MOVE prompts for allocation informationand allocates the file. (See Appendix B.Allocating External Files for detailsregarding file allocation.)

This field contains 46 spaces providing for44-character names and, if necessary,delimiters. Explicit names must bedelimited by single quotes; otherwise, aprefix as specified on the User Optionspanel is added to the user-specified name toobtain the data set name.

If Display Length FileWidth

Specify what action should be taken whenthe display length of the data exceeds thewidth of the file. Specify:

C Change file characteristics toaccommodate the data.

W Do not change the filecharacteristics. The data will bewrapped onto multiple lines.

The LIST TABLES command is available to obtain a list of tables inthe named Extract or Control File. The LIST TABLES commandaccepts no parameters.

Use the Select line command, S, to select the tables.

The following commands are available on the EXTRACT BrowseParameters panel:

CANCEL END LIST TABLES OPTIONS

LIST TABLESCommand

AvailableCommands

Page 456: Move for DB2 User Guide

5. Data Migration

442 Move for DB2

Assume you have selected a Control File namedPSTDEMO.SAMPLE.CONTROL and specified that all rows andtheir status are to be included in the display. The following figureshows the formatted contents of the Control File.

BROWSE -- SYS94031.T141746.RA000.COHEND.R0000049 -- LINE 00000000 COL 001 080Command ===> Scroll ===> PAGE********************************* TOP OF DATA ******************************

Extract File Print Report

Extract File : PSTDEMO.SAMPLE.EXTRACT Created by : Job COHEND using SQLID PSTDEMO on DB3 Subsystem TDB2 Created on : 15 Sep 1998 at 10:53 AM Number of Tables : 4

Control File : PSTDEMO.SAMPLE.CONTROL Processing Status: Retry of Delete Process Started Processed by : Job COHEND using SQLID COHEND on DB2 Subsystem TDB2 Process on : 15 Sep 1998 at 03:01 PM

Table Statistics: PSTDEMO.CUSTOMERS Status of Processing on Table : Started Destination Table Being Processed : PSTDEMO.DESTABLE Column Map Being Used for Process : COHEND.COLMAP2 Total Number of Rows : 32 Rows Successfully Deleted : 11 Rows to be Deleted not Found : 0 Rows to be Deleted with Mismatching Columns : 0 Rows not yet Processed : 19 Rows not Processed because of Errors : 2

Figure 212. Browse Control File - Statistics

Statistical information is displayed at the top of the data. Thisincludes the names of the Extract and Control Files as well as thename of each destination table and statistics that summarize theprocessing. Some statistics are dependent on certain processes andmay not be included in the report.

Browse Example

Page 457: Move for DB2 User Guide

5.10 Browse Extract File

User Manual 443

To view the rows in the Control File from each table, scroll thedisplay. The following figure displays several rows from theCUSTOMERS table. Note the status in the Status field on the left isprovided only when the Control File is used.

BROWSE -- SYS94031.T141746.RA000.COHEND.R0000049 -- LINE 00000019 COL 001 080Command ===> Scroll ===> PAGE

Status CUST_ID CUSTNAME ADDRESS CITY ST------------ ------- -------------------- -------------------- ----------- --OK: 1 07006 Excalibur Video 35 Seminary Ave Harvard MAOK: 1 07260 Five Star Videos 123 Howe Lane Boston MAOK: 1 07235 Jack's Grafton Plaza Grafton MAPOSTPONED 07440 Monarch Movies 280 Chestnut St Springfield MAOK: 1 07201 Movie Buff 400 Merrimac Concord MAOK: 1 07101 Movie Mania 572 Front St Auburn MAOK: 1 07126 Movie Rentals 101 Munson St Greenfield MAOK: 1 07118 Movie Store 752 State Road Menemsha MAOK: 1 07203 Movies-R-Us 1772 Bridge St Bourne MAOK: 1 07191 Popcorn 15 Crystal Park Lenox MAOK: 2 07156 Prime Tyme 982 Upper State St Marion MAOK: 3 07140 ProMusic 84 Second Ave Chicopee MAUNPROCESSED 07160 Reely Great Videos 590 Frontage Rd Amherst MAUNPROCESSED 07053 Replay Video 9032 Dickerson St Amherst MAUNPROCESSED 07150 Rick's Flicks 823 Chestnut St Springfield MAUNPROCESSED 07140 Showcase 1150 Indiana Terr Beverly MAUNPROCESSED 07141 Showcase II 57 Rock Hollow Salem MA

Figure 213. Browse Control File - Status of Each Row

The status of each row is listed on the left-hand side of the panel. Thepossible values and their meaning are:

OK: nnnnn The row was successfully processed. Thenumber represents the Logical Unit of Work inwhich it was processed. (A Logical Unit ofWork ends with each commit.)

UNPROCESSED The row has not been processed. This occurswhen a process has not been performed yet, theprocess was aborted before handling this row,or the row was not part of the process.

DB2: -nnn The row could not be processed because of aDB2 error. The number represents the DB2SQLCODE. (For a list of SQL codes that areaccompanied with an explanation, if requested,see page 445. )

RI ERROR The row could not be processed because of aviolation of RI rules defined to DB2. Thisstatus is provided after retrying a row in acycle and the row is not successfully insertedwhen the process completes. (Note, when acycle is not involved, a DB2 diagnostic isdisplayed in the format DB2: -nnn.)

Possible Status

Page 458: Move for DB2 User Guide

5. Data Migration

444 Move for DB2

POSTPONED The row could not be processed because of aviolation of RI rules, but this row may besuccessfully processed later in the cycle.

However, the process was terminated beforethis row could be reprocessed. This status isalso set for rows that failed because of DB2errors that are being retried.

CONV ERROR The row was discarded because one or morecolumns could not be properly converted fromthe Extract File format to the database format.This can occur when the Extract File columncontains NULL and the DB2 column is definedas NOT NULL or when the Extract Filecolumn value and the DB2 column data typesare not compatible. This row cannot berestarted or retried. (For details on data typecompatibility, see page 235.)

NOT FOUND The row could not be found for a DeleteProcess.

MISMATCH One or more columns on the Extract File didnot match the column in DB2 for a DeleteProcess.

MISM PEND One or more columns on the Extract File didnot match the column in DB2 for a DeleteProcess, but this row may be successfullyprocessed later in the process. However, theprocess was terminated before this row couldbe reprocessed. This occurs when deletingfrom tables with non-unique primary keys.

DUP PK The row was discarded because it has a DB2primary key that is the same as another row onthe Extract File. This duplicate row cannot berestarted or retried. This can occur only whenperforming an Update/Insert. Before insertingthe row, MOVE checks the destination. If thedestination table is defined with a unique keybut the Extract File contains multiple sourcerows, only the first encountered row is applied,the others are discarded with this status and arenot processed further.

Page 459: Move for DB2 User Guide

5.10 Browse Extract File

User Manual 445

EXIT ERROR The row was discarded by a user column exit.This row cannot be restarted or retried.

Rows with certain SQL error codes are treated as row errors. Whenyou specify X for the prompt Include Row Status, pertinent errormessages are included. The following are the SQL error codes andthe accompanying messages.

-161 THE RESULTING ROW DOES NOT SATISFY THE VIEW DEFINITION

-404 STRING IS TOO LONG FOR DESTINATION COLUMN name

-407 DESTINATION COLUMN name CANNOT HAVE NULL VALUE

-530 INSERT OR UPDATE OF FOREIGN KEY name IS INVALID

-531 PRIMARY KEY HAS DEPENDENT ROW IN RELATIONSHIP name

-532 RELATIONSHIP name RESTRICTS THE DELETION OF A ROW

-545 CHECK CONSTRAINT name HAS BEEN VIOLATED

-551 USER DOES NOT HAVE PRIVILEGE TO PERFORM THE OPERATION

-552 USER DOES NOT HAVE PRIVILEGE TO PERFORM THE OPERATION

-629 FOREIGN KEY name CANNOT CONTAIN NULL VALUES

-652 VIOLATION OF INSTALLATION DEFINED PROCEDURE name

-681 COLUMN name IN VIOLATION OF FIELD PROCEDURE

-803 INDEX IN INDEXSPACE name DOES NOT ALLOW DUPLICATEVALUES

When a conversion error occurs, the column containing the error isdisplayed and a right-arrow, >, is placed to the left of the data inerror. The right-arrow highlights the location of the error and can beused on the FIND command to locate these errors.

The contents of the Extract File or Control File can be printed. Foradditional information see Appendix E. Printing Extract andControl Files.

Several primary commands are available to manipulate the display:

BOTTOM END LOCATE UPCANCEL FIND RIGHT TOPDOWN LEFT RFIND

SQL Error Codesas Row Errors

About ConversionErrors

Available PrimaryCommands

Page 460: Move for DB2 User Guide

User Manual 446

6. Specify Options

Several options are available to control the functions performed whileusing MOVE. These options can be modified by selecting Option 0on the Main Menu or by entering the OPTIONS command from anypanel with a COMMAND prompt. User Options, Edit and DisplayOptions, and JOB Card information are specified on separate panels,therefore a submenu is displayed.

------------------------- Choose Option Type ------------------------ OPTION ===>

1 USER - User Options 2 EDIT - Editor and Display Options 3 JOBCARD - Job Card and Print Options 4 COMPARE - Compare Options 5 ARCHIVE - Archive Options

Figure 214. Options Menu

The first three options are used by MOVE. Options 4 and 5,COMPARE and ARCHIVE, are available only when Compare forDB2 and Archive for DB2 are installed. For information about theseOptions, see the respective product’s User Manual.

An additional option, 0 Site Options, is displayed for any user havingan authorized password. For detailed information on Site Options seethe Princeton Softech Relational Tools Installation andAdministration Guide.

The format of these Options panels is either full-screen or pop-upbased on how the panel was accessed. When invoked from theOPTIONS command, the panels are pop-up. The full screen formatis always displayed when selected through the Main Menu.

The values you specify on the Options panels are profiled.

Options Menu

Panel Format

Values Profiled

Page 461: Move for DB2 User Guide

6.1 User Options

User Manual 447

6.1 User Options

User options determine several user-specific parameters that govern aMOVE session. When you select Option 1 from the Choose OptionType menu, the following panel is displayed.

------------------------------ User Options ------------------------- Command ===>

Caps Mode On ===> N Y-Yes, N-No Confirm on Deletes ===> N Y-Yes, N-No Load Utility to Use ===> D D-DB2, B-BMC Submit Jobs with END ===> Y Y-Yes, N-No Display DB2 SubSystem ===> N Y-Yes, N-No Selection List Format ===> S S-Short, F-Full, D-Desc Data Set Prefix ===> USERID PREFIX, USERID, NONE or value User Supplied Password ===> Enable Administrator Mode

Change Line Characters ===> N Y-Yes, N-No Print Tables in JCL ===> 1 1-No, 2-Ext/Arc, 3-Ins/Res, 4-All Review Job Card =èè N Y-Yes, N-No

Figure 215. User Options Panel

The user options include:

Caps Mode On Specifies whether all edited data is translated toupper case or maintained as entered. Thisapplies to specifying selection criteria. Specify:

Yes Caps Mode is on.

No Caps Mode is not on.

Confirm on Deletes Specifies whether a confirmation prompt isdisplayed every time an Access Definition,Primary Key, Relationship, Table Map, orColumn Map is deleted. Specify:

Yes Confirmation prompt is displayed.

No Confirmation prompt is not displayed.

Load Utility to Use Specifies the load utility to be used for the DB2Load process. Site management may establish anon-modifiable default value. If modifiable,specify:

D IBM’s DB2 Load Utility is used.

B BMC’s LOADPLUS Utility is used.

Panel Fields

Page 462: Move for DB2 User Guide

6. Specify Options

448 Move for DB2

Submit Jobs withEND

Specifies whether jobs are automaticallysubmitted when END is used while reviewingJCL for any batch job. The jobstream isgenerated by MOVE for the processes itperforms and can be displayed in the ISPF editorprior to job submission. While in the ISPFeditor, all standard ISPF facilities are availableincluding saving the jobstream. Use this optionto establish whether the job is automaticallysubmitted when you exit the ISPF editor.Specify:

Yes Submit job.

No Do not submit job. The SUBMITcommand must be used to submit thejob.

Display DB2SubSystem

Specifies whether the DB2 subsystem isdisplayed on the second line on the right handside of every Relational Tools panel. Specify:

Yes DB2 Subsystem is displayed.

No DB2 Subsystem is not displayed.

If connected to a remove subsystem, the DB2subsystem is replaced with the location of theremove subsystem.

Selection List Format Specifies which information is presented on aselection list of PST objects (Access Definitions,Table Maps, Column Maps, Relationships andPrimary Keys). Specify:

S Short format. Modificationinformation displays along with theobjected name. (This is the displayused throughout this manual.)

D Description is displayed along with theobject name.

F Information is presented on two linesper entry. The first line is the same asfor Short format. The second linedisplays the description and the securitystatus if other than PUBLIC.

Information about specifying security statusis provided on page 451.

Page 463: Move for DB2 User Guide

6.1 User Options

User Manual 449

Data Set Prefix Specifies the default value to be used as the highorder qualifier for any data set name that is notenclosed in apostrophes. Specify:

PREFIX The user’s TSO PREFIX is used.PRFX is an alternate form.

USERID The current user’s TSO user ID isused. USER is an alternate form.

NONE A prefix is not used.

Value An explicit 1- to 17-character valueto be used. This can be acombination of PREFIX, USERIDand a literal.

User SuppliedPassword

Enables specification of the password required tomodify the site options on the Site Optionspanel. If the password supplied in this fieldmatches the Administrator Password, the currentuser can access the Site Options panel.

Change LineCharacters

Enables users to respecify the characters used todefine the perimeter of pop-up windows. (SeeFigure 216. Line Characters Pop-up Prompt)Specify:

Yes Display the line characters prompts.

No Do not display the line charactersprompts.

Print Tables in JCL Enables user to insert a list of tables thatparticipate in a batch process as comments in theJCL. The list of tables is displayed when youreview JCL before submitting a job or browsethe saved JCL. Specify:

1 Do not list tables for a batch process.

2 List source tables in a batch Extractor Archive Process.

3 List source and destination tables in abatch Insert, Update, or RestoreProcess.

4 List all tables in a batch Extract,Archive, Insert, Update, or RestoreProcess.

Page 464: Move for DB2 User Guide

6. Specify Options

450 Move for DB2

Review Job Card Specifies whether the job card prompts on theJob Card and Print Options panel aredisplayed enabling users to respecify the jobstatement and several other job parametersbefore submitting a batch job. (See Figure 219.Job Card and Print Options.) Specify:

Yes Display the job card prompts.

No Do not display the job card prompts.

Page 465: Move for DB2 User Guide

6.1 User Options

User Manual 451

Change Line Characters

If you specify Yes to Change Line Characters, the prompt isdisplayed as shown in the following figure. Only the characters youspecify to override the default characters are displayed.

--------------------- User Line Drawing Characters -----------------

Top Left Corner ===> Any Displayable Character Top Right Corner ===> Any Displayable Character Bottom Left Corner ===> Any Displayable Character Bottom Right Corner ===> Any Displayable Character Horizontal Bar ===> Any Displayable Character Vertical Bar ===> Any Displayable Character Forward Slash ===> Any Displayable Character Backward Slash ===> Any Displayable Character

Figure 216. Line Characters Pop-up Prompt

To reset any of the values to the site defaults, leave the field blank.

When you have completed this pop-up prompt, press ENTER orEND.

Specify Description and Security Status

You use the Selection List Format option to specify whether thedescription and security status are displayed on the selection list ofPST Directory objects. However, to specify the description andsecurity status, use the ATTRIBUTES command from the objecteditor or the AT line command on the selection list to display promptsfor specifying these values.

Page 466: Move for DB2 User Guide

6. Specify Options

452 Move for DB2

The prompts are displayed on the Object Attributes panel. In thefollowing figure, the attributes for an Access Definition namedPSTDEMO.PSTDEMO.SAMPLE are displayed.

------------------------- Select Access Definitions --------------------------Command ===> Scroll ===> PAGE

----- Access Definition ------ ------ Last Modified ------- 1 OF 8Cmd--- - +-----------------------Object Attributes-----------------------+ * ¦ ¦ ***___ P ¦ Object Name: PSTDEMO.PSTDEMO.SAMPLE ¦___ P ¦ ¦___ P ¦ Modify the attributes below as needed. ¦at_ P ¦ ¦___ P ¦ Description ===> ¦___ P ¦ ¦___ P ¦ Security Status ===> PUBLIC (PUBLIC, PRIVATE, READONLY) ¦___ P ¦ ¦ * ¦ Use END command to accept any changes and return. ¦ *** ¦ Use CANCEL command to ignore any changes and return. ¦ ¦ ¦ +---------------------------------------------------------------+

Figure 217. Object Attributes

The name of the object is displayed. You specify the following:

Description Specify a 1 to 40 character description of theobject.

Security Status Specify the access privileges for the named objectas one of the following:

PUBLIC Any user can access and editthe object.

PRIVATE Only the user that created theobject can access and edit theobject.

READONLY Any user can access theobject, but only the user thatcreated the object can edit it.

Site management determines whether or notsecurity status is available. If it is not available,this prompt is not displayed.

Panel Fields

Page 467: Move for DB2 User Guide

6.2 Editor and Display Options

User Manual 453

6.2 Editor and Display Options

A set of editor and display options are available. When you selectOption 2 from the Options menu, the following prompts aredisplayed.

------------------------ Editor and Display Options ----------------------Command ===>

NULL Value Indicator ===> ? ?,!,&,%,#,@DB2 VarChar Delimiter ===> ; ;,:,?,!,&,%,#,@AutoCommit Mode ===> A A-Automatic, M-ManualDeleted Rows Display ===> S S-Show, H-HideAudit Mode : OFF Forced OFFMaximum Fetch Rows ===> 500 In Range (1 - 500)Display Column Attributes ===> N Y-Yes, N-NoDisplay Data in Hex ===> N Y-Yes, N-NoEditor Display Format ===> C C-Columnar, S-SidelabelsColumnar Max Display Width ===> 20 In Range (15 - 70)Sidelabels Max Display Width ===> 50 In Range (50 - 32767)User Supplies Defaults ===> N Y-Yes, N-NoNULL as Insert Default ===> N Y-Yes, N-NoEditor Exit Processing ===> E E-Entry Panel, P-Prompt PanelENTER Exits Criteria Panels ===> A A-Always, N-Never, U-UnchangedAutoSwitch Mode ===> Y Y-Yes, N-NoSingle View Mode ===> N Y-Yes, N-No

Figure 218. Editor and Display Options Panel

The editor and display options include:

NULL ValueIndicator

Specifies the character to be used to represent thenull value. The default character is question mark,"?". The possible characters are listed on thepanel.

DB2 VarCharDelimiter

Specifies the character that is used by MOVE todelimit the end of a variable length character stringwith significant trailing blanks. The defaultcharacter is the semicolon, ";". The possiblecharacters are listed on the panel.

For example, if the string "ABC " is entered in avariable length character field, it is retained as"ABC" unless a delimiter is used to indicateotherwise. Assume the delimiter character is ";",the string entered as "ABC ; , is retained as "ABC".

AutoCommitMode

Specifies whether edited data is automaticallycommitted with each screen interaction. (Accessfor DB2 only.)

Panel Fields

Page 468: Move for DB2 User Guide

6. Specify Options

454 Move for DB2

Deleted RowsDisplay

Specifies whether rows deleted during an editsession are displayed. (Access for DB2 only.)

Audit Mode Specifies whether the Audit Facility is activeduring an edit session. Site management controlswhether this option is available. (Access for DB2only.)

Maximum FetchRows

Defines the maximum number of rows that can beaccessed from any one table displayed duringPoint-and-Shoot or browse. The value can be from1 to the site-defined maximum. The figure showsthe distributed default maximum, 500 rows. Sincethe default maximum is site-defined, the value maybe different at your site.

The MAXIMUM FETCH ROWS command canbe used during the session to modify this value foronly the current session. This command takeseffect immediately and all data is refetched.

Display ColumnAttributes

Specifies whether the column attributes or type,dimension and nullability are displayed. Forcolumn display, the attributes are displayeddirectly below the column heading for eachcolumn. For sidelabels display, the attributes aredisplayed to the left of the column heading.Specify:

Yes Attributes displayed.

No Attributes not displayed.

The ATTRIBUTES command can be used duringthe session to specify whether or not columnattributes are displayed.

Display Data inHex

Specifies whether character data is displayed onlyin text format or in text and hexadecimal format.Specify:

Yes Hexadecimal format displayed.

No Hexadecimal format not displayed.

When Yes is specified, each line of text requiresthree display lines: one for character text and twofor the corresponding hexadecimal values.

The HEX command can be used during the sessionto specify whether or not the hexadecimal format is

Page 469: Move for DB2 User Guide

6.2 Editor and Display Options

User Manual 455

displayed.

Editor DisplayFormat

Specifies the display format of the data. Specify:

C Display is columnar format.

S Display is sidelabels format.

For columnar format, multiple rows of data withcolumn headings above each column of data aredisplayed. For sidelabels format, a single row ofdata with column headings to the left of eachcolumn of data is displayed.

The SIDELABELS command can be used duringthe session to toggle the display between columnarand sidelabel.

Columnar MaxDisplay Width

Defines the maximum number of characters thatare displayed for each column of a columnardisplay format. This only affects the data displayduring a Point-and-Shoot or browse session. Thevalue can be from 15 to 70.

This value does not affect the actual width of thecolumn. If, however, this value is less than thetotal length for the column, that column display istruncated.

This has no impact on sidelabels display.

Sidelabels MaxDisplay Width

Defines the maximum number of characters thatare displayed for each column of a sidelabeldisplay format. This only affects the data displayduring a Point-and-Shoot or browse session. Thevalue can be from 50 to 32768.

This value does not affect the actual length of thecolumn. If, however, this value is less than thetotal length for the column, that column display istruncated.

This has no impact on columnar display.

User SuppliesDefaults

Specifies the default handling of columns definedby DB2 as columns that cannot have default valueswhen inserting a row. (Access for DB2 only.)

Page 470: Move for DB2 User Guide

6. Specify Options

456 Move for DB2

NULL as InsertDefault

Specifies the default handling of nullable columnsif these columns are blank when inserting a row.(Access for DB2 only.)

Editor ExitProcessing

Specifies the behavior when END is used toterminate an edit or browse session. Specify:

E The panel from which the session wasinvoked is displayed. This may be theDescribe Columns panel, SpecifySelection Criteria panel, or the SQLWHERE Clause panel.

P The prompt panel from which the sessionwas initiated is displayed. This may be aChoose panel or a selection list of tables orAccess Definitions.

ENTER ExitsCriteria Panels

Specifies when the ENTER key can be used to exitthe Specify Selection Criteria panel, the SQLWHERE Clause panel, and the DescribeColumns panel during a browse session. Specify:

A The ENTER key acts as the same as theEND key (usually PF3) and always exitsthe panel unless errors are detected.Default.

N Only the END key exits the panel. TheENTER key never exits the panel.

U The ENTER key exits the panel only whenthe values on the panel are not changed. Ifvalues are changed, only the END keyexits the panel.

Page 471: Move for DB2 User Guide

6.2 Editor and Display Options

User Manual 457

AutoSwitch Mode Specifies whether AutoSwitch mode is enabled formulti-way joining during a browse session.

By default, when a parent table is scrolled, thecurrently displayed child table is also scrolled.Sometimes when scrolling, the child table has norelated rows to display.

AutoSwitch mode is useful when scrolling a parenttable that is joined to two or more children in astack. When the parent table is scrolled and thecurrently displayed child table has no related rows,AutoSwitch mode automatically displays the firstchild table in the stack that has at least one relatedrow. Specify:

Y Enable AutoSwitch mode.

N Disable AutoSwitch mode. (The child tableis not switched.) Default.

Single View Mode Specifies whether views can be joined whenbrowsing data. Specify:

Y Views cannot be joined. Single view modeis in effect.

N Views can be joined. Default.

Browsing views is faster and more efficient usingsingle view mode because the relationshipinformation is bypassed. However, if related datais to be displayed simultaneously, joining isrequired.

This option disables the Join Facility when theStart Table is a view. It cannot be modified froman editor session.

Page 472: Move for DB2 User Guide

6.3 Job Card and Print Options

User Manual 458

6.3 Job Card and Print Options

The Job Card and Print Options determine several user-specificparameters that govern batch execution. When you select Option 3 fromthe Choose Option Type menu or when you specify Yes to the ReviewJob Card prompt on the User Options panel, the following panel isdisplayed. The information displayed on the panel is initially set to theuser-specifications for ISPF option 0.2, LOG AND LIST DEFAULTS.

---------------------- Job Card and Print Options ------------------- Command ===>

Job Statement: ===>//SPECHTR JOB 'ACCT-INFO',MSGCLASS=8,CLASS=6, ===>// NOTIFY=SPECHTR ===> ===> ===>

Report Parameters: Report Type ===> D D-Dataset, S-SYSOUT If Dataset: DSN ===> PST.PRINT Disposition ===> M M-MOD, O-OLD If SYSOUT: SYSOUT Class ===> * A - Z, 0 - 9, * Destination ===> LOCAL Hold ===> Y Y-Yes, N-No

Prompt for Changes Before JOB Submission ===> Y-Yes, N-No

Figure 219. Job Card and Print Options

JOB Statement A 66-character wide area to provide thedefault job statement. Five lines areprovided. The first line must contain a linein the form:

//name JOB

where name is the job name.

Report Type Specify the type of report output to begenerated. Specify:

Dataset Report is placed in a data set.

SYSOUT Report is placed in SYSOUT.

Panel Fields

Page 473: Move for DB2 User Guide

6.3 Job Card and Print Options

User Manual 459

DSN Name of the data set to receive the report.This must be a sequential file.

Disposition Disposition of the data set. Specify:

MOD Append to existing data.

OLD Replace existing data.

SYSOUT CLASS Specify the SYSOUT class as one of thefollowing:

A -Z Any alphabetic character

0 -9 Any numeric character

* An asterisk, use job's msgclass

Destination Specify the destination of the SYSOUT file.

Hold Optionally, specify whether SYSOUT isheld. Specify:

YES SYSOUT file is held for onlineviewing.

NO SYSOUT file is available forprinting when execution iscomplete.

If not specified, the site default specificationis used.

Prompt for JobCard Changes

Specify whether or not the Job Cardinformation is displayed each time yousubmit a batch request to MOVE. Whendisplayed, you can change the job cardinformation before MOVE generates thecomplete JCL to execute your request. Youcan request a modifiable display of thecomplete JCL prior to any batch jobsubmission.

The Job Card information is profiled. If there is no profiled information,the Job Card is filled in with the ISPF variables, ZLLGJOB1 throughZLLGJOB4, from ISPF option 0.2 LOG AND LIST DEFAULTS.(Note if the information profiled exceeds the display width of 66characters, it is truncated.) Use the RESET command to reset the JobCard to these original values.

If Data Set:

If SYSOUT:

Job Card Profiled

Page 474: Move for DB2 User Guide

User Manual 460

7. Batch Maintenance Utilities

Batch utilities help you maintain the Relational Tools environment.These utilities are an efficient means of monitoring the usage of PSTobjects to ensure maximum benefit from the Relational Tool. Forexample, if a database table is removed or renamed, you can use abatch utility to generate an impact analysis report of PST objects thatreference the table or column. The report can be a useful tool to helpyou decide whether to remove and replace, or edit the affected PSTobjects. If you decide to remove the objects, another batch utilityallows you to delete the same PST objects from the Directory simplyby changing the command verb in the control statement fromDIRECTORY to DELETE. You can also use the utilities to auditcompliance with naming standards for PST objects or reviewownership of the objects.

Batch utilities also automate certain online functions such as, copyingPST objects in a Directory and migrating PST objects acrossDirectories.

Categories of batch maintenance utilities are:

• Utilities to retrieve information from the Princeton SoftechDirectory.

• Utilities to maintain PST objects in the Directory.

• Utilities to migrate PST objects.

Page 475: Move for DB2 User Guide

7. Batch Maintenance Utilities

User Manual 461

The JCL needed to migrate PST objects is described in Section 7.3Utilities to Migrate PST Objects. The JCL needed to executeutilities for information retrieval and Directory maintenance is:

// EXEC//

PGM=PDPMMAIN,REGION=0M,PARM=' CON UTILITY subsys planname sqlid userid '

//SYSPRINT//SYSTERM//PDPDDFLT//PSTRACE//PSDFASUM//PSDFADIR//PSDFAREP//SYSIN

/*

DD SYSOUT=*DD SYSOUT=*DD DSN=your.loadlib.(PDPDDFLT)DD SYSOUT=*DD SYSOUT=*DD SYSOUT=*DD SYSOUT=*DD *control statements

DEFAULT SITE OPTIONS

SUMMARY LISTING FILEDIRECTORY LISTING FILEREPORT LISTING FILE

A sample of this JCL is provided in the install library as memberJCLOBUTL.

To use a custom module for default site options, replace "PDPDDFLT"with the name of the data set for the module. To direct listings forPSDFASUM, PSDFADIR, or PSDFAREP to a data set, rather than toSYSOUT, define attributes of the data set as:

RECFM=F or FBLRECL=132

Also, block size must be a multiple of 132. The data set may besequential or partitioned. Note that, unlike a listing directed toSYSOUT, there is no carriage control byte before each line.

If no errors are found during the run, the return code is 0. If errorsare found, the return code is 12.

Insert control statements for the functions after the SYSIN DD *statement. Available control statements and their functions includethe PAGESIZE, ERROR, and OUTDD statements, which affect theexecution of other control statements. They are discussed in detail inSection 7.4 General Batch Control Statements. The remainingcontrol statements, grouped according to function, are discussed onthe following pages of this section.

JCL Requirements

Error Codes

ControlStatements

Page 476: Move for DB2 User Guide

7. Batch Maintenance Utilities

User Manual 462

DIRECTORY A DIRECTORY statement generates a listingof PST objects that are in the Directory.

DELETE A DELETE statement removes PST objectsfrom the Directory.

RENAME A RENAME statement changes the name of aPST object in the Directory and generates areport about the renamed objects.

COPY A COPY statement reproduces PST objects,names the new objects, and generates a reportabout the copied objects.

General guidelines for formatting control statements are:

• Begin a control statement in any column.

• Separate keywords and values or operands with one or more blanks.

• Enclose a list specified as an operand in parentheses and separate itemsin the list with commas. Blanks after a comma are optional.

• Continue a statement on another line by breaking the statement witha blank after an operand and entering the next operand on the newline. End-statement or continuation indicators are not needed; a validcommand verb, such as DELETE or DIRECTORY, ends a controlstatement and begins the next.

• Indicate a comment line by placing hyphens or minus signs, incolumns 1 and 2. Single hyphens or hyphens in other columns do notindicate a comment.

• Be certain a keyword is appropriate for the specified TYPE. Using aTYPE-specific keyword with an inappropriate TYPE causes an errorcondition.

Informational

Maintenance –PST Objects andArchive Entries

Control StatementFormat

Page 477: Move for DB2 User Guide

7. Batch Maintenance Utilities

User Manual 463

The syntax used on the following pages to describe the control statementsis:

KEYWORD(S) A keyword is shown in uppercase. Generally, youmust provide a keyword as shown. However, theportion of a keyword in parentheses is optional.

text Variable text is shown in lowercase italics.

( ) A series is shown in parentheses. You must useparentheses as a delimiter, even if using a singleparameter in the series. For example, (text1, text2,…) or (KEYWORD1 text1, KEYWORD2text2,…).

[ ] Options are shown in square brackets.

{ } A choice is shown in curved brackets. You mustuse one of the parameters indicated as a choice.

| The "|" separates choices shown in curvedbrackets.

Page 478: Move for DB2 User Guide

7. Batch Maintenance Utilities

464 Move for DB2

7.1 Informational Control Statements

DIRECTORY Statement

The DIRECTORY, or DIR, statement is the only informational controlstatement available to MOVE. Use the Directory statement to generate areport of objects in the Directory. Such a report can be useful todetermine if, for example, any Column Maps are affected by changes to adatabase table. As further examples, you might obtain reports of:

• Access Definitions modified by a particular user.

• Generic Relationships

You can generate summary or detailed reports about Access Definitions,Column Maps, Table Maps, PST or DB2 Primary Keys, Relationships,or Compare Definitions. The contents of the report are based on thekeywords and operand values you specify. If you include multipleDIRECTORY statements in the JCL, each listing begins on a new page.

Directory Statement for PST and Certain DB2 Objects

To generate a report of PST or certain DB2 objects, use theDIRECTORY statement syntax as follows:

DIR ( ECTORY )TYPE { AD | CM | TM | R | PK | CD }NAME name[ MODIFIEDBY modifiedby ][ DESC desc ][ TABLE [ cid. ] tblname ][ DSNAME dsname ][ GROUP group ][ PNS { NO | YES } ][ ARC { NO | YES } ][ DB2 { NO | YES } ][ GENERIC { NO | YES } ][ SORT ( [ NAME, A | D ] [ GROUP, A | D ] [ DESC, A | D ]

[ DATE, A | D ] [ MODIFIEDBY, A | D ] ) ][ DETAIL { NO | YES } ][ PRINTCOL { ALL | NONE | SEL | ARC } ][ NEWPAGE { NO | YES } ]

Page 479: Move for DB2 User Guide

7.1 Informational Control Statements

User Manual 465

The keywords and values for operands are:

TYPE Type of objects to list. This keyword must beincluded in the DIRECTORY statement with one ofthe following:

AD List all Access Definitions that matchthe criteria.

CM List all Column Maps that match thecriteria.

TM List all Table Maps that match thecriteria.

R List all Relationships that match thecriteria.

PK List all Primary Keys that match thecriteria.

CD List all Compare Definitions thatmatch the criteria.

NAME Name of one or more objects. This keyword and thename operand must be included in theDIRECTORY statement.

name Specify as an explicit value or apattern, using SQL LIKE syntax.

Use the following keywords to further refine the criteria for objects to belisted.

MODIFIEDBY TSO ID of the last person to modify the objects.

modifiedby Specify as an explicit value or apattern, using SQL LIKE syntax.

DESC Case-sensitive descriptive information for the objects.

desc Specify as an explicit value or apattern, using SQL LIKE syntax.Delimit values that include blanks insingle (') or double (") quotes.

Required CriteriaKeywords

Optional CriteriaKeywords:

– For All PSTObjects

Page 480: Move for DB2 User Guide

7. Batch Maintenance Utilities

466 Move for DB2

TABLE Name of a table referenced in objects to be listed.

cid.tblname Indicate the table name. Prefix withCreator ID, if needed to identify thetable. Specify as an explicit value or apattern, ending with %.

DSNAME Data set name referenced in listed objects. Thereferenced data set may be a Point-and-Shoot File, aCompare File, an Extract File, or an Archive File.Use this keyword only if TYPE is AD or CD.

dsname Specify the fully qualified data setname, without quotes, as an explicitvalue or a pattern, ending with %.

PNS Point-and-Shoot attributes for the AccessDefinitions to be listed. Use PNS only if TYPE isAD.

NO List Access Definitions without regardto the Point-and-Shoot Start Tableoption.

YES List only Access Definitions that usethe Point-and-Shoot Start Tableoption.

If you do not use the PNS keyword, AccessDefinitions are listed without regard to Point-and-Shoot attributes.

ARC Archive criteria attributes for the Access Definitionsto be listed. Use this keyword only if TYPE is AD.

NO List Access Definitions without regardto archive criteria.

YES List only Access Definitions for whicharchive criteria are specified.

If you do not use the ARC keyword, AccessDefinitions are listed without regard to archivecriteria.

– For AccessDefinitions orCompareDefinitions

– For AccessDefinitions Only

Page 481: Move for DB2 User Guide

7.1 Informational Control Statements

User Manual 467

DB2 Type of primary keys or relationships to be listed. Usethis keyword only if TYPE is R or PK.

NO List only PST primary keys orrelationships.

YES List PST and DB2 primary keys orrelationships.

If you do not use the DB2 keyword, only PST primarykeys or relationships are listed.

GENERIC Generic attributes of objects to list. Use this keywordonly if TYPE is AD, PK, or R.

NO List objects without regard to genericattributes or references.

YES List only generic primary keys, genericrelationships, or Access Definitionsthat reference generic relationships.

If you do not use the GENERIC keyword, AccessDefinitions, primary keys, or relationships are listedwithout regard to generic attributes.

Use the following optional keywords to format the Directory Report.

SORT The sequence for list of objects in the report. If you do notspecify a SORT keyword, the items are listed in ascendingorder, by name.

NAME In order by name. NAME is thedefault.A In ascending order. A is the default.

D In descending order.

DESC In order by description.

A In ascending order. A is thedefault.

D In descending order.

DATE In order by date modified.

A In ascending order. A is thedefault.

D In descending order.

– For Primary Keysor Relationships

– For AccessDefinitions,Primary Keys orRelationships

Report FormattingKeywords

Page 482: Move for DB2 User Guide

7. Batch Maintenance Utilities

468 Move for DB2

MODIFIEDBY In order by TSO ID of the user that lastmodified the object.

A In ascending order. A is thedefault.

D In descending order.

DETAIL The level of detail in the report.

NO Report includes only Name,Description, Owner, Last ModifiedDate, and (if activated for site) SecurityStatus for each listed object. This isalso the information provided if you donot use the DETAIL keyword.

YES Report includes Name, Description,Owner, Creation or Last ModifiedDate, and Security Status for eachlisted object. The report also includesthe following information, according tothe type of object listed:

AD − Default Creator ID− Start Table name− Table List− Relationship Usage

information− Column information

(Optional, seePRINTCOL keyword,on page 469.)

– For Detailed List

Page 483: Move for DB2 User Guide

7.1 Informational Control Statements

User Manual 469

CM − Source File name− Source Table name with

column names and datatypes

− Destination Table namewith column names anddata types

− Status of mapping foreach column

TM − Source Creator ID− Source Table names− Destination Creator ID− Destination Table

names− Column Map Creator

ID− Column Map Names

R(PST) − Parent Table name withcolumn names and datatypes

− Child Table name withcolumn names and datatypes

R(DB2) − Constraint Name− Parent Table name− Child Table name

PK(PST) − Key Column Names− Key Column Attributes

PK(DB2) − Key Column Names− Key Column Attributes

CD − Source 1 Tables− Source 2 Tables− Source 1 Access Definition, if

any.

PRINTCOL Format for detailed list of Access Definitions. Use thiskeyword only if TYPE is AD and DETAIL is YES.

ALL List all information for each Access Definition,as described on page 468, and include allcolumn names and criteria information.

NONE List all information for each Access Definitionexcept column information.

Page 484: Move for DB2 User Guide

7. Batch Maintenance Utilities

470 Move for DB2

SEL List all information for each Access Definition,but limit column information to columns withselection criteria.

ARC List all information for each Access Definition,but limit column information to columns witharchive criteria.

If you do not use the PRINTCOL keyword, detailedlistings of Access Definitions have no columninformation.

NEWPAGE Page break processing for the report. Use this keywordonly if DETAIL is YES.

NO Begin a new page on the basis of thePAGESIZE specification or default only. (Seepage 482 for an explanation of the PAGESIZEstatement.)

YES In addition to normal page breaks, begin a newpage for each object in the list.

The following are examples of DIRECTORY statement usage:

1. To create a listing of all Table Maps in the Directory, specify:

DIR TYPE TM NAME %

2. To create a listing of Access Definitions with names prefixed by"PSTDEMO" that use the Point-and-Shoot Start Table option andinclude information about tables referenced in each AccessDefinition, specify:

DIR TYPE AD NAME PSTDEMO.% PNS DETAIL

3. To create a listing of all Access Definitions that refer to the tableCUSTOMERS, specify:

DIRECTORY TYPE AD NAME %TABLE CUSTOMERS

Examples

Page 485: Move for DB2 User Guide

7.2 Utilities to Maintain PST Objects

User Manual 471

7.2 Utilities to Maintain PST Objects

The Directory contains PST objects such as Access Definitions, TableMaps, Column Maps, PST Primary Keys and Relationships, and CompareDefinitions. You can use a batch utility to copy, for example, AccessDefinitions modified by a specific user – creating a set of identical AccessDefinitions with different names. Other batch utilities allow you to deleteor rename PST objects.

Control statements that can be used to maintain objects in the Directoryand the functions of the control statements are:

DELETE Delete PST objects from the Directory.

COPY Reproduce PST objects in the Directory.

RENAME Change the names of PST objects in theDirectory.

DELETE Statement

Use a DELETE statement to remove one or more Access Definitions,Column Maps, Table Maps, Primary Keys, or Compare Definitions fromthe Directory. For example, PST objects exported to a Directory in adifferent subsystem can be deleted from the original Directory. The PSTobjects to be removed are selected according to keywords and valuesspecified as operands.

Delete Statement for PST Objects

To delete PST objects, use the DELETE statement syntax as follows:

DELETETYPE { AD | CM | TM | R | PK | CD }NAME name[ MODIFIEDBY modifiedby ][ DESC desc ]

The NAME, MODIFIEDBY, and DESC keywords and operands areidentical to those in the DIRECTORY statement. You can use thesekeywords and operands in a DIRECTORY statement to list and reviewcandidates for deletion before submitting a job with the same keywords andoperands in a DELETE statement.

Page 486: Move for DB2 User Guide

7. Batch Maintenance Utilities

472 Move for DB2

TYPE Type of PST objects to be deleted. This keywordmust be included in the DELETE statement with oneof the following:

AD Delete all Access Definitions that matchthe criteria.

CM Delete all Column Maps that match thecriteria.

TM Delete all Table Maps that match thecriteria.

R Delete all PST Relationships that matchthe criteria.

PK Delete all PST Primary Keys that matchthe criteria.

CD Delete all Compare Definitions thatmatch the criteria.

NAME Name of one or more PST objects. This keyword andthe name operand must be included in the DELETEstatement.

name Specify as an explicit value or a pattern,using SQL LIKE syntax.

Use the following keywords as necessary to further refine the criteria forobjects to be deleted.

MODIFIEDBY TSO ID of the last person to modify the PST objects.Use this keyword only if TYPE is AD, CM, TM, R,PK, or CD.

modifiedby Specify as an explicit value or a pattern,using SQL LIKE syntax.

DESC Case-sensitive descriptive information for the PSTobjects to be deleted.

desc Specify as an explicit value or a pattern,using SQL LIKE syntax. Delimitvalues that include blanks in single (') ordouble (") quotes.

Required CriteriaKeywords

Optional CriteriaKeywords:

Page 487: Move for DB2 User Guide

7.2 Utilities to Maintain PST Objects

User Manual 473

The following is an example of DELETE statement usage for PSTobjects:

1. To delete Column Maps with names that are prefixed withPSTDEMO, specify:

DELETE TYPE CM NAME PSTDEMO.%

COPY Statement

Use a COPY statement to create one or more PST objects that areexactly like specified existing objects, but have different names. TheCOPY statement also generates a report of the new objects in theDirectory listing file.

COPYTYPE { AD | CM | TM | R | PK | CD }FROM objectnameTO objectname[ MODIFIEDBY modifiedby ][ DESC desc ][ REPLACE { NO | YES } ]

The keywords and operands in the COPY statement are:

TYPE Type of objects to be copied. This keyword must beincluded in the COPY statement with one of thefollowing:

AD Copy all Access Definitions that matchother criteria.

CM Copy all Column Maps that matchother criteria.

TM Copy all Table Maps that match othercriteria.

R Copy all PST Relationships that matchother criteria.

PK Copy all PST Primary Keys thatmatch other criteria.

CD Copy all Compare Definitions thatmatch other criteria.

Example

Required CriteriaKeywords

Page 488: Move for DB2 User Guide

7. Batch Maintenance Utilities

474 Move for DB2

FROM Name of source objects to be copied. This keywordand objectname must be included in the COPYstatement.

objectname Specify as an explicit value or apattern, using SQL LIKE syntax. AnERROR condition occurs if amatching object is not in the Directory.

TO Name of new objects. This keyword andobjectname must be included in the COPYstatement.

objectname Specify as an explicit value or apattern, using SQL LIKE syntax.

MODIFIEDBY TSO ID of the last person to modify the source objects.

modifiedby Specify as an explicit value or a pattern,using SQL LIKE syntax.

DESC Case-sensitive descriptive information for the PSTobjects.

desc Specify as an explicit value or apattern, using SQL LIKE syntax.Delimit values that include blanks insingle (') or double (") quotes.

REPLACE Action taken when the name of a new object (taken fromthe objectname operand for the TO keyword) matchesthe name of an existing object in the Directory.

NO Do not reproduce.

YES Reproduce the object and replace thepreexisting object with the same name.

If you do not use the REPLACE keyword, existingobjects are retained.

The following are examples of the COPY statement usage:

1. To reproduce all Column Maps with names prefixed with"PSTDEMO." and name the new Column Maps using the prefix"PSTPROD", replacing any preexisting Column Maps withmatching names, specify:

COPY TYPE CM FROM PSTDEMO.% TO PSTPROD.% REPLACE YES

Optional CriteriaKeywords

Optional ReplaceKeyword

Examples

Page 489: Move for DB2 User Guide

7.2 Utilities to Maintain PST Objects

User Manual 475

2. To reproduce all Access Definitions with names prefixed with"PSTDEMO." and created or last modified by PST, specify:

COPY TYPE AD FROM PSTDEMO.%.% TO PSTPROD.%.% MODIFIEDBY PST

RENAME Statement

Use a RENAME statement to change the name of one or more PSTobjects and generate a report of the renamed objects in the Directorylisting file. Security requirements are the same as those for the onlineRename function.

RENAMETYPE { AD | CM | TM | R | PK | CD }FROM objectnameTO objectname[ MODIFIEDBY modifiedby ][ DESC desc ][ REPLACE { NO | YES } ]

The keywords and operands in the RENAME statement are:

TYPE Type of objects to rename. This keyword must beincluded in the RENAME statement with one of thefollowing:

AD Rename all Access Definitions thatmatch the criteria.

CM Rename all Column Maps that matchthe criteria.

TM Rename all Table Maps that match thecriteria.

R Rename all PST Relationships thatmatch the criteria.

PK Rename all PST Primary Keys thatmatch the criteria.

CD Rename all Compare Definitions thatmatch the criteria.

Required CriteriaKeywords

Page 490: Move for DB2 User Guide

7. Batch Maintenance Utilities

476 Move for DB2

FROM Name of source objects to rename. This keywordand the objectname operand must be included in theRENAME statement.

objectname Specify as an explicit value or a pattern,using SQL LIKE syntax. An ERRORcondition occurs if the indicated objectsare not in the Directory.

TO Name of objects after renaming. This keyword andthe objectname keyword must be included in theRENAME statement.

objectname Specify as an explicit value or apattern, using SQL LIKE syntax.

MODIFIEDBY TSO ID of the last person to modify the PST objects.

modifiedby Specify as an explicit value or a pattern,using SQL LIKE syntax.

DESC Case-sensitive descriptive information for the PSTobjects.

desc Specify as an explicit value or apattern, using SQL LIKE syntax.Delimit values that include blanks insingle (') or double (") quotes.

REPLACE Action taken when the name of a new object (takenfrom the objectname operand for the TO keyword)matches the name of an existing object in theDirectory.

NO Do not rename.

YES Rename the source object and replace thesimilarly named existing object.

If you do not use the REPLACE keyword, existingobjects are retained.

The following are examples of the RENAME statement usage:

1. To rename all Column Maps with names prefixed with"PSTDEMO" and replace any existing Column Maps withmatching names, specify:

RENAME TYPE CM FROM PSTDEMO.% TO PSTPROD.% REPLACE YES

Optional CriteriaKeywords

Optional ReplaceKeyword

Examples

Page 491: Move for DB2 User Guide

7.2 Utilities to Maintain PST Objects

User Manual 477

2. To rename all Access Definitions with names prefixed with"PSTDEMO" and created or last modified by PST, specify:

RENAME TYPE AD FROM PSTDEMO.%.% TO PSTPROD.%.% MODIFIEDBY PST

Page 492: Move for DB2 User Guide

7. Batch Maintenance Utilities

478 Move for DB2

7.3 Utilities to Migrate PST Objects

The Relational Tools provide two batch utilities to migrate PST objects,such as Access Definitions, Column Maps, Table Maps, Primary Keys,or Relationships, stored in the Directory. You can export or importobjects in batch or online. Batch execution is documented in this section.(See Section 4.5 Export and Import Processes for information aboutonline execution.)

Batch processing allows you to migrate entire Directories, which can beuseful when setting up a new subsystem. The online processes may bemore useful when migrating small groups of objects.

You can also create a file of PST objects independently and use Importbatch processing to load the objects. (The format of the objects isdiscussed in Section 4.5.3 File Format.)

The JCL needed to export or import PST objects is somewhat differentfrom the JCL needed for other batch processes. For this reason, JCLrequirements are discussed with both the batch Export Utility and thebatch Import Utility.

Batch Export Utility

The JCL needed to export PST objects is:

// EXEC//

PGM=PDPMMAIN,REGION=0M,PARM=' CON OBJEXP subsys planname sqlid userid '

//SYSPRINT//SYSTERM//PDPDDFLT//PSTRACE//PSDFRPRT//PSDFEXPT//SYSIN

/*

DD SYSOUT=*DD SYSOUT=*DD SYSOUT=*DD SYSOUT=*DD SYSOUT=*DD SYSOUT=*DD* DSN=*control statements

EXPORT OR IMPORT REPORTFILEEXPORT DEFINITIONS FILE

A sample of this JCL is provided in the install library, as memberJCLEXP. You can copy this JCL and modify it as needed.

Define a data set for PSDFRPRT listings in the same manner as for theother utilities. Error codes are the same as for the other batch utilities.

JCL Requirements

Page 493: Move for DB2 User Guide

7.3 Utilities to Migrate PST Objects

User Manual 479

Insert control statements for functions after the SYSIN DD* statement.Export control statements and their functions are:

SUBDEF A SUBDEF statement determines whether objectssubordinate to those specified in subsequentEXPORT statements are also exported.

EXPORT An EXPORT statement specifies the objects that arecopied from the Directory to a file.

SUBDEF Statement

A SUBDEF statement determines whether PST objects subordinate tothose specified in subsequent EXPORT statements are exported. Forexample, referenced relationships are subordinate to an Access Definitionor Column Maps are subordinate to a Table Map.

SUBDEF { NO | YES }

Each SUBDEF statement remains in effect until another SUBDEFstatement is encountered in the JCL. Keywords in the SUBDEFstatement are:

NO Do not export subordinate objects. NO is thedefault setting.

YES Export subordinate objects.

EXPORT Statement

Use an EXPORT statement to select PST objects in the Directory, bytype and name of object, and copy the objects to a file. Any number ofEXPORT statements may be used; objects are copied to the file in theorder specified.

EXPORT { ALL | PK | R | CM | TM | AD | CD } objectname

To be exported, an object must satisfy criteria described by the selectedkeyword and objectname operand:

ALLPKRCMTMADCD

All PST objectsPrimary KeysRelationshipsColumn MapsTable MapsAccess DefinitionsCompare Definitions

ControlStatements

Required CriteriaKeyword

Page 494: Move for DB2 User Guide

7. Batch Maintenance Utilities

480 Move for DB2

objectname Specify as an explicit value or a pattern, using SQLLIKE syntax. A value or wild card for everysegment of the object name is required.

The following are examples of EXPORT statement usage:

1. To export all primary keys with the Creator ID "PSTDEMO",specify:

EXPORT PK PSTDEMO.%

2. To export all relationships, specify:

EXPORT R %.%.%

3. To export all Access Definitions in the group "PSTDEMO" withthe subordinate relationships and all Access Definitions for theuser, Smith, in groups that begin with PST, without thesubordinate relationships, specify:

SUBDEF YESEXPORT AD PSTDEMO.%.%SUBDEF NOEXPORT AD PST%.SMITH.%

4. To export all Access Definitions, specify:

EXPORT AD %.%.%

Batch Import Utility

The JCL needed to import PST objects is:

// EXEC//

PGM=PDPMMAIN,REGION=0M,PARM=' CON OBJIMP subsys planname sqlid userid '

//SYSPRINT//SYSTERM//PDPDDFLT//PSTRACE//PSDFRPRT//PSDFIMPT//SYSIN

/*

DD SYSOUT=*DD SYSOUT=*DD SYSOUT=*DD SYSOUT=*DD SYSOUT=*DD SYSOUT=*DD* DSN=*control statements

EXPORT OR IMPORT REPORTFILEDEFINITIONS DATA SET

A sample of this JCL is provided in the install library, as memberJCLIMP. You can copy this JCL and modify it as needed.

Define a data set for PSDFRPRT listings in the same manner as for theother utilities. Error codes are the same as for the other batch utilities.

Examples

Page 495: Move for DB2 User Guide

7.3 Utilities to Migrate PST Objects

User Manual 481

Insert control statements for the functions after the SYSIN DD*statement. The Import control statement and its function is:

TYPE A TYPE statement indicates the objects that arecopied (imported) from a file to the Directory.

TYPE Statement

Use a TYPE statement to select PST objects from the PSDFIMPT file,and copy the objects to the Directory. Any number of TYPE statementsmay be used; objects are written to the Directory in the order specified.

TYPE { ALL | PK | R | CM | TM | AD | CD }[ OVERWRITE { NO | YES } ]

To be imported, an object must satisfy criteria described by keywords:

TYPE The type of object to import.

ALLPKRCMTMADCD

All PST objectsPrimary KeysRelationshipsColumn MapsTable MapsAccess DefinitionsCompare Definitions

OVERWRITE Action taken if a specified object exists.

NO Do not replace an existing object; handle as anerror.

YES Replace existing object.

If you do not use the OVERWRITE keyword, an existing object is notreplaced and an error is caused.

To import all primary keys with the Creator ID "PSTDEMO" andreplace any primary keys with the same name:

TYPE PK OVERWRITE YES

ControlStatements

Required CriteriaKeyword

Option ReplaceKeyword

Example

Page 496: Move for DB2 User Guide

7. Batch Maintenance Utilities

482 Move for DB2

7.4 General Batch Control Statements

Several general control statements apply during the execution of thebatch maintenance utilities. The following control statements can beplaced anywhere among the other control statements:

PAGESIZE A PAGESIZE statement governs the numberof lines per page.

ERROR An ERROR statement governs the handling oferror conditions that may occur during a run.

OUTDD An OUTDD statement indicates the DDNAMEfor the Directory listing data set. (The defaultDDNAME for a Directory listing file, used if noOUTDD statement applies, is PSDFADIR.)

PAGESIZE Statement

A PAGESIZE statement governs the number of printed lines per page,excluding top and bottom margins.

PAGESIZE [ nn ]

Each PAGESIZE statement applies until another PAGESIZE statement isencountered. The default operand for a PAGESIZE statement is 56; if noPAGESIZE statement applies, the page size is 56 lines plus top and bottommargins. The following is an example of a PAGESIZE statement:

PAGESIZE 75

ERROR Statement

An ERROR statement governs the handling of error conditions during arun.

ERROR { STOP | CONT }

Each ERROR statement applies until another ERROR statement isfound. Keywords for an ERROR statement are:

STOP Halt the run if an error occurs.

CONT Continue the run, executing the next controlstatement, regardless of errors.

If you do not provide an error statement, the run stops when an error occurs.

Page 497: Move for DB2 User Guide

7.4 General Batch Control Statements

User Manual 483

OUTDD Statement

An OUTDD statement indicates the DDNAME for the Directory listingdata set.

OUTDD ddname

Each OUTDD statement applies until another OUTDD statement isencountered. The following is an example of an OUTDD statement usedto direct output to the data set corresponding to the DDNAMEADREPT:

OUTDD ADREPT

If you do not provide an OUTDD statement, the default DDNAME,PSDFADIR, is used.

Page 498: Move for DB2 User Guide
Page 499: Move for DB2 User Guide

User Manual 485

A. Main Menu Variations

The Main Menu display varies based on which of the RelationalTools components are installed and whether remote access is to beavailable.

The following figure displays the Main Menu when only MOVE isinstalled. Only the available options are displayed.

----------------------- Princeton Softech's MOVE for DB2 ------------------OPTION ===> SQLID ===> 0 OPTIONS - Site and User Options SUBSYS ===> TDB2 1 ADS - Create or Modify ADs 2 DEFINITIONS - Maintain Primary Keys, Relationships, Maps and ADs 3 MIGRATION - Data Migration - Extract, Delete, Insert, ...

T TUTORIAL - Information About MOVE for DB2 X EXIT - Terminate MOVE for DB2

Figure 220. Main Menu - Move Only

MOVE only

Page 500: Move for DB2 User Guide

A. Main Menu Variations

486 Move for DB2

When remote access is available, the LOCATION field is providedfor you to specify the site-defined name of the remote location.

----------------------- Princeton Softech's MOVE for DB2 ------------------OPTION ===> SQLID ===> 0 OPTIONS - Site and User Options SUBSYS ===> TDB2 1 ADS - Create or Modify ADs LOCATION ===> 2 DEFINITIONS - Maintain Primary Keys, Relationships, Maps and ADs 3 MIGRATION - Data Migration - Extract, Delete, Insert, ...

T TUTORIAL - Information About MOVE for DB2 X EXIT - Terminate MOVE for DB2

Figure 221. Main Menu - Remote Access

Remote Access

Page 501: Move for DB2 User Guide

User Manual 487

B. Allocating External Files

MOVE processing requires several types of files:

Point-and-ShootExtractControlOUTPUTOutput SQLExtract BrowseExportProcess Report

MOVE automatically prompts for allocation information for theseexternal files when they do not exist. To allocate these files, MOVEprompts for the necessary information. Some of the values, based onthe type of file to be allocated, are required as specified and cannot bechanged. The following figure shows all of the prompts for non-SMSdata sets. The chart on page 491 details the values for each promptfor each type of external file.

----------------------------- Allocate Dataset ------------------------- Data Set Name: Z13600MP.TEST.DSN

Volume Serial ===> (Blank for Authorized Default Volume) * Generic Unit ===> (Generic Group Name or Unit Address) * Space Units : BLKS (In 8KB BLKS) Primary Quantity ===> 5 (In Above Units) Secondary Quantity ===> 2 (In Above Units) Directory Blocks ===> (Zero for Sequential Data Sets) Record Format ===> (F, FB, FS, V or VB) Record Length ===> Block Size ===> (Must be a multiple of Record Length)

( * Only one of these fields may be specified )

Calculated Values Shown, Change to Profiled Values ===> N (Y-YES, N-NO)

Figure 222. Allocate Dataset Panel

Page 502: Move for DB2 User Guide

B. Allocating External Files

488 Move for DB2

Volume Serial The volume serial number of the volume onwhich the dataset is to reside. Leave this fieldblank to use the default volume for which youare authorized. This value must contain onlyalphanumerics, national characters, and thehyphen. The value for volume serial number ismutually exclusive with Generic Unit.

Generic Unit The generic unit name or unit address of thedevice on which the dataset is to reside. Leavethis field blank, to use the default genericvolume. This value must contain onlyalphanumeric characters. This value ismutually exclusive with Volume Serial.

Space Units Specify the DASD space for the dataset to beallocated as:

BLKS Blocks (abbreviations: BLK or B).

TRKS Tracks (abbreviations: TRK or T).

CYLS Cylinders (abbreviations: CYL orC).

When MOVE provides the suggested sizes,this field is BLKS. If the user is supplying thevalue, select one.

Site management may have guidelinesregarding which to use.

Primary Quantity Specify the primary quantity of space to beallocated in the indicated space units. Sitemanagement may have guidelines regardingappropriate values.

Secondary Quantity Specify the secondary quantity of space to beallocated in the indicated space units. Sitemanagement may have guidelines.

Directory Blocks Specify the number of directory blocks to beallocated. This value is required forpartitioned data sets and should be 0 forsequential data sets. Site management mayhave guidelines.

Panel fields

Page 503: Move for DB2 User Guide

B. Allocating External Files

User Manual 489

Record Format Specify record format as F, FB, FS, or VB.This value must be FS for sequential data setscreated for Extract Files and Control Files.

When directing browsed output to a datasetusing the OUTPUT command, the recordformat can be F or FB. FB is the default.This value must be VB for files being browsed(e.g., browsing the Extract File).

Site management may have guidelines.

Record Length Specify the logical record length. Whendirecting browsed output to a dataset using theOUTPUT command, the record length must be80.

Site management may have guidelines forallocating other datasets.

Block Size Specify the block size in bytes. Noterequirements in the accompanying chart fordefault values.

If you specify the default of 0 as the BLKSIZEfor the Extract and Control Files and for thefile being browsed, the actual value will becalculated at run time.

Site management may have guidelines.

Page 504: Move for DB2 User Guide

B. Allocating External Files

490 Move for DB2

Calculated ValuesShown, Change toProfiled Values

Specify whether you want to allocate the fileusing the values calculated by MOVE or thevalues you explicitly specified. The user-specified values are profiled. Specify:

Y User values previously specified andprofiled are to be used. Also, if youhave modified the values on this panel,they are profiled and replace anypreviously specified values.

N The values calculated by MOVE areto be used.

These values are calculated based on the“worst case”. For example, for an ExtractFile, the value is determined by the maximumnumber of rows that can be extracted times thelength of the longest row. Reasonable primaryand secondary extents are also calculated fromthis value. The Control File is calculatedbased on the size of the Extract File. Anyunused space is freed when the process usingthe data set is complete.

If Managed Data Support is present for the underlying operatingenvironment, the panel contains the prompts necessary for SMS dataset creation.

Extract Files and Control Files must be physical sequential. Theycannot be extended format data sets.

SMSConsiderations

Page 505: Move for DB2 User Guide

B. Allocating External Files

User Manual 491

Each external file type has defaults. The chart lists the files. Themodifiable defaults are shown in italics. The other values cannot bemodified.

External File DSORG DirBlks

RECFM LRECL BLKSIZE

Extract/Control

SEQ 0 FS 0

LRECL = BLKSIZE; minimum is 2048, maximum is 9999(This value is based on the number of columns.)

Point-and-Shoot/Export/Output SQL

SEQ/PDS* 0 FB/F* 80 3200

If RECFM=F, BLKSIZE=80 and BLKSIZE=LRECL-

Browsed File SEQ 0 VB 0 0

BLKSIZE=LRECL+1;min LRECL=84, BLKSIZE=88

ProcessReportOutput

SEQ 0 FB 80 3200

BLKSIZE=multiple of LRECL

The Point-and-Shoot file, by default, is allocated as a sequential filewith a RECFM of FB. You may allocate this file as a member of aPDS and specify a value other than 0 for directory blocks. If youspecify the RECFM as F, the BLKSIZE must be 80.

For more detailed information on these fields, refer to the IBM JobControl Language documentation applicable to your operating system.

If you are transferring an Extract File from OS/2, you must allocate afile that physically matches the characteristics used in creating thefile. Specifically, the DCB parameters should be:

BLKSIZE=7476LRECL=7476RECFM=FSDSORG=PS

Also, when copying the file to the MVS machine, make sure that it istransferred in Binary (not Text) format and that no carriage returns orline feeds are inserted in the data. For example, the CRLF option ofsome terminal emulators should not be used.

Defaults forSpecific Files

About Point-and-Shoot File

Extract File

Page 506: Move for DB2 User Guide

B. Allocating External Files

492 Move for DB2

Page 507: Move for DB2 User Guide

User Manual 493

C. Exit Routines for Column Maps

Column Maps allow you to specify the source data for eachdestination column. User exits are supported when defining ColumnMaps to allow you to set values for columns in the destination tablethat could not be established otherwise. Exits can be used to:

• Perform data transformations that are beyond the scope ofColumn Maps. For example, an exit can change an employeedepartment number for selected rows based on some complexalgorithm.

• Mask confidential information. For example, an exit canchange an employee name or salary information on selectedrows.

• Select specific rows to be processed and discard all others.

All exits must conform to the following requirements:

• The exit can be written in Assembler, VS COBOL II, PL/I orC (using the SAS/C compiler with a _dynamn entry).

• The exit must be reentrant and must be available to allMOVE online and batch processes using the Column Map.

• Each exit must be compiled and linked as a separate loadmodule. This load module is loaded dynamically at executiontime.

• The exit must set the value in the destination column.

• If the exit accesses DB2, the DBRM for that exit programmust be bound into the Relational Tools plan.

Requirements

Page 508: Move for DB2 User Guide

C. Exit Routines for Column Maps

494 Move for DB2

The exit is called for each row in the mapped table. The followingparameters are passed with every call:

• A structure containing the following:

Information

DB2 subsystem nameUser's primary SQLIDCurrent SQLIDSource table Creator IDSource table nameDestination table Creator IDDestination table nameDestination column identifier

Data Type

CHAR(4)CHAR(8)CHAR(8)CHAR(8)VARCHAR(18)CHAR(8)VARCHAR(18)SMALL INT

The Destination column identifier is the subscript of theSQLVAR entry for the column in the destination SQLDA. Thefirst entry has a value of 1.

Fixed length character fields are filled with spaces on the right.

• An SQLDA describing the source row. (The SQLDA isdescribed in the appropriate DB2 documentation from IBM.)

• An SQLDA describing a copy of the destination row.

• A 256-byte work area. This area is initialized to binary zerosfor the first call to the exit and will be unchanged for latercalls. This area is used to pass information from one call toanother, serve as a save area, and so forth. A separate workarea is provided for each column even when multiple columnsuse the same exit.

Since the exit may be called frequently, avoid unnecessary overhead.For example, the exit should perform initialization processing in thefirst call and save information for subsequent calls in the work area.Also, there may be significant overhead when the PL/I runtimeenvironment is established. To avoid this, write the exits inAssembler, SAS/C, or COBOL. (For COBOL, MOVE creates theruntime environment only once if there are any COBOL II exits.)

When the exit is called, all destination and source columns areavailable except those destination columns that are yet to be assigneda value by an exit. To set the value in the destination column, the exitcan examine data in the source row or the data in other columns in thedestination row.

Parameters

AvoidingOverhead

SettingDestinationValues

Page 509: Move for DB2 User Guide

C. Exit Routines for Column Maps

User Manual 495

The exit is passed a copy of the destination row. The value for thedestination column supplied by the exit is moved back into the actualrow used by MOVE. Thus, an exit can only set a value in the columnthat was specified. The exit must adhere to the following:

• The exit must not change any other storage areas.

• The exit must return a value appropriate for the column.

• The exit must clear or set the null indicator if the columnallows nulls.

• MOVE uses the primary key information to build internal workareas. Any exit that assigns a value to a column that is part ofthe primary key must ensure that it generates the same outputvalue if it is called multiple times with the same source row.

The destination columns which use the CURRENT DATE orCURRENT_DATE, CURRENT TIME or CURRENT_TIME, orCURRENT TIMESTAMP or CURRENT_TIMESTAMP specialregisters are assigned values by DB2. These columns are marked inthe SQLDATA field as:

Special Register SQLDATA Value

CURRENT DATECURRENT_DATE

-2

CURRENT TIMECURRENT_TIME

-1

CURRENT TIMESTAMPCURRENT_TIMESTAMP

-3

Special processing is provided for DATE, TIME, and TIMESTAMPdestination columns which are marked as NOT NULL WITHDEFAULT when the mapped source column is NULL. For thesecolumns, the SQLDATA field is set to -4. Note these special values onlyaffect destination columns assigned values by MOVE, not those assignedvalues by an exit.

The exit must set one of the following return codes:

Return Code Meaning

0 Destination column has been assigned a value.

4 Destination column can not be assigned a value andthe row should be discarded.

8 Fatal error. Terminate execution. To return an errormessage, place the message in the work area and set

Special Registers

Return Codes

Page 510: Move for DB2 User Guide

C. Exit Routines for Column Maps

496 Move for DB2

the unused space to blanks or null.

A termination call is made to the exit after all destination tableprocessing is completed. The call is identified by a value of 0 in thedestination column identifier field. The exit can use this call to clean upany dynamically acquired storage.

Sample exits are included with MOVE. They illustrate how to use thedata areas available to the exit and the type of processing that can beaccomplished using an exit. These exits are distributed on the MOVEinstallation tape. The source is available on the Installation Library.PSRTEXTA and PSRTEY2K are available as load modules on theproduct load library.

PSRTEXTA An Assembler exit which assigns a sequential value toa column for each row in the destination table. Thiscan be used to mask sensitive information. The resultsare similar to those achieved by using the SEQ functionin a Column Map but the exit can be used to as anexample of exit processing in Assembler.

PSRTEXTC A COBOL exit which performs two operations on theCUSTOMERS table distributed with MOVE. First, itfilters rows processed by MOVE such that any rowwith a value of 0 in the YTD_SALES column isdiscarded. Second, it changes the SALESMAN_IDcolumn for the customers in Florida.

PSRTEY2K An Assembler exit which sets the year portion ofDATE or TIMESTAMP columns to 2000. This isuseful for generating test data to ensure thatapplications are year 2000 compliant.

When specified as an exit for a destination column,PSRTEY2K locates the source column with the samename as the destination column. If the source columnis not null, the value is changed to the year 2000 beforeinserting it at the destination. If the source is a DATEdata type and the destination is a TIMESTAMP,“00.00.000000” is added to the time value. If thesource is a TIMESTAMP and the destination is aDATE, only the date portion is inserted. If the sourcecolumn is NULL and the destination is nullable, thedestination is set to NULL. If the destination is notnullable, “2000-01-01” is inserted into a DATEcolumn and “2000-01-01-00.00.000000” is insertedinto a TIMESTAMP column.

For more details on these sample exits, consult the program source.

Termination Call

Sample Exits

Page 511: Move for DB2 User Guide

User Manual 497

D. Creating a Row List File

The Point-and-Shoot facility is used to specify the primary key valuesfor the Start Table when performing an Extract Process. Thesevalues are automatically stored in a Row List file. However, thePoint-and-Shoot Facility is available for DB2 tables only. When youwant to use values from data that does not reside in DB2, you cangenerate the Row List file manually or by a utility appropriate for thesource of the data. The file must conform to the format of the filegenerated by Point-and-Shoot as follows:

• The file must be a member of a partitioned data set or asequential data set.

• The file must contain 80-character records.

• The data in the file must conform to DB2 syntax and rules forcolumn data types. Additionally, the data must match, bydata type and length, the attributes of the primary keycolumn(s) in the Start Table.

• The DD name of the file must be PSDFPNS.

For example, assume you want to extract specific rows from theDETAILS table using a list created by a method other than Point-and-Shoot. The primary key for the DETAILS table consists of twocolumns, ORDER_ID and ITEM_ID. These columns are defined as:

Column Name

ORDER_IDITEM_ID

Data Type

DEC(5,0)CHAR(5)

Example

Page 512: Move for DB2 User Guide

D. Creating a Row List File

498 Move for DB2

The following figure shows an example of how the list should bestructured. In this example, the file containing the list is displayed inthe ISPF editor. For each row to be extracted, the value in theORDER_ID column is followed by the value in the ITEM_IDcolumn. Commas separate the values for each row, and semicolonsseparate each row.

EDIT ---- PSTDEMO.PSTPK.KEY -------------------------- COLUMNS 001 072Command ===> Scroll ===> CSR****** *************************** TOP OF DATA ***********************000001 00123, 'CH001'; 00124, 'CH002'; 00125, 'CH003'; 00126, 'CH004';000002 00133, 'CH001'; 00134, 'CH002'; 00135, 'CH003'; 00146, 'CH004';000003 00153, 'CH001'; 00154, 'CH002'; 00155, 'CH003'; 00156, 'CH004';****** ************************ BOTTOM OF DATA ***********************

Figure 223. Specify Primary Key Values without Point-and-Shoot

The format requirements for the data are:

Data must be separated by a comma followed by one or more spaces.

• Primary key values for each row must be separated by asemicolon followed by one or more spaces.

• Character data must be enclosed in single quotes. Embeddedquotes must be in the form of two single quotes.

Character data can be wrapped to the next line. Thesegments of the data must be individually enclosed in quoteswithout an intervening colon.

The following is an abbreviated example of character datathat is wrapped followed by character data that is notwrapped:

'This is an example''of wrapped data.'

: No commas

'This is an example','that does not wrap.','Note the commas.',

: Commas

Character data that is stored in fixed length columns istruncated or padded appropriately to fit the column.Character data that is stored in variable length columns istruncated if necessary but is not padded.

Character Data

Page 513: Move for DB2 User Guide

D. Creating a Row List File

User Manual 499

• All date and time data must be enclosed in single quotes. Anyvalid DB2 format for these values is acceptable and will behandled appropriately.

• Numeric data is not enclosed in quotes. The decimal can beindicated by either a comma or a period and will be handledappropriately.

You can use this information to create a Point-and-Shoot file tospecify an alternate key or a partial primary key. This is very usefulfor selecting non-unique values or values that do not correspond to theprimary key definition. To indicate to MOVE that the data in this filecontains values for some set of the columns, prefix the file with:

COLUMN-LIST

Names of the columns for which data is supplied

END-COLUMN-LIST

The data for the columns is specified in the order in which thecolumns are listed.

Example 1:

Assume you have a set of ITEMS rows that are not in your DB2database. However, you want to extract the DETAILS rows fromyour DB2 database for specific ITEMS. The primary key for theDETAILS rows is comprised of two columns, ORDER_ID andITEM_ID. However, you prefer to extract rows based on only theITEM_ID. You can generate a file to be used as the Point-and-Shootfile to extract the several DETAILS rows for each specifiedITEM_ID value regardless of the ORDER_ID value.

EDIT ---- PSTDEMO.PSTPK.KEY --------------------------- COLUMNS 001 07Command ===> Scroll ===> CSR****** **************************** TOP OF DATA **********************000001 COLUMN-LIST000002 ITEM_ID000003 END-COLUMN-LIST000004 'CH001'; 'CH002'; 'CH003'; 'CH004';000005 'CH005'; 'CH006'; 'CH007'; 'CH008';000006 'CH009'; 'CH010';****** ************************ BOTTOM OF DATA ***********************

Figure 224. Specify Partial Primary Key - Example 1

Date/Time

Numeric Data

Partial PrimaryKey

Page 514: Move for DB2 User Guide

D. Creating a Row List File

500 Move for DB2

Example 2:

Assume that two columns comprise the partial primary key,ORDER_ID and ITEM_ID. Specify the column values in the orderin which they are listed for the column list. For each row, in thisexamples, the values for ORDER_ID are followed by the values forITEM_ID separated by commas. Semicolons separate the rows.Since the values are delimited by commas and semicolons, entries canspan multiple lines and multiple entries can be specified on a singleline.

EDIT ---- PSTDEMO.PSTPK.KEY --------------------------- COLUMNS 001 07Command ===> Scroll ===> CSR****** **************************** TOP OF DATA **********************000001 COLUMN-LIST000002 ORDER_ID000003 ITEM_ID000004 END-COLUMN-LIST000001 00123, 'CH001'; 00124, 'CH002'; 00125, 'CH003'; 00126, 'CH004';000002 00133, 'CH001'; 00134, 'CH002'; 00135, 'CH003'; 00146, 'CH004';000003 00153, 'CH001'; 00154, 'CH002'; 00155, 'CH003'; 00156, 'CH004';****** ************************ BOTTOM OF DATA ***********************

Figure 225. Specify Partial Primary Key - Example 2

You can use the generated list for the Extract Process by performingthe following steps:

• Select Option 1 EXTRACT from the Data Migration menu.

• Select Option 1 TABLES from the EXTRACT Processmenu.

• Enter the POINT command on the Select Tables/Views forAD panel.

• A pop-up window is displayed prompting for the name of anInput DSN. Specify the name of the Row List file youcreated at the Input DSN prompt and press END. The SelectTables/Views for AD panel is redisplayed.

When you press END, a Point-and-Shoot session is notinitiated, but the file you named will be used to extract rowsfrom the Start Table when the Extract Process is performed.

Using the List

Page 515: Move for DB2 User Guide

User Manual 501

E. Printing Extract and Control Files

This appendix describes how to print the contents of an Extract Fileor a Control File. You can browse these files online using the Browseoption on the Data Migration menu, however, to print these files youmust submit a batch job. The following sample JCL can be used toprint the contents of the Extract File and, optionally, the Control File.You must supply the appropriate values for all italicized text:

//jobname JOB jobcard info//*-------------------------------------------*//PRINT EXEC PGM=XFPMAIN,PARM=‘CUSTOMERS’//*-------------------------------------------*//STEPLIB DD DSN=loadlib,DISP=SHR//PSDFEXTR DD DSN=extract file,DISP=SHR//*PSDFCTRL DD DSN=control file,DISP-SHR//PSDFRPRT DD SYSOUT=*,DCB=LRECL-136//SYSPRINT DD SYSOUT=*

The DD names are supplied to specify:

STEPLIB Name of the Move for DB2 load library.

PSDFEXTR Name of the Extract File to be printed.

PSDFCTRL Name of the Control File to be printed. This isoptional. Print the Control File if you want to printthe row status information resulting from a MOVEprocess. (In the sample JCL, this statement iscommented.)

PSDFRPRT Destination for the print request. This can beSYSOUT or a disk data set. This file has variablelength record format with carriage control. (Aparameter on the EXEC statement can be used tomodify this.)

SYSPRINT Destination of error messages.

Sample JCL

Page 516: Move for DB2 User Guide

E. Printing Extract and Control Files

502 Move for DB2

Several parameters can be specified in the parameter field on theEXEC JCL statement. These are all optional:

Option Description

-E Print rows with errors. This is ignored if a ControlFile is not supplied.

-NE Print all rows. Default.

-X Print message with error code of rows in error.This is ignored if a Control File is not supplied.

-NX Do not print message. Default.

-S Include row status. This is ignored if a ControlFile is not supplied. Default.

-NS Do not include row status.

-I Include insert status. This is ignored if a ControlFile is not supplied. Default.

-NI Do not include row status.

-C Include table counts. Default.

-NC Do not include table counts.

Indicate how the output is handled if the length ofthe records in the Extract File is greater than thelength of the output line:

-W Wrap the output. Default.

-NW Change the output file characteristics to fit thelongest record in the Extract File. This optionalsetting is appropriate only when the output isdirected to a disk data set.

cid.table Indicate one or more tables in the Extract File thatare to be printed. If you do not specify a value, alltables are printed. This is the default. If youspecify:

cid All tables with the specified CreatorID are printed.

table All tables with the specified basename, regardless of Creator ID, areprinted.

cid.table The named table is printed.

Errors

Row Status

Insert Status

Table Count

Wrap Output

Table Name

Page 517: Move for DB2 User Guide

E. Printing Extract and Control Files

User Manual 503

-VCDCnnn Indicate the value of the character to be used as thevarchar delimiter.

For nnn specify the decimal equivalent for thecharacter. For example, to define an asterisk as thedelimiter, specify -VCDC92 where 92 is thedecimal representation of the asterisk.

The default varchar delimiter is semicolon, ';'.

-NFCnnn Indicate the value of the character to be used as thenull field indicator.

For nnn specify the decimal equivalent for thecharacter. For example, to define an asterisk as thenull field indicator character, specify -NFC92where 92 is the decimal representation of theasterisk.

The default null field indicator character isquestion mark, '?'.

The following is an example of an EXEC statement using parametersto specify that all rows including row status are to be printed for theCUSTOMERS table in an Extract File:

EXEC PGM=XFPMAIN,PARM='-NE -S CUSTOMERS'

The parameters are separated by spaces.

Varchar Delimiter

Null FieldIndicatorCharacter

Example

Page 518: Move for DB2 User Guide

E. Printing Extract and Control Files

504 Move for DB2

Page 519: Move for DB2 User Guide

User Manual 505

F. Compatibility Rules for Relationships

When defining a PST relationship using the Define Relationship orModify Relationship panel, corresponding columns must be compatibleas defined in the following table. The word “Yes” at the intersection oftwo column types indicates that those columns are compatible and maybe defined as corresponding columns. The term “column” in thisappendix refers to actual columns as well as expressions containingconcatenation, substrings, and literals.

NumericColumn

CHARColumn

VARCHARColumn

DATEColumn

TIMEColumn

TIMESTAMPColumn

StringLiteral

NumericConstant

String

Expression1

NumericColumn

Yes Yes2 Yes

2 Yes3

CHARColumn

Yes2 Yes Yes Yes Yes

VARCHARColumn

Yes2 Yes Yes Yes Yes

DATEColumn

Yes

TIMEColumn

Yes

TIMESTAMPColumn

Yes

String Literal

Yes Yes Yes

NumericConstant

Yes3

String

Expression1

Yes Yes Yes Yes

1 ”String Expression” refers to any comparand containing a concatenation operator or a substringfunction.

2 The “Numeric Column” must be an INTEGER or SMALLINT column or a DECIMAL column with ascale of 0 (that is, the numeric value cannot have any digits to the right of the decimal point).

3 The “Numeric Column” must be an INTEGER, SMALLINT, or DECIMAL column.

Page 520: Move for DB2 User Guide

F. Compatibility Rules for Relationships

506 Move for DB2

MOVE verifies that corresponding columns are compatible when youpress ENTER on the Define Relationship or Modify Relationshippanel. If they are not, an error message is displayed. You must correctthe incompatibility before saving the relationship definition.

Character columns are compatible with numeric columns when defined ina PST relationship. To compare character data to numeric data, it maybe necessary for MOVE to convert the numeric data to character format.This may involve padding the data prior to the comparison. The data ispadded on the left with zeros so the length of the two strings are equal.This operation is performed internally and does not affect your DB2 data.To demonstrate, assume the following columns are defined in arelationship:

COL1 CHAR(5) COL2 DECIMAL(2)

If the data in COL2 is 43, MOVE pads the value with three leading zerosto form “00043” prior to comparing it with the data in COL1, which isfive characters long. This automatic padding may affect how MOVEretrieves related rows of data.

Character-to-numeric conversion only occurs when the character columnonly contains digits.

Corresponding CHAR and VARCHAR columns do not require the samelength attribute. However, if the length of one column exceeds the lengthof its corresponding column, MOVE truncates trailing blanks in thelonger column to obtain a length equal to the corresponding column. Ifthe data in the longer column does not have enough trailing blanks totruncate, that data is not considered related and is not retrieved.Truncation also occurs when the length of a concatenated expressionexceeds the length of its corresponding column.

Verification

Character toNumeric Columns

Different LengthColumns

Page 521: Move for DB2 User Guide

User Manual 507

G. Skipped Columns

Frequently, values that are not valid dates are inserted into date columnsto indicate special handling or conditions. Rather than treat these non-date values as invalid or as errors, Relational Tools “skips” them. Thatis, when a column contains such a value, the column is bypassed. Sincethere is no error, processing continues with the next date column. Theuser can indicate whether skipped values are noted in the Aging Reportand if rows with skipped dates are written to the output file.

To determine whether a column should be skipped, Ager 2000 evaluatesthe field.

• If the column contains all spaces, hex zeros (low-values) or hex‘FF’ (high-values), it is skipped.

• If the column does not contain only those values, Ager 2000parses the column based on the specified date format or user exit,if specified, and then examines the values for each unit of theformat. Based on site-specific definitions, the value may beskipped. Typical skipped dates include 0000/00/00 and99992/31. Check with site management for a list of skippedvalues.

Page 522: Move for DB2 User Guide

G. Skipped Columns

508 Move for DB2

Page 523: Move for DB2 User Guide

User Manual 509

H. Date Formats

Date formats specify the format of a date column. These are encodedinternally as a list of possible data types in a single format table. Newformats can be added easily to the table without requiring coding foreach individual format.

Each format is specified by its name. You specify these formats onthe Aging Specifications panel available from the Column Mapeditor. On this panel, you can display a selection list of valuesappropriate for the specific column data type by entering an asteriskin the Input Date Format and Output Date Format fields.

The name will actually be qualified by the data type of the column.This means MOVE supports a date format of MMDDYY as acharacter column and also as a decimal column even though these areprocessed differently.

H.1 Date Components

The formats distributed with MOVE are formatted with the followingcharacters to represent the date component.

CC Two-digit century YY Two-digit year without century YYY Three-digit year relative to 1900 YYYY or CCYY Four-digit year MM Two-digit month MMM Three-character abbreviation for name of month

(e.g., Jan or JAN). DD Two-digit day DDD Three-digit Julian day DDDDDD Lilian date (number of days since Oct.14, 1582) / Slash in date - Dash in date * Any delimiter in date U Unsigned decimal field. It precedes the format.

Page 524: Move for DB2 User Guide

H. Date Formats

510 Move for DB2

H.2 Examples

MOVE supports a wide variety of internal date storage schemes. Forinstance, a YYMMDD date column may be stored in a variety ofways:

• 6-byte character column

• 3-byte packed unsigned column

• 4-byte packed-decimal column

• 4-byte packed-decimal column with high-order bitsindicating century

Character formats, numeric formats, as either packed decimal orbinary columns, are allowed for any format without delimiters.

The following includes examples of date formats.

MMDDYY

YYMMDD

DDMMYY

YYDDD

MM*DD*YY

YY*MM*DD

DD*MM*YY

YYDDD

YY*DDD

YYMM

YY*MM

DDMMMCCYY

MMM*DD*CCYY

CCYYMMDD

CCYY*MM*DD

Page 525: Move for DB2 User Guide

H. Date Formats

User Manual 511

Page 526: Move for DB2 User Guide

H. Date Formats

512 Move for DB2

Page 527: Move for DB2 User Guide

User Manual 509

Index

**

Aging Rule Selection List, Column Map...................................................... 244

Aging rules selection list ......................... 347All indicator for group selection............... 139File name .................................................. 19Format selection list, Column Map

...................................................... 244Generic

primary keys ....................................... 188relationships ....................................... 217

Group Selection processing...................... 139Primary keys, generic .............................. 182Relationships, generic.............................. 217Specify Relationship Usage panel ............ 143

*ERROR*, Column Map status.................... 236

||| concatenation operator

Column Maps.......................................... 252Relationships....................................... 207–8

AAbbreviated table name (Tn).......................... 90Access Definition

Description................................................ 52Ref Tbl...................................................... 59Rename ................................................... 262TEMPTABLE ........................................... 58

Access Definition Parameters panel.............. 171Access Definition Parameters Panel ............. 172Access Definitions ................................. 45–173

BROWSE command ................................ 168CANCEL command................................... 70Choose an Access Definition panel ............ 46Column

data type ............................................... 78name..................................................... 74selection criteria ............................. 73–74

sort criteria ........................................... 76specification.......................................... 72status indicated ..................................... 82

Commandsline ....................................................... 69primary........................................... 68–69

Components .............................................. 45diagram of ............................................ 53

CREATE RELATIONSHIPS command...... 65Creator ID ................................................. 55Date modified............................................ 50Delete tables from ..................................... 67Duplicate tables....................................... 173Dynamic definition of .............................. 168Error handling ........................................... 70Every Nth.................................................. 60Export Process................................... 276–83

output file format .........................292–296Extract Process, specify for ...............306–307GET TABLES RELATED command..............

............................................28–30, 63–64GROUP field............................................. 47Group name............................................... 50Group Selection processing indicator

........................................................ 55Group Selection Processing ............. 138, 140Impact of data base changes............. 169, 170Import Process................................... 283–86INDENT command.............................. 65, 67Line commands ......................................... 69LIST TABLES command ........................... 61LIST TABLES RELATED command ......... 63Modified By .............................................. 50Modify table names ................................... 68Name ........................................................ 50NAME field .............................................. 47Name format ............................................. 14Naming conventions ............................ 17–19Overview....................................... 11, 14, 45Parameters panel ..................................... 171Parameters Panel ..................................... 172POINT command................................. 30, 85Point-and-shoot

sample session ................................ 31–32

Page 528: Move for DB2 User Guide

Index

510 Move for DB2

Point-and-Shoot................................. 84–136Primary commands .............................. 68–69REL command............................32, 141, 150Relationship selection.................32, 141, 144Relationships specification ...................... 150Row Limit ................................................. 60Row List indicator ..................................... 56SAVE command ........................................ 70Select primary key values .................. 84–136selection criteria ........................................ 81Selection criteria ................................. 71–75Selection list........................................ 48–52

Export Process .................................... 279Extract Process ................................... 307

Specify Relationship Usage panel ...... 32, 141Specify Selection Criteria panel ........... 74–75Specifying relationships........................... 141SQL command..................................... 79–80SQL WHERE Clause panel ................. 79–83Start Table ................................................ 55Stored specifications.................................. 14Table

names ................................................... 58selecting ............................................... 54

USER field................................................ 47User name ................................................. 50

AGE functionCLR to delete .......................................... 246Column Maps.......................................... 242Convert Process....................................... 429Insert Process .......................................... 342Load Process ........................................... 369LOADPLUS ............................................ 375

Aging dataCentury Pivot Window............................. 347Column Maps for..............................242–248Convert Process information ............ 362, 434Default Aging Rule.................................. 347Default Aging Rule Table ........................ 347Insert Process information........................ 362Output Rows with Invalid Dates .............. 348Output Rows with Skipped Dates ............ 349Report Invalid Dates................................ 348Report Skipped Dates .............................. 348

Aging Rule* for selection list .................................... 347Column Maps.......................................... 244default for Aging data .............................. 347

Aging Rule Tabledefault for Aging data .............................. 347

Aging Specificationsaging amounts ......................................... 245business rules .......................................... 245Pivot Year ............................................... 245prompts for Column Maps ............... 243, 246

AliasCreator ID defaults, Create Process.. 403, 404Type indicator ........................................... 59

ALL CommandSelect Tables/Views panel......................... 68

Pending Process List................................ 438Selection criteria specification ................... 72

Allocating external files ........................489–493APPLY command

Sample session .......................................... 41Create Process ......................................... 406Table Map............................................... 267

APPLY Command, Table Map ..................... 268Insert Process .......................................... 338

ARChiveline command............................................ 56primary command...................................... 68table status ................................................ 57

Arithmetic calculationsColumn Maps.......................................... 252

Asterisk, Creator IDPrimary keys, generic .............................. 188Relationships, generic.............................. 217

AT line commandAccess Definition list....................... 183, 226

ATTRIBUTES commandAccess Definition ............................ 228, 261Primary Key ............................................ 187Sidelabels................................................ 107

Attributes, display column.............................. 92Authorization ID ..........................See Creator IDAutoSwitch Mode option.............................. 458

BBatch

Convert Process....................................... 432DB2 LOAD ProcessDelete Process ..................................386–387Extract Process ........................................ 318

JCL..................................................... 321option ..........................................312–385overrides............................................. 322Report................................................. 330

Insert Process .......................................... 355JCL............................................. 355, 361option ................................................. 344overrides............................................. 355

LOADPLUS Process................................ 376Batch Export Utility ..............................481–483

Control statements................................... 482EXPORT statement ................................. 482sample JCL ............................................. 481SUBDEF statement ................................. 482

Batch Import Utility ..................................... 483Control statements................................... 484IMPORT statement.................................. 484sample JCL ............................................. 483

Batch Maintenance Utilities ..................463–486categories ................................................ 463Control statements

description syntax ............................... 466guidelines ........................................... 465

COPY statement

Page 529: Move for DB2 User Guide

Index

User Manual 511

PST objects..................................476–478DELETE statement

PST objects......................................... 474DIRECTORY statement .......................... 467

PST objects..................................467–473Error Codes ............................................. 464ERROR statement ............................485–486general control statements ................485–486Object maintenance statements .........481–484PAGESIZE statement .............................. 485RENAME statement

PST objects..................................478–480sample JCL ............................................. 464

Batch UtilitiesArchive entry maintenance statements ..... 474Delete PST objects ...........................474–476PST object maintenance statements ......... 474

Bottom, scroll direction.................................. 95Browse

Control File ......................................440–446conversion error ...........................445–446example .......................................443–446LIST TABLES command .................... 442output data set .................................... 442parameters ...................................440–442row status ....................................441–446

Extract File ......................................440–446LIST TABLES command .................... 442output data set .................................... 442parameters ...................................440–442row status ....................................441–446

BROWSE command..................................... 168Business rules, Column Map........................ 245

CCANCEL command

Access Definitions, while defining....... 69–70DB2 LOAD Process, batch execution....... 379Extract Process, batch execution .............. 322Insert Process, batch execution ................ 355Relationships........................................... 211Row List processing .................................. 86

Caps Mode, User option............................... 448Cascade delete, Delete Process..................... 389Century Pivot Window ................................. 347Character data, converting............................ 237Child Limit, Specify Relationship Usage

panel ...................................................... 143Choose a Column Map panel........................ 224Choose a Definition Option panel................. 175Choose a Primary Key panel......................... 180Choose a Relationship panel......................... 193Choose a Table Map panel ........................... 256Choose an Access Definition panel................. 46CLEAR command ........................................ 254CLR line command, delete AGE function ..... 246COLUMN command

Describe Columns panel ...................... 75–76

Select Tables/Views panel......................... 68Column Map

Copy........................................................ 228Description.............................................. 227Rename ................................................... 229

Column Maps .......................................222–255AGE function .......................................... 242Aging specifications

removing............................................. 254Aging Specifications.........................243–246arithmetic calculations............................. 252business rules .......................................... 245Choose a Column Map panel ................... 224CLEAR command.................................... 254CLR line command.......................... 246, 254Column

compatibility................................237–239concatenation...............................251–252data type

compatibality...........................237–239validating ................ 232–233, 237–239

destination ...................................233–237display.........................................233–237matching source and desintation.......... 233selection list...............................239241source ........................................233237status ...........................................235–237validating..................... 232–233, 237–239

Concatenating columns.....................251–252Data conversion....................................... 239Data Conversion...................................... 237Data type

compatibility................................237–239validation..................... 232–233, 237–239

Default mapping...............................233–234Defining ...........................................222–255description............................................... 237Destination

columns .......................................233–237table, specifying.................................. 230

EQUAL column status ............................. 235ERROR column status ............................. 236EXIT column status ................................. 236Exit Routines.................... 253–254, 495–498EXPAND command................................. 253Explicit name .......................................... 225Export Process................................... 276–83

output file format ................................ 289EXPR column status................................ 236Expressions ......................................251–252Extract File, source table specification..... 230Functions..........................................242–251FUTURE_YEAR..............................246–248Import Process................................... 283–86LIST MAPS command............................. 271LIST UNUSED command.................239–240LITERAL column status .......................... 236Literal values........................................... 252Map display......................................229–233

Page 530: Move for DB2 User Guide

Index

512 Move for DB2

MAP ID................................................... 224MAP NAME ........................................... 224MAPPED column status .......................... 235MAPS command...................................... 273Matching columns ............................233–237Naming

conventions................................... 17, 223explicit values, using .......................... 225

NOT_INS column status .......................... 237NOTUSED column status ........................ 235NULL column status................................ 236Overview............................................. 11, 17POPULATE command

name considerations............................ 272PROP function..................................248–250Purpose ................................................... 223REQUIRD column status ......................... 236SAVE command .............................. 255, 274SELECT command .................................. 229Selecting ......................................... 224, 225Selection list.....................................225–229

columns, when specifying ............239–241SELECT command ............................. 229Table Map, from..........................270–271tables, when specifying ....................... 233

sourceexplicit value .............................. 241, 254

Sourcecolumns .......................................233–237Extract File DSN ................................ 230table ................................................... 230table, specifying...........................230–233

SPC_REG column status ......................... 236Specifying tables ..............................230–237SRC line command.................................. 246Table Maps ............................................. 269Tables

respecifying ........................................ 237specifying ....................................230–233

UNKNOWN column status...................... 236Using ...................................................... 255Validation ........................................232–239

rules specification ............................... 225VALIDATION command......................... 238

Columnar formatMax Disp Width option ........................... 456Point-and-Shoot......................................... 89

ColumnsAttributes

display option ..................................... 455Point-and-Shoot display ........................ 92

CompatibilityColumn Maps ..............................237–239relationships ................................. 507–12

ConcatenatingColumn Maps ..................................... 252relationships ................................... 207–8

Display, specifying .................................... 75Impact of data base changes..................... 169

Mapping............................ See Column MapsMatching................................................. 235Matching in Column Maps ...............233–237Name

primary keys ....................................... 186relationships ............................... 202, 214

restrictions ..................................... 214Naming conventions ............................ 17–19Selection list, relationships, defining ....... 207Specification indicators.............................. 57Substringing in relationship ............... 208–10Truncated display ...................................... 99Validating for Column Map..............232–237

CommandsAccess Definition

selection list.......................................... 52when defining ................................. 68–69

Column Mapselection list........................................ 229when defining ..................................... 237

CREATE Object List ............................... 407Describe Columns for AD panel ................ 78Export Process

object selection list ............................. 281Report................................................. 283

Import Process......................................... 286Point-and-Shoot......................................... 93Primary key

selection list........................................ 185when defining ..............................186–188

Relationshipselection list........................................ 196when defining ..............................212–214

Row List processing ............................ 85–86Select Tables/Views for AD panel ............. 60Specify Relationship Usage panel ............ 144Specify Selection Criteria panel ................. 75SQL WHERE Clause panel ....................... 81Table Map

selection list.................................259–262when defining ..................................... 269

Commit pointsDelete Process ......................................... 384Insert Process .......................................... 343

Compatible ColumnsColumns.................................................. 237Column Maps.......................................... 239Relationships..................................... 507–12

CONCAT operatorColumn Maps.......................................... 252Relationships....................................... 207–8

Concatenating columnsColumn Maps.......................................... 252Relationships....................................... 207–8

Confirm on Deletes, User option .................. 448Control File

Allocating.........................................489–493Browsing..........................................440–446Convert Process....................................... 429

Page 531: Move for DB2 User Guide

Index

User Manual 513

DB2 LOAD Process................................. 365Naming conventions .................................. 19Overview..........................................332–333Printing ........................................... 503, 504Retry/Restart Process............................... 437

Control File DSNDelete Process ......................................... 383Insert Process .......................................... 341

Convert Process ................................... 428, 435Batch execution....................................... 432Control File

DSN ................................................... 429selection list........................................ 431

Destination Extract File DSN .................. 429Discard limit ........................................... 430Discarded rows........................................ 435Extract File

destination DSN.................................. 429selection list........................................ 431source DSN......................................... 429

Modifying dates at destination ................. 429Overview................................................. 428Parameters .......................................428–431propagating primary key values................ 430Report ..............................................433–435Review JCL............................................. 430Selection list for Extract

File/Control File ................................. 431Sort using cluster index ........................... 430Source Extract File DSN.......................... 429Status .............................................. 431, 432Table Map............................................... 429

Convert Process ReportAging information ........................... 362, 434

Convert with Extract ...................................... 35Converting

Data .................................................237–435Primary key to generic ............................. 190Relationship to generic .....................219–220

COPY statementBatch Maintenance Utilities

PST objects..................................476–478Correlation name............................................ 80COUNT Command......................................... 91CR/CRA line commands

Create Process ..................................407–412Insert Process .......................................... 353

CREATE commandCreate Process ..................................407–412Insert Process .......................................... 353Synonyms, Create Process ....................... 426

CREATE Object ListCreate Process ..................................407–416Insert Process .......................................... 352Line commands ................................407–408Modifying................................................ 412Primary commands .................................. 416Review SQL............................................ 410SQL line command.................................. 415Status ...............................................411–412

Create Process.......................................390–427CONFLICT object status ..................411–412CR/CRA line commands... 407–408, 411–412CREATE command .......... 407–411, 412–426CREATE Object List ........................407–416

line commands.............................407–408modifying ........................................... 412primary commands.............................. 416review SQL......................................... 410status ...........................................408–412

CREATED object status .......................... 412DB2 line command...........................408–413DB2 output.............................................. 415Defaults............................................391–404

Creator ID............................392, 403–404index ...........................................392–400table ............................................392–395tablespace ............................392, 395–399

DEFAULTS command............................. 413Destination table type .............................. 406DR line command.............................408–412Drop objects .....................................408–412EXISTS object status............................... 411Extract File DSN..................................... 391Grant privileges................................421–424Menu....................................................... 390Object status.....................................408–412Output SQL......................................426–427Output, DB2............................................ 415Overview................................................. 390PENDING object status ........................... 412Perform ............................................407–416PST line command ...........................408–413Relationships....................................413–414Review SQL.....................................410–415Save SQL .........................................426–427SELECT object status.............................. 411SHOW command..................................... 414SQL

output ..........................................426–427review..........................................410–415save .............................................426–427

SQL line command.................................. 415Synonyms.........................................424–426Table Map........................................404–407

CREATE RELATIONSHIP command ...192–193Access Definition ...................................... 65Select Tables/Views panel......................... 65Specify Relationship Usage panel ............ 144

Creating relationships ...........................200–201Creator ID

Batch overrideExtract Process ................................... 323

Batch OverrideExtract Process ................................... 323Insert Process...................................... 355

Column Mapdestination table.................................. 230source table......................................... 230

Create Process defaults.....................403–404

Page 532: Move for DB2 User Guide

Index

514 Move for DB2

Default in Access Definition...................... 55Generic primary keys........................188–191Generic relationships........................217–220impact on relationships............................ 149Naming conventions ............................ 17–19

CriteriaSample session example ...................... 30–32Selection

begin display with option .................... 172Begin display with option.................... 172Extract Process batch override............. 323Modify option ..................................... 171specifying ............................71, 73, 74, 75

Sort, specifying.......................................... 76

Specifyingselection ......................................... 71–75sort ....................................................... 76SQL WHERE Clause ............................ 81

SQL WHERE clauseExtract Process batch override......324–325specifying ............................................. 79

CyclesBrowsing................................................. 111Insert Process commit points.................... 352Referential .......................................161–167Traversal ................................................. 160

DDA field......................................................... 60Data conversion

Column Maps...................................237–239Convert Process................................428–435Error identification ...........................445–446

Data MigrationDestination ...........299. See also DB2 LOAD.See also InsertFunctions................................................. 299Menu................................................300–302Source ...........................299. See also Extract

Data set prefix default, User option .............. 450Data type

Compatibility for Column Maps............... 237Describe Columns panel ...................... 77–78Point-and-Shoot display............................. 92Values for Column Map functions ........... 251

DATE, Aging DB2 column........................... 246Date Aging, Insert Process batch overrides ... 356Date Formats

character set ............................................ 511examples ................................................. 512overview.................................................. 511

Dates, modifying at destinationColumn Maps.......................................... 242Convert Process....................................... 429Insert Process ...................................342–344Load Process ........................................... 369LOADLUS .............................................. 375

DB2Aging DATE and TIMESTAMPcolumns................................................... 246

DB2 CatalogCreate Process ..................................413–414Directory ................................................. 177Referential Integrity................................... 15Relationship source ................................... 63Relationship source identifier .................. 144Relationships....................................192–200Used by MOVE......................................... 15

DB2 Common ServerExtract File usage.................................... 301

DB2 delimited identifiers............................... 18DB2 LIKE character

Access Definition selection...........47–48, 307Column Map selection............................. 224DSN selection ......................................... 126POPULATE Command............................ 272Primary key selection............................... 180Relationship selection.............................. 195Table Map selection .........................257–258Using ........................................................ 18

DB2 LIKE syntax......... See DB2 LIKE characterDB2 line command, Create Process .......408–413DB2 LOAD Process ..............................363–382

Check Pending status........................380–381Control File DSN .................................... 365COPY ..............................................368–369Discard limit ........................................... 371Enforce RI constraints.............................. 368Extract File DSN..................................... 365Image Copy ......................................368–369JCL review.............................................. 377Job processing ..................................377–382Job steps...........................................379–380LOADPLUS utility .................................. 372LOG........................................................ 367Menu....................................................... 364Overview................................................. 363Parameters .............................................. 366Perform ................................................... 364propagating primary key values................ 371REPAIR .................................................. 367RESUME ................................................ 366Review JCL............................................. 371RUNSTATS ............................................ 369Table Map............................................... 364

DB2 Output, Create Process......................... 415DB2 RI, impact on Delete Process................ 389DB2 subsystem display, User option............. 449DB2DATE................................................... 246DEFAULTS command

Create Process ......................................... 413Insert Process .......................................... 353

Defaults, Create Process........................391–404Creator ID ............................................... 392Index................................................392–400Table................................................392–395

Page 533: Move for DB2 User Guide

Index

User Manual 515

Tablespace .......................................392–399DEFCID

Extract Process batch override ................. 323Insert Process batch override.................... 355

Definitions ............................................175–298Column Maps...................................222–255Exporting .........................................275–283Importing..........................................275–298Primary keys.....................................179–191Relationships....................................192–221Table Maps ............................................. 256

DeleteTable Maps ............................................. 262

Delete confirmation, User option.................. 448Delete Process.......................................383–389

Batch....................................................... 387Batch execution....................................... 386Cascade delete......................................... 389Commit points......................................... 384Control File DSN .................................... 383Discard limit ........................................... 384Discarded Rows....................................... 387Extract File DSN..................................... 383Handling updates..................................... 389Locking tables ......................................... 384Non-unique keys...................................... 388Overview................................................. 383Parameters .............................................. 383Report ............................................. 388, 389Review JCL............................................. 385Specifying ............................................... 388Status ...................................................... 386

DELETE statementBatch Maintenance Utilities

PST objects......................................... 474Deleting tables

from Access Definition .............................. 67From data base, impact............................ 170

Delimited identifiers ...................................... 18Delimiter character option............................ 454Describe Columns for AD panel ..................... 72

SEL command ........................................... 72SQL command..................................... 79, 80

Describe Columns panel................................. 76Commands ................................................ 78Data type................................................... 78Sort criteria ............................................... 76Unzoom display......................................... 78Zoom display............................................. 79

DescriptionAccess Definition ...................................... 52Column Map ................................... 227, 237Primary Key ............................................ 182Relationship ............................................ 202Table Map............................................... 266

DirectoryAccess Definition stored ............................ 70Create Process ................................. 413, 414Migrating to another subsystem ............... 275Overview................................................... 15

Primary Keys........................................... 179PST

Relationship source identifier.............. 144Relationship type identifier...................... 144Relationships................................... 192, 200Table Maps ............................................. 269updating .................................................. 178

DIRECTORY statementBatch Maintenance Utilities .................... 467

PST objects................................. 467, 473Discarded rows

Delete Process ......................................... 387Insert Process .................................. 343, 351

Displaying data, length exceeds column width 99Displaying selection lists

Choose an Access Definition...................... 46Displaying SQL............................................ 124Down, scroll direction .................................... 95DR line command, Create Process........ 408, 412Dropping objects, Create Process ......... 408, 412

EEditing

displaying SQL........................................ 124Editor Display Format option ....................... 456Editor Options

AutoSwitch Mode.................................... 458Specifying ........................................454–458

END commandRow List processing .................................. 86

END Command.............................................. 20EQUAL, Column Map status........................ 235Error conditions

Extract Process Access Definition.....319–321Error Handling

Table selection .......................................... 70Table Selection.......................................... 70

ERROR statementBatch Maintenance Utilities .............485–486

ERROR, Column Map status........................ 236Every Nth....................................................... 60EXCLUDE Command .............................. 97–98Exclude line command ................................... 97Excluded lines

showing..................................................... 99Exit Routines

Column Map .................... 253–254, 495–498Parameters .............................................. 496Requirements .......................................... 495Return Codes........................................... 497Samples................................................... 498Sets destination ....................................... 496Special Registers ..................................... 497Termination call ...................................... 498

EXIT, Column Map status............................ 236Expand

Sidelabels, Scrolling................................ 106EXPand

Page 534: Move for DB2 User Guide

Index

516 Move for DB2

line command............................................ 56EXPAND command ..............................100–101

Column Maps.......................................... 253Relationships........................................... 210Sidelabels display.................................... 105

Expand dataSidelabels................................................ 104

Export ProcessAPPEND to build output ......................... 281Choose objects......................................... 279Definition Type ....................................... 276Deleting objects....................................... 278Output DSN ............................................ 277Output file

APPEND ............................................ 281Disposition ......................................... 278

Output file format.............................286–298Access Definitions .......................292–296Column Maps ..................................... 289primary keys ....................................... 288relationships ....................................... 288Table Maps..................................290–292

Overview................................................. 275Report ..................................................... 283REPORT command ................................. 283Report DSN............................................. 278Selecting object definitions...................... 280Selection Lists of objects ......................... 280Subordinate objects ................................. 277Types of definitions ................................. 276Using ................................................ 276–83

Export Summary .......................................... 282EXPR, Column Map status........................... 236Expressions

Column Map ........................................... 252Expressions for Column Map ....................... 251Extended relationship, overview................... 192Extract File

Allocating.........................................489–493Browsing..........................................440–446Convert Process

destination .......................................... 429source ................................................. 429

DB2 LOAD Process................................. 365Definition................................................ 304definition of............................................... 10from DB2 Common Server ...................... 301Name for Column Map source ................. 230Naming conventions .................................. 19Object definitions .................................... 308Object Definitions ................................... 309Overview................................................... 15Printing ............................................503–504Purpose ................................................... 332Sample session .......................................... 35Selection list............................................ 313Specifying DSN....................................... 310

Extract File DSNCreate Process ......................................... 391Delete Process ......................................... 383

Extract Process ........................................ 310Insert Process ...................................335–341

Extract processGroup selection ....................................... 138

Extract Process......................................304–331Access Definition

create.................................................. 306Create................................................. 306error conditions............................319–321NEW Relationship .............................. 320Permanent........................................... 306selection list........................................ 307specification........................................ 306Temporary .......................................... 306UNKNOWN Relationship................... 320Validated ............................................ 319warnings ......................................320–321Warnings ............................................ 320

Aliases .................................................... 309Batch execution....................................... 318

JCL..................................................... 321Batch overrides........................................ 322Error conditions................................319–321Execution ................................................ 318

Batch .................................................. 318Online ................................................ 318

EXTRACT Errors & Warnings Panel....... 321Extract File DSN..................................... 310Group Selection....................................... 140Limit Number of Rows ............................ 311Menu................................................305–307Object Type............................................. 308Online execution ..............................318–329Online status ........................................... 329Overview......................................10–11, 304Parameters ...............................307, 310–312Perform Convert with Extract .................. 312Point-and-Shoot................................. 84, 135

Validation........................................... 321Report ..............................................330–331

Printing............................................... 331Review JCL............................................. 312Select Start Table Rows by ...................... 311SHOW STEPS......................................... 321Specify relationships................................ 141Specify Relationships .............................. 167UNLOAD PLUS...................................... 328UNLOAD PLUS utility.....................313–315Views...................................................... 309Warnings..........................................320–321

FFIND command.............................................. 98

Hexadecimal data .................................... 102Primary keys selection list ....................... 185

Foreign keys............................See RelationshipsFunction keys................................................. 20FUTURE_YEAR function.....................246–248

Page 535: Move for DB2 User Guide

Index

User Manual 517

Column Maps.......................................... 242Convert Process....................................... 429Insert Process .......................................... 342Load Process ........................................... 369LOADPLUS ............................................ 375

GGeneric

Primary keys...................................... 188–91Relationships..................................... 216–21

GENERIC commandPrimary keys............................................ 190Relationships....................................219–220

GET TABLES RELATEDExample .............................................. 28–30Select Tables/Views panel......................... 68

GR line command .......................................... 64Grant privileges

Create Process ......................................... 424output...................................................... 424Review SQL............................................ 423Selection list of objects............................ 423SQL ........................................................ 424

Grant privileges, Create Process................... 421GROUP

Access Definition name ............................. 14Access Definition specification .................. 47Profiled ..................................................... 48

GROUP command........................................ 138Select Tables/Views panel......................... 68

Group Selection processingIndicator .................................................... 55

Group Selection Processing .......................... 138Indicated ................................................. 140Start Table Options field ......................... 140

HHELP Command ............................................ 20

function key............................................... 20HEX command............................................. 102Hex display option ....................................... 455Hexadecimal display

HEX command ........................................ 102

IImport Process

Definition Type ....................................... 284Error handling ......................................... 284Existing definitions ................................. 284Input DSN............................................... 284Overview................................................. 275Report ..................................................... 286Report DSN............................................. 285Types of definitions ................................. 284Using ................................................ 283–86

Import Summary .......................................... 285

INDENT commandMulti-way join......................................... 121Select Tables/Views panel......................... 69

INDENT Command.................................. 65–67Multi-way join......................................... 123

Indented Table Display ............................ 65–67Multi-way join......................................... 123

Index defaults, Create Process ...............392–400Indexes, selection list ................................... 187Information

Relationshipusing Info command............................ 145

Table Map............................................... 260Information Retrieval Utilities

sample JCL ............................................. 464Input DSN

Import Process......................................... 284Point-and-Shoot................................. 85–135

Insert Process ............................................... 334Batch................................................354–355Batch execution....................................... 361Batch Execution ...................................... 355Batch overrides.................................355–359Batch/online execution ............................ 344Commit points......................................... 343CR/CRA line commands.......................... 353CREATE command ................................. 353CREATE Object List ............................... 352Create objects.................................. 352, 353DEFAULTS command............................. 353Destination table

Type ................................................... 338Destination Table

Type ................................................... 339Discard limit ........................................... 343Discarded rows........................................ 351Extract File DSN..................................... 335Insert vs Update...............................339– 340Menu................................................334–335Modify dates at destination...................... 344Modifying dates at destination ................. 342Online status ........................................... 354Online/Batch execution ........................... 344Overview......................................11–12, 334Parameters .............................................. 341Perform Insert

Option ................................................ 335Perform Update

Option ................................................ 335propagating primary key values.........343–344Report ..................................................... 361

Print ................................................... 362Review JCL............................................. 344Review SQL............................................ 353Sample session .................................... 39–42Selection list............................................ 336SQL, review ............................................ 353Table Map

Column Map Name............................. 338Dest CID............................................. 336

Page 536: Move for DB2 User Guide

Index

518 Move for DB2

destination tables ................................ 337extract tables ...................................... 337specifying ........................................... 336Specifying................................... 338, 339Src CID............................................... 336Table names ....................................... 339Type ................................................... 337UNKNOWN ....................................... 337

Insert Process Report.................................... 362Invalid Dates, specify handling..................... 348

JJCL

Convert Process....................................... 432execution ............................................ 432

Delete Process ..................................386–387Extract Process ........................................ 321Insert Process ...................................355–361Review

DB2 LOAD Process ............................ 377LOADPLUS utility ............................. 377

Job Card, Specifying .................................... 460Job Card and Print Options, Description....... 460Job Card review, User option ....................... 451Join

First displayed table ................................ 114impact on display..................................... 114INDENT command.......................... 121, 123multiple relationships .............................. 112Multi-table display .................................. 113Multi-way.........................................117–124

Example ......................................119–120no related tables ...................................... 112no table specified..................................... 111one related table ...................................... 108overview...........................................108–112requirements ........................................... 108Scrolling display...................................... 114sidelabels restriction................................ 107Stack ....................................................... 118SWITCH command.................................. 120Table selection list .................................. 111UNJOIN command

impact on stack ................................... 124Multi-way join .............................123–124

unjoining................................................. 117zooming display................................115–116

JOIN commandassign to PF key....................................... 110NEW operand.......................................... 168using ....................................................... 108

LLeft, scroll direction....................................... 95Line Characters

Editing .................................................... 453option to modify ...................................... 450

Line commandsEditing Table List...................................... 67for scrolling expanded data ...................... 101Get Related tables ..................................... 64Point-and-Shoot......................................... 93Relationship editing........................... 212–13Select tables .............................................. 63Select Tables/Views panel......................... 69SQL WHERE Clause panel ....................... 81table list .................................................... 56

LIST COLUMNS command ......................... 207primary keys............................................ 187Relationships........................................... 211SQL WHERE Clause panel ....................... 81

LIST CommandColumn Maps.......................................... 239Create Process Table Map ....................... 406Insert Process Table Map......................... 338Table Maps ............................................. 266using for Column Map......................240–241

LIST MAPS commandColumn Maps for Table Maps ................. 269Column Maps from Table Map................ 271

LIST TABLES commandAccess Definition ...................................... 63Browse Control File ................................ 442Browse Extract File ................................. 442Insert Process .......................................... 337

LIST TABLES CommandExample .............................................. 61–62

LIST TABLES RELATED commandExample .................................................... 63

LIST UNIQUE INDEX command................. 187LIST UNUSED, Table Maps........................ 266LITERAL, Column Map status ..................... 236Load Process, Modifying dates at destination 369Load Utility, specifying ................................ 448LOADPLUS,

Modifying dates at destination ................. 375RESUME ................................................ 373

LOADPLUS Processpropagating primary key values................ 376Review JCL............................................. 376

LOADPLUS utilityBatch execution....................................... 379Discard limit ........................................... 376Image copy .............................................. 374JCL review.............................................. 377Job processing ..................................377–382Job steps...........................................379–380Parameters .............................................. 372REDEFINE ............................................. 373REPAIR .................................................. 373RESUME ................................................ 372RUNSTATS ............................................ 374UNIQUECHECK..................................... 375

LOADPLUS utility....................................... 372LOCAL

Column Map, Insert Process .................... 338LOCATION

Page 537: Move for DB2 User Guide

Index

User Manual 519

Choose a Definition Option panel ............ 177Choose an Access Definition...................... 47Migration Menu ...................................... 303

LOCK command ............................................ 95LOCK Command

Sidelabels format..................................... 104Locking, Sidelabels format ........................... 104Locking columns ............................................ 95Locking tables, Delete Process ..................... 384LR line command......................................... 197

MMain Menu .................................................... 24

MOVE Only............................................ 487Maintain Relationships panel ................. 193–95Maintenance Utilities

Batch................................................463–486categories ................................................ 463

MAP command, Column Maps..................... 223MAP ID

Column Map ........................................... 224Table Maps ............................................. 257

MAP NAMEColumn Map ........................................... 224Table Maps ............................................. 257

MAPPED, Column Map status ..................... 235MAPS command .......................................... 273MAX ROWS Command........................... 91–92Maximum Fetch Rows option....................... 455Maximum Fetch Rows options

COUNT Command.................................... 91Maximum Rows

Limit by Table........................................... 60MODEL command, for relationships ...... 215–16Modify DATEs and TIMESTAMPs

Insert Process .......................................... 344Modifying table names

in Access Definition .................................. 68MORE, scroll indicator .................................. 95MOVE

Naming conventions .................................. 18Overview................................................... 14

Move for DB2Main Menu ............................................... 24Session overview....................................... 23

NNAME

Access Definition name ............................. 14Access Definition specification .................. 47Profiled ..................................................... 48

Naming conventions................................. 17–19Creator ID ................................................. 55DB2 LIKE syntax ...................................... 18DSN.......................................................... 19

NEW, Relationship status ............................ 142NONE, as aging rule .................................... 244

NOT_INS, Column Map status..................... 237NOTUSED, Column Map status................... 235NULL attribute, Point-and-Shoot display........ 92NULL Value option...................................... 454NULL, Column Map status .......................... 236Numeric data, converting ............................. 238

OObject definitions

Create Process ......................................... 416Export Process................................... 276–83Exporting subordinate objects.................. 277Extract Process ........................................ 307extracting ................................................ 308Import Process................................... 283–86Insert Process ...................................352–353Overview................................................... 17Sample session .......................................... 33Selecting for extract................................. 308Status for Extract Process ........................ 308

Object DefinitionsCreate Process ......................................... 390Dropping, Create Process..................408–412Extract Process ........................................ 309Extract Process Report............................. 331Option for Extract Process ....................... 311Selecting for extract................................. 309

OBJECTS, Extract Process optionsee also Object definitions ....................... 306

ONLY Command ........................................... 99Options

Editor ...............................................454–458Job Card and Print................................... 460Line Characters ....................................... 452menu ....................................................... 447User .................................................448–452

OutputCreate Process ......................................... 415

OUTPUT commandConvert Process Report............................ 435Delete Process Report.............................. 389from SHOW STEPS display .................... 151Relationship Usage Report ...................... 152Specify Relationship Usage panel ............ 150

OUTPUT Command..................................... 126Extract Process Report............................. 331Insert Process Report ............................... 362

Output Date Format, Column Maps.............. 244Output DSN

Export Process......................................... 277File Layout .......................................499–502Point-and-Shoot....................................... 135

Output fileAllocating.........................................489–493Export Process format.............................. 286

Output Rows with Invalid Dates................... 348Output Rows with Skipped Dates ................. 349Output SQL, Create Process ..................426–427

Page 538: Move for DB2 User Guide

Index

520 Move for DB2

PPAGESIZE statement

Batch Maintenance Utilities .................... 485Parameters

Browse Control File .........................440–442Browse Extract File ..........................440–442Convert Process................................428–431DB2 LOAD Process................................. 366Delete Process ......................................... 383Extract Process .................................307–312Insert Process .......................................... 341LOADPLUS ............................................ 376LOADPLUS utility .................................. 372Retry/Restart ........................................... 439Update Process ........................................ 341

PARAMETERS command.....................146–171Access Definitions............................171–172Select Tables/Views panel......................... 69

PARAMETERS Command........................... 172Partial Primary Key...............................501–502Password, specifying .................................... 450PATHS, Extract Process Option

see also Relationships.............................. 306Pending Process, Parameters ........................ 439Pending Process List

ALL Command........................................ 438Process attributes..................................... 438

Pending Process List, Retry/Restart Process . 436Pending Process Parameters ......................... 439Perform Convert with Extract

Extract Process ........................................ 316POINT command ..................................... 30, 85

Select Tables/Views panel......................... 69POINT Command

Subsequent requests ................................ 136Point-and-Shoot ..................................... 84–136

Change Start Table .................................. 136Column display specifications.................... 75Columnar display ...................................... 89Commands ................................................ 93confirmation from Extract Process ........... 135Display column attributes .......................... 92Display SQL............................................ 124Example .............................................. 30–32excluding rows .......................................... 97Expanding columns ................................... 99

Scrolling ............................................. 101File Layout .......................................499–502FIND command ......................................... 99finding specific rows.................................. 98Handling multiple tables...................113–117Hexadecimal display................................ 102Initial display ............................................ 87Input DSN......................................... 85–135

intervening changes .............................. 86Join ..................................................108–112Locking columns ................................. 95–97Multiple table display.......................113–114ONLY command ....................................... 99

Output DSN ............................................ 135POINT Command...................................... 85Row List file

Allocating ....................................489–493Row List indicated................................... 137Screen elements................................... 89–91Screen size considerations ......................... 91Scrolling.............................................. 95–99Scrolling multiple tables.......................... 114SELECT RELATED command .................. 94Select Related line commands ................... 31Select Related line commands ................... 31Selecting rows ........................................... 94selection criteria prompt ............................ 87Selection criteria prompt............................ 87session basics ............................................ 88showing excluded rows.............................. 99Sidelabels................................................ 107

considerations ..................................... 106Sidelabels display...................................... 89sidelabels format ..................................... 103Start Table Options field ......................... 137Terminate session.............................135–136terminating session.................................. 135Unjoin ..................................................... 117Unjoining ................................................ 117UNSELECT RELATED command............. 94Unselecting rows ....................................... 94Using Row List and Criteria .................... 311Validation ............................................... 321ZOOM .................................................... 115

POPULATE command ..........................271–272Pop-up window

Table selection list .................................... 62Pop-up Window ............................................. 19Precision attribute, Point-and-Shoot display.... 92Primary keys .........................................179–191

Column name .......................................... 186Commands .............................................. 188converting to generic ............................... 190Copy........................................................ 184Create Process ......................................... 413Defining ...........................................179–191deleting ................................................... 188Description.......................................182–187Export Process................................... 276–83

output file format ................................ 288Generic ............................................. 188–91Import Process................................... 283–86Line commands ....................................... 186modifying .........................................186–188Overview................................................... 15propagating

Cpmvert Process ................................. 430DB2 LOAD Process ............................ 371Insert Process...............................343–344LOADPLUS Process ........................... 376

Propagating Key Set(s) panel............349–350propagate value ................................248–250Rename ................................................... 184

Page 539: Move for DB2 User Guide

Index

User Manual 521

Specify partial ..................................501–502specifying values for extract............... 84–136Selection list

commands........................................... 185selection list of ........................................ 182

Princeton Softech DirectorySee Directory ............................................. 15

Printing Extract File/Control File ......... 503, 504Privot Year

Column Maps.......................................... 245PROP function ......................................248–250

example of use ........................................ 349for aging.................................................. 246

Propagate, primary key value.................248–250Propagating Key Set(s) panel ................349–350PST line command, Create Process........408–413

QQ1

examples ..........................................154–159Specify Relationship Usage panel ............ 142value for referential cycle .................163–167value for traversal cycle ........................... 160

Q2and selection criteria................................ 156examples ..........................................155–159Specify Relationship Usage panel ............ 142value for referential cycle .................163–167value for traversal cycle ........................... 160

RRAND function ............................................ 251Random Selection

Specifying ................................................. 60Random Selection .......................................... 60REF Command............................................... 30Ref Tbl .......................................................... 59Reference tables............................................. 59Referential Cycles .................................161–167Referential Integrity

Access Definition use of ............................ 15Delete Process ......................................... 389

REL Primary command .................................. 32REL Primary Command ............................... 144Relationship

Alter traversal paths ................................ 161description............................................... 202Display tables in context...................... 65–67Display tables in join context................... 123Handling RI rules .................................... 161Impact of changes .................................... 215Information.............................................. 145NEW status ......................................146–148PARAMETERS....................................... 146Referential Cycles ............................161–167Specify Relationship Usage

Child Limit ......................................... 143

Child .................................................. 143Name.................................................. 143Parent ................................................. 143Q1 to extract parents........................... 142Q2 to extract children of parents ......... 142Type ................................................... 144

Statusaffected by changes ......................147–148Creator ID, changing........................... 149example .............................................. 148NEW .................................................. 150specifying ....................................146–147UNKNOWN ....................................... 149UNKNWN.......................................... 149

Traversal Cycles ...............................159–161UNKNOWN

Extract Process Warning ..................... 320UNSELECT ............................................ 150USE command......................................... 148Use New Relationship Prompt ................. 146Using ...............................................153–161

RELATIONSHIP commandSelect Tables/Views panel......................... 69

Relationship Usage, report ........................... 152Relationships ........................................192–221

Alter traversal paths ................................ 153Column compatibility ........................ 507–12Column names..................................202–214Concatenating columns........................ 207–8Create Process ..................................413–414CREATE RELATIONSHIP

command .............................144, 192, 193creating ............................................200–201Defining ...........................................192–221editing..............................................201–214Expanding protected columns .................. 210Export Process................................... 276–83

output file format ................................ 288Extract Process, selecting for ................... 152Generic ............................................. 216–21Impact of data base changes..................... 170Import Process................................... 283–86Line commands for editing ................ 212–13listing columns while defining ................. 207Maintain Relationships panel ............ 193–95modeling ................................................. 215NEW, Extract Process Warning ............... 320Overview................................................... 16Primary Keys........................................... 179propagating key values .....................349–350Referential Cycles ................................... 161REL command........................................... 32selecting...........................................141–152Selection list, commands ..................196–200Selection List for joining ......................... 112selection list of .................................. 196–97SHOW STEPS command............33, 150–151

example .............................................. 150Specify Relationship Usage Panel ............ 144Status ...................................................... 142

Page 540: Move for DB2 User Guide

Index

522 Move for DB2

substringing columns......................... 208–10using as a model for others ................ 215–16

REMOTE, on Select Tables/Views................. 57RENAME statement

Batch Maintenance UtilitiesPST objects..................................478–480

ReportConvert Process................................433–435Delete Process ..................................388–389Extract Process .................................330–331Insert Process ...................................361–362

REPORT commandExport Process......................................... 283Import Process......................................... 286

Report DSN, Export Process ........................ 278Report Invalid Dates .................................... 348Report Skipped Dates................................... 348Reports, Default JCL.................................... 460REQUIRD, Column Map status.................... 236Restart process

overview.................................................. 332Parameters .............................................. 439

Retry processoverview.................................................. 332Parameters .............................................. 439

Retry/RestartControl File ............................................. 437

Retry/Restart Process ............................436–439Menu Option ........................................... 436Parameters .............................................. 439Pending process attributes ....................... 438Pending Process List................................ 436

RF field ......................................................... 59Right, scroll direction..................................... 95Row Limit by table......................................... 60Row List

Create File .......................................499–502Indicator .................................................... 56option for Extract Process ........................ 311

RUNSTATSDB2 LOAD Process................................. 382

SSample session............................................... 23

Browse Extract File ................................... 38Data Migration menu................................. 27Destination, specify ................................... 38Extract Parameters .................................... 35Extract Process Menu ................................ 28Extract Process Report............................... 37GET TABLES RELATED ......................... 30GET TABLES RELATED command.......... 28Insert Process

Control File .................................... 38, 39Extract File........................................... 38limit discarded inserts........................... 42menu .............................................. 38, 39

online/batch .......................................... 42Options................................................. 39perform................................................. 42Table Map ............................................ 39Update/Insert ........................................ 39

Object definitions, specify ......................... 33Perform Extract Process............................. 35POINT command....................................... 30Point-and-Shoot................................... 31, 32REL command........................................... 32SHOW STEPS........................................... 33specify criteria........................................... 30Specify destination .................................... 42Specify source ........................................... 27Temporary specifications ........................... 28

SAVE commandAccess Definition ...................................... 70Column Map for Table Maps................... 274Column Maps.......................................... 255Relationship definition ............................ 214Table Maps ............................................. 268

Saving batch JCL ......................................... 327DB2 LOAD process................................. 378Insert Process .......................................... 360

Screen elements ....................................... 89–91Screen format................................................. 19Scrolling

columnar format, Point-and-Shoot.............. 95ISPF function....................................... 20–21joined display .......................................... 114locking columns......................................... 95Point-and-Shoot

Expanding columns............................. 101Select Tables/Views .................................. 67sidelabels format ..................................... 103Tables selection list ................................... 62Zoomed Describe Columns/Specify Selection

Criteria ................................................. 79Security status

Access Definition .............................228–261SEL CommandExample......................................................... 72Extract Process batch override...................... 323

Select Access Definition panelSELECT Primary Command

Column Map selection list ....................... 229Export Process......................................... 280Table Maps ............................................. 262

Select Primary Keys panel............................ 182SELECT RELATED command....................... 94Select Related line commands ........................ 94Select Tables, selection list ............................ 63Select Tables/Views

Access rights ............................................. 58ALL Command.......................................... 72Commands ................................................ 68

line ....................................................... 69CREATE RELATIONSHIP command........ 65Delete tables from ..................................... 67Every Nth.................................................. 60

Page 541: Move for DB2 User Guide

Index

User Manual 523

GET TABLES RELATED command.... 63–64INDENT.................................................... 65Line commands ......................................... 67LIST command .......................................... 61LIST TABLES RELATED command ......... 63Modify table names ................................... 68Row Limit ................................................. 60Scrolling.................................................... 67selection list .............................................. 62Status indicator.......................................... 83table criteria indicator................................ 57Table criteria indicators............................. 57Type indicator .......................................... 59Table name................................................ 58

Selection criteria ...................................... 71–75Defining .................................................... 80specifying............................................ 72–81

Selection CriteriaALL Command.......................................... 72Defining ...................................73–74, 79–81Extract Process batch override ................. 323Group selection processing ...................... 140Group Selection Processing ..................... 138Random factor ........................................... 71Row limit .................................................. 71Valid operators.......................................... 74

SELECTION CRITERIA commandPoint-and-Shoot......................................... 87Select Tables/Views panel......................... 69

Selection listAccess Definition ...................................... 48Column Maps.......................................... 226

for Table Maps ................................... 269Column Maps from Table Map.........270–271columns in primary key............................ 187Convert Process, Extract File/Control File431Column Map

Copy........................................... 228, 261Rename ...................................... 229, 262

Copy........................................................ 182Export Process Object Definitions ........... 280Extract File ............................................. 313Extract Process, Access Definition........... 307Grant privileges objects ........................... 423indexes, primary keys .............................. 187Insert Process, Extract File/Control File... 336Pending Process List................................ 436POPULATE command............................. 272Primary Keys........................................... 182Relationships, for joining......................... 112Rename ................................................... 183Table

browse Control File ............................ 442browse Extract File ............................. 442Column Map specification .................. 233related .................................................. 63

Table Maps ............................................. 259Tables when joining ................................ 111

Selection lists ofcolumns for group selection ..................... 138

columns when defining relationship......... 206relationships...................................... 196–97

SEQ function ............................................... 251Session options .............................447, 448, 455

Editor .............................................. 454, 458Job Card and Print................................... 460User ................................................ 448, 452

Severing a join ............................................. 117Short name, Tn .............................................. 90SHOW command

Column Map status.................................. 239CREATE Object List ............................... 414Primary keys selection list ....................... 185

SHOW SQL commandsaving the output ..................................... 126

SHOW STEPS CommandExtract Process ........................................ 321example........................................... 150, 151overview.................................................... 33

SHOW STEPS display, OUTPUT command. 151SID line command........................................ 103Sidelabels

considerations.......................................... 106Display column attributes ........................ 107expanding data ........................................ 105Expanding data........................................ 104Joining during ......................................... 107Line commands during ............................ 107Max Disp Width option ........................... 456Zoom....................................................... 107

SIDELABELS command .............................. 103Sidelabels format

Point-and-Shoot................................. 89–103scrolling .................................................. 103

Single View Mode option............................. 458Site and User Options .................................. 447Skipped Dates

DATE and TIMESTAMP ........................ 246identifying............................................... 509specify handling ...................................... 348

Sort, using LOADPLUS to ........................... 363SORT command

Primary keys selection list ....................... 185Sort criteria.................................................... 76Source 2, Table type, Table Map.................. 268Source name, Table Map...................... 264, 336Source Types

Specify for Table Maps............................ 263Table Map Objects .................................. 265

SPC_REG, Column Map status .................... 236Special Registers

Colum Maps............................................ 242Column Map ........................................... 238Column Map functions ............................ 251Column Maps...................................236–238

Specify Relationship Usage Panel..........141–144Commands .............................................. 144CREATE RELATIONSHIP command...... 144

Specify Selection Criteria panel...................... 73Column name ............................................ 74

Page 542: Move for DB2 User Guide

Index

524 Move for DB2

Commands ................................................ 75Selection Criteria field............................... 74

Specifying Options....................................... 447User ........................................................ 448

SQLData type................................................... 78displaying................................................ 124Extract Process batch override ..........324–325Grant privileges....................................... 424Indicator, Select Tables/Views panel ......... 57Output, Create Process .....................426–427Review

Create Process ............................ 410, 415grant privileges ................................... 423Insert Process...................................... 353Synonyms, Create Process................... 426

valid syntax ............................................... 74WHERE Clause panel ......................... 79–82

Available commands............................. 81Correlation Name.................................. 80deleting clause ...................................... 81LIST COLUMNS.................................. 81SQLEDIT command.............................. 81Status identified.................................... 83

SQL command, Select Tables/Views panel..... 69SQL line command, Create Process .......408–415SQL WHERE Clause

Extract Process batch override ..........324–325Line commands ......................................... 81

SQLEDIT command....................................... 81SQLID

Choose a Definition Option panel ............ 177Choose an Access Definition...................... 46Migration Menu ...................................... 302

SQLID ........................................................... 26SRC line command, insert source column..... 246Stack

for join .................................................... 118Unjoining ................................................ 124

START command......................................... 114Start Table, Specification of ........................... 55Start Table Options

Group selection processing ...................... 140Point-and-Shoot....................................... 137

StatusColumn Map columns.......................235–237

Submit jobs with END, User option ............. 449SUBSTR function ...........................208–10, 250Substringing columns in relationships .... 208–10SUBSYS

Choose a Definition Option panel ............ 177Choose an Access Definition...................... 46Display option ......................................... 449Main Menu ............................................... 26Migration Menu ...................................... 303

Subsystem, Export/Import Processes............. 275SWITCH command ...................................... 120Synonym

Create Process ..................................424–426Type indicator ........................................... 59

SYSIBM.SYSINDEX................................... 188

TTable

Column Map source................................. 230column specifications indicator .................. 57definition................................................... 14displaying multiple .................................. 113Duplicate names...................................... 173Impact of data base changes..................... 170join availability option............................. 171Levels ....................................................... 14maximum display levels .......................... 114Naming conventions ........................... 17– 19Selecting ................................................... 55

error handling ....................................... 70Error handling....................................... 70

Selection listbrowse Control File ............................ 442browse Extract File ............................. 442Table Map ...................................337–338

Create Process................................ 406Tn identifier .............................................. 90Type indicator ........................................... 59

Table defaults, Create Process...............392–395Description .................................................. 260Table Map

Convert Process....................................... 429Copy........................................................ 261Create Process ......................................... 404DB2 LOAD process................................. 364DB2 LOAD Process................................. 364Defining .................................................. 264Grant Privileges....................................... 421Insert Process .......................................... 336

option ................................................. 335Rename ................................................... 262Sample session .......................................... 39Sample Session ......................................... 41Source 1 Table Name Field...................... 265

Table Maps.................................................. 256APPLY command .............................267–268Choose a Table Map panel....................... 256Column Map ID Field.............................. 264Column Map Name ................................. 265Column Maps.......................................... 274Column Maps, including.......................... 269Create Process ......................................... 407Defining ...........................................256–265Deleting .................................................. 262description............................................... 266Description.............................................. 260Display Information................................. 260Export Process................................... 276–83

output file format .........................290–292Import Process................................... 283–86LIST MAPS............................................. 269LIST TABLES......................................... 266

Page 543: Move for DB2 User Guide

Index

User Manual 525

LIST UNUSED example.......................... 266MAP ID................................................... 257MAP NAME ........................................... 257MAPS command...................................... 273Name, explicit values .............................. 258Naming conventions .................................. 17Object Type............................................. 265Object Types ........................................... 265Overview............................................. 11–16POPULATE Command.....................271–272Saving ..................................................... 268SELECT Primary Command .................... 262Selection List .......................................... 259Source 2 Table Name Field...................... 265Specify Source Types............................... 263Src 1 CID ................................................ 264Src 2 CID ................................................ 264Validation rules............................... 257, 258

Tablescreating relationships........................200–201Name specification .................................... 58Selecting for Access Definition.................. 54Selection List, for joining ........................ 111

Tables Map, UNKNOWN ............................ 265TABLES, Extract Process Option

see also Select Tables/Views ................... 305Tablespace defaults, Create Process ......395–399Tablespace defaults, Create Process ............. 392Temporary Table, TEMPTABLE.................... 58TEMPTABLE, Access Definition status ......... 58Terminating, Point-and-Shoot....................... 135Terminology................................................... 14TIMESTAMP, Aging DB2 column............... 246Tn, table identifier ......................................... 90Top, scroll direction ....................................... 95Tutorial.......................................................... 20

Help key.................................................... 20

UUNJOIN command

Multi-way join..................................123–124Unjoining tables........................................... 117UNKNOWN

batch overrideExtract Process ................................... 325Insert Process...................................... 359

Column Map status.................................. 236Extract Process Warnings ........................ 320Relationship status ...........................142–149Table Map Table type.............................. 265Table Map, Type value ............................ 337

UNKNWN, Relationship status .................... 149UNLOAD PLUS .......................................... 328UNLOAD PLUS utility

Extract Process .................................313–315UNLOCK Command...................................... 97

Sidelabels format..................................... 104UNSEL, Relationship status ......................... 142

UNSELECT command, Export Process ........ 280UNSELECT RELATED command ................. 94Unselect Related line commands .................... 94Unzoom

Describe Columns/Specify Selection Criteria............................................................. 78

Up, scroll direction......................................... 95Update Process

Insert vs Update................................339–340overview.................................................. 340Parameters .............................................. 341

USE command ............................................. 148USER

Access Definition name ............................. 14Access Definition specification .................. 47Profiled ..................................................... 48

VVALIDATION command.............................. 238Validation rules

Column Maps.......................................... 225Table Maps ............................................. 257

ViewCreator ID defaults, Create Process...403–404Name specification .................................... 58Single Mode option ................................. 458Type indicator ........................................... 59

View identifier (Vn)....................................... 90VIEWERR ..................................................... 57Vn, view identifier ......................................... 90

WWarnings, Extract Process.....................320–321

YYEAR, Insert Process batch override ............ 355

ZZoom

Describe Columns/Specify Selection Criteria............................................................. 79

joined tables .................................... 115, 116ZOOM command

Describe Columns ..................................... 79Joined tables............................................ 115

Specify Selection Criteria panel...................... 79

Page 544: Move for DB2 User Guide

Index

526 Move for DB2