Move For Db2 User Guide

  • June 2020
  • PDF

This document was uploaded by user and they confirmed that they have the permission to share it. If you are author or own the copyright of this book, please report to us by using this DMCA report form. Report DMCA


Overview

Download & View Move For Db2 User Guide as PDF for free.

More details

  • Words: 150,494
  • Pages: 544
Princeton Softech’s

Move for DB2 User Manual

Move for DB2 User Manual The software described in this manual and this manual are furnished under a license agreement or nondisclosure agreement. The software and the documentation may be used only in accordance with the terms of that agreement. No part of this manual may be reproduced or transmitted in any form or by any means, electronic or mechanical, including photocopying and recording, for any purpose without the express 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 Business Machines, Inc. (IBM). LOADPLUS and UNLOAD PLUS are products of BMC Software, Inc. IEF is a product of Sterling Software.

User Manual

ii

Table of Contents

About this Manual................................................................ 1 Documentation ........................................................................... 3 Summary of Amendments  Release 4.1 ................................... 4

1. Introduction ..................................................................... 7 1.1 Processing Flow .................................................................. 8 Extract Process ............................................................................8 Insert Process ..............................................................................9

1.2 General Information........................................................... 12 1.2.1 Terminology ....................................................................12 1.2.2 Naming Conventions .......................................................15 1.2.3 Basic Screen Format and Handling ..................................17

2. Session Overview ........................................................... 21 2.1 Main Menu ....................................................................... 22 2.2 Specify the Source Data .................................................... 25 Specify Tables ...........................................................................26 Specify Criteria..........................................................................28 Specify Object Definitions .........................................................31 Perform the Extract ...................................................................33

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

3. Specify Access Definitions ............................................. 41 3.1 Choose an Access Definition.............................................. 42 3.1.1 Access Definition Selection List.......................................44

3.2 Components of an Access Definition.................................. 49 3.3 Table/View Selection......................................................... 50 3.3.1 Specifying Table Names...................................................57 3.3.1.1 Using a Selection List..........................................57 3.3.1.2 Automatically Inserting Table Names..................59

User Manual

iii

Table of Contents 3.3.1.3 Supporting Facilities ...........................................60 3.3.2 Handling the Table List ...................................................63 3.3.3 Access Definition Specific Commands .............................64 3.3.4 Completed Table Selection...............................................65

3.4 Specifying Criteria ............................................................ 67 3.4.1 3.4.2 3.4.3 3.4.4 3.4.5

Selection Criteria .............................................................68 Other Column Specifications ...........................................71 Zooming Column Information .........................................74 SQL WHERE Clause Specification ..................................75 Table Status Indicated......................................................78

3.5 Using the Point-and-Shoot Facility..................................... 80 3.5.1 Initial Display for Point-and-Shoot ..................................83 3.5.2 Point-and-Shoot Basics ....................................................84 3.5.2.1 Screen Elements..................................................85 3.5.2.2 Displaying Column Attributes .............................88 3.5.2.3 Available Commands ..........................................89 3.5.3 Selecting Rows ................................................................90 3.5.4 Scrolling Data..................................................................91 3.5.4.1 Vertical Scrolling ................................................91 3.5.4.2 Horizontal Scrolling ............................................91 3.5.4.3 Locking Columns for Horizontal Scrolling ..........91 3.5.5 Excluding Rows...............................................................93 3.5.6 Finding Specific Data ......................................................94 3.5.7 Expanding Truncated Data ..............................................95 3.5.8 Displaying Hexadecimal Data ..........................................98 3.5.9 Using Sidelabels Format ..................................................99 3.5.9.1 Scrolling .............................................................99 3.5.9.2 Displaying Wide Data ....................................... 100 3.5.9.3 Considerations When Using Sidelabels.............. 102 3.5.10 Joining Tables.............................................................. 104 3.5.10.1 One Related Table ........................................... 104 3.5.10.2 Several Related Tables..................................... 107 3.5.10.3 No Related Tables ........................................... 108 3.5.10.4 More than One Relationship............................ 108 3.5.11 Handling Multiple Tables ............................................ 109 3.5.11.1 Multiple Table Display .................................... 109 3.5.11.2 Coordinated Scroll........................................... 110 3.5.11.3 Zooming a Joined Table Display...................... 111 3.5.11.4 Unjoining Tables ............................................. 113 3.5.12 Special Considerations for Multi-way Joining .............. 113 3.5.12.1 Using Join ....................................................... 114 3.5.12.2 Scrolling.......................................................... 116 3.5.12.3 Displaying Traversal Paths .............................. 117 3.5.12.4 Unjoining ........................................................ 119 3.5.13 Displaying SQL ........................................................... 120 3.5.14 Reporting..................................................................... 124 3.5.15 Terminating a Session.................................................. 131 3.5.16 Row List Status Indicated............................................. 133

3.6 Group Selection Processing ..............................................134 3.7 Selecting Relationships .....................................................137 3.7.1 Displaying Information.................................................. 141

iv

Move for DB2

Table of Contents 3.7.2 Relationship Status ........................................................ 142 3.7.3 Displaying Traversal Information .................................. 146 3.7.4 Generating a Relationship Usage Report ........................ 148

3.8 Using Relationships..........................................................149 3.8.1 Sample Scenarios........................................................... 149 3.8.2 Traversal Cycles ............................................................ 155 3.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 ...................................................................175 4.1.1 4.1.2 4.1.3 4.1.4

Specifying a Primary Key............................................... 176 Selection List of Primary Keys ....................................... 178 Modifying a Primary Key............................................... 182 Defining Generic Primary Keys ..................................... 184

4.2 Relationships....................................................................188 4.2.1 4.2.2 4.2.3 4.2.4 4.2.5 4.2.6 4.2.7

Specifying a Relationship............................................... 189 Selection List of Relationships ....................................... 192 Creating a Relationship.................................................. 196 Editing Relationships..................................................... 197 Saving and Using the Relationship................................. 210 Modeling Relationships ................................................. 211 Generic Relationships .................................................... 212

4.3 Column Maps...................................................................218 4.3.1 4.3.2 4.3.3 4.3.4 4.3.5 4.3.6 4.3.7 4.3.8

Choosing a Column Map ............................................... 220 Selection List of Column Maps ...................................... 222 Specifying Column Map Tables ..................................... 226 Defining Column Maps.................................................. 229 Validation...................................................................... 233 Managing the Column Display ...................................... 235 Specifying Source for Destination Columns ................... 237 Completed Column Map ................................................ 251

4.4 Table Maps ......................................................................252 4.4.1 4.4.2 4.4.3 4.4.4 4.4.5

Choosing a Table Map ................................................... 252 Selection List of Table Maps.......................................... 255 Specifying Table Map Sources ....................................... 259 Defining Table Maps ..................................................... 260 Including Column Maps ................................................ 265

4.5 Export and Import Processes ............................................271 4.5.1 Using the Export Process ............................................... 272 4.5.2 Using the Import Process ............................................... 279 Import Summary............................................................ 281 4.5.3 File Format .................................................................... 282 Primary Keys ................................................................. 283

User Manual

v

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

5. Data Migration .............................................................295 5.1 Migration Menu ...............................................................296 5.2 Extract Data.....................................................................300 5.2.1 Extract Process Menu .................................................... 301 5.2.2 Select the Object Definitions .......................................... 303 5.2.3 Perform the Extract Process ........................................... 306 5.2.3.1 UNLOAD PLUS................................................ 309 5.2.3.2 Perform Convert with Extract............................. 312 5.2.4 Extract Processing ......................................................... 314 5.2.4.1 Batch Execution ................................................ 317 5.2.4.2 UNLOAD PLUS................................................ 324 5.2.4.3 Online Execution Status .................................... 325 5.2.5 Extract Process Report ................................................... 326

5.3 Control File Overview ......................................................328 5.4 Insert Process ...................................................................330 5.4.1 INSERT Process Menu ................................................... 330 5.4.2 INSERT Process Table Map............................................ 332 5.4.3 Perform Insert and Update/Insert Process........................ 335 5.4.4 Insert Process Report ...................................................... 357

5.5 DB2 Load Process............................................................359 5.5.1 DB2 Load Utility Parameters ......................................... 362 5.5.2 LOADPLUS Utility Parameters...................................... 368 5.5.3 Job Processing ............................................................... 373

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

5.7 Create Process..................................................................386 5.7.1 5.7.2 5.7.3 5.7.4

CREATE Process Menu................................................. 386 CREATE Process Defaults............................................. 387 CREATE Process Table Map ......................................... 400 Perform Create Process .................................................. 403 5.7.4.1 Create Database................................................. 412 5.7.4.2 Create Tablespace.............................................. 414 5.7.5 Grant Privileges............................................................. 417 5.7.6 SYNONYMS................................................................. 420 5.7.7 OUTPUT SQL ............................................................... 422

5.8 Convert Process................................................................424 5.8.1 Convert Extract File Panel ............................................. 424 5.8.2 Perform Convert Process................................................ 427 5.8.3 CONVERT Process Report ............................................ 429

5.9 Retry/Restart Process .......................................................432 5.10 Browse Extract File ........................................................436

vi

Move for DB2

Table of Contents

6. Specify Options .............................................................443 6.1 User Options ....................................................................444 Change Line Characters .......................................................... 448 Specify 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......................................461 DIRECTORY Statement.......................................................... 461

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

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

7.4 General Batch Control Statements.....................................479 PAGESIZE Statement ............................................................. 479 ERROR Statement................................................................... 479 OUTDD 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

User Manual

vii

Table of Contents

viii

Move for DB2

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

User Manual

ix

Table of Figures Figure 37. Figure 38. Figure 39. Figure 40. Figure 41. Figure 42. Figure 43. Figure 44. Figure 45. Figure 46. Figure 47. Figure 48. Figure 49. Figure 50. Figure 51. Figure 52. Figure 53. Figure 54. Figure 55. Figure 56. Figure 57. Figure 58. Figure 59. Figure 60. Figure 61. Figure 62. Figure 63. Figure 64. Figure 65. Figure 66. Figure 67. Figure 68. Figure 69. Figure 70. Figure 71. Figure 72. Figure 73. Figure 74. Figure 75. Figure 76. Figure 77. Figure 78. Figure 79. Figure 80. Figure 81. Figure 82. Figure 83. Figure 84. Figure 85.

x

Columnar Screen Elements .......................................... 85 Sidelabels Screen Elements .......................................... 85 Column Attributes Displayed ....................................... 88 Selecting Primary Key Values...................................... 90 Unselecting Primary Key Values.................................. 90 Repositioned Locked Column....................................... 92 Excluding Rows .......................................................... 93 Excluded Rows Message.............................................. 94 Expanding When Length Exceeds Display Width ......... 96 Expanded Column Display........................................... 97 Hexadecimal Values Displayed .................................... 98 Sidelabels Display ....................................................... 99 Locked SHIP_UPDATED Column .............................100 Column Wrapping ......................................................101 Using EXPAND in Sidelabels Format .........................102 Attributes in Sidelabels Format ...................................103 Using JOIN Command................................................105 Result of Joining.........................................................106 Table Selection List Prompt........................................107 Relationship Selection List Prompt..............................108 Sample Multiple Table Display...................................109 Zoom Multi-Table Display .........................................112 Result of Zooming Display .........................................112 Sample Multiple Table Display...................................116 Indented Table Display ...............................................118 Text Display of Generated SQL ..................................121 Output Data Options Panel .........................................122 Specify Report Options...............................................124 Report Format Parameters ..........................................127 Point-and-Shoot Confirmation Prompt ........................131 Confirm Temporary Point-and-Shoot Values...............131 Reconfirm Temporary Point-and-Shoot Values............132 Confirm Drop Start Table Options..............................132 Row List Indicated......................................................133 Start Table Group Selection Processing.......................134 Group Processing Indicated.........................................136 Specify Relationship Usage Panel ...............................137 Relationship Information.............................................141 Selecting Relationships for MOVE Functions..............142 Status Revised ............................................................143 Specify Relationship Usage Panel Redisplayed............144 Unknown Relationship................................................145 Default Specifications for Q1 and Q2..........................150 Both Q1 and Q2 Set to Yes.........................................151 Set Q2 to Yes for One Relationship.............................152 Set Q1 and Q2 for Multiple Children ..........................154 Set Q1 and Q2 for Multiple Relationships ...................156 Set Q1 and Q2 to NO .................................................159 Set Q1 to Extract Parent .............................................160

Move for DB2

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

User Manual

xi

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

xii

Move for DB2

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

User Manual

xiii

Table of Figures

xiv

Move for DB2

About this Manual This manual details how to use Move for DB2 to extract relational sets 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 using Move for DB2 including basic screen handling and terminology.

2. Session Overview

Session overview providing a short demonstration of how to extract and insert data. We recommend that you read the demonstration for an overview of the basic processing flow using Move for DB2.

3. Access Definitions

Explanation of defining and modifying the set of specifications called an Access Definition. The Access Definition is used to select the data used to create an Extract File.

4. Definitions

Description of defining and modifying primary keys, relationships, Column Maps, and Table Maps. Information is also provided about exporting and importing these definitions.

5. Migration

Description of the basic steps required to copy data, create an Extract File and then perform insert and delete processes. Other pertinent facilities are discussed including: creating DB2 objects, transforming the Extract File data for use with the DB2

User Manual

1

About this Manual Load or relational databases on other platforms, retrying and restarting an insert or delete process, and browsing Extract Files. 6. Options

Explanation of the user options. A discussion of the job card and print options is also included.

A. Main Menu

The Main Menu panel that is displayed when only Move for DB2 is installed.

B. Allocating External Files

Details about the services Move for DB2 provides to allocate external files.

C. Exit Routines for Column Maps

Details about using exit routines when defining Column Maps.

D. Creating a Row List File

Information about how to create a Row List file for values that do not reside in DB2. This file contains the primary key values used as the starting point for an Extract Process.

E. Print Extract File

Information about how to print the contents of the Extract File or Control File.

F. Compatibility Rules for Relationships

Details about the column compatibility rules when defining relationships to the Princeton Softech Directory.

G. Skipped Columns

Information about how Move for DB2 handles values that are not valid dates when aging.

H. Date Formats

Information about specifying formats for values that are to be aged.

I. Migrate Object Definitions in Batch

Information about migrating the PST object definitions in batch.

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

2

Move for DB2

Documentation)

Documentation The following is a list of Relational Tools documentation.

User Manual

Access for DB2 Introduction

Overview of Access for DB2 and basic information on accessing and editing a related set of data, creating Access Definitions, and processing embedded SQL.

Access for DB2 User Manual

Detailed information on accessing and editing a related set of data, and creating and maintaining Access Definitions, primary keys and relationships in the Princeton Softech Directory.

Move for DB2 Introduction

Overview of Move for DB2 and information on migrating a related set of data.

Move for DB2 User Manual

Detailed information on using the Move for DB2 facilities for extracting and loading a related set of DB2 data.

Compare for DB2 Introduction

Overview of Compare for DB2 and information on comparing two sets of related data.

Compare for DB2 User Manual

Detailed information on using the Compare for DB2 facilities to compare two sets of related data.

Archive for DB2 User Manual

Detailed information on using the Archive for DB2 facilities to archive and restore related data.

Relational Tools Command Reference Manual

Detailed information about all of the Relational Tools commands.

Relational Tools Installation and Administration Guide

Instructions for installing and maintaining the Relational Tools.

3

About this Manual

Summary of Amendments  Release 4.1 This manual includes the following enhancements for release 4.1 of MOVE:

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 and will provide the following enhancements: •

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



The CREATE DATABASE facility supports the specification of index buffer pools.



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



ADB2EXPL now supports the new DB2 EXPLAIN output which includes the new STATEMENT and FUNCTION tables.



The Relational Tools have been updated to ensure no discontinued DB2 keywords will be generated. This includes the removal of all references to DSETPASS, removal of SUBPAGE and TYPE 1 specification for indexes and the use of RO for the creation of databases.

Creating PST Objects The CREATE object facility has been enhanced with the following functions:

4



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



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

Move for DB2

Summary of Amendments ( Release 4.1)

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 in either ascending or descending order. For example, the list of tables may be sorted in ascending sequence, based on their “status”.



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

Batch Utility for PST Directory Maintenance A new batch utility has been added to help maintain the PST Directory. This new utility includes the following functions: •

Ability to produce a summary report for one or more PST objects. User specified criteria may be provided to determine the contents of the report.



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



The COPY, RENAME and DELETE commands for PST objects are 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 with BMC’s Unload Plus:

User Manual



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



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

5

About this Manual

Miscellaneous Changes The following general enhancements have also been added: •

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



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



A new globally available primary command, REFRESH DIRECTORY that can flush and subsequently refresh the Relational Tools internal cache buffer.



Two new line commands, COPY and RENAME are available for all PST objects. These line commands are available on the selection list for each object type.



Information listing the available line commands for PST object selection lists has been added to the top of the selection list panel display.

Minor editorial and technical changes have been made throughout this manual.

6

Move for DB2

1. Introduction MOVE is a relational copy facility used to copy or move relationally intact sets of data from multiple source tables to corresponding destination tables. MOVE handles any number of tables and any number of relationships regardless of the complexity. MOVE is indispensable for: •

Creating test databases that are relationally intact subsets of an existing production database.



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



Migrating subsets of data that require data transformations as part of the migration.

Programmers and DBAs are no longer required to spend countless hours writing programs to accomplish these tasks. Instead, MOVE provides an interactive utility to prompt for the necessary information and perform the task. MOVE runs as a TSO/ISPF application and incorporates familiar ISPF commands. The Help and Tutorial facility in ISPF are also supported. Menu-driven prompt screens or panels are used to specify which data to obtain and which process to perform. Intelligent screen handling technology provides simultaneous display of multiple tables, pop-up windows, cursor-sensitive online help, and tutorials.

User Manual

7

1. Introduction

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

Extract Process An Extract is the process of copying data from a set of one or more related tables to an “Extract File”. An Extract File is a sequential file that contains the extracted data and information about that data. The information defines the characteristics of the data, and optionally includes the object definitions for that data. (Object definitions are the definitions for tables, keys, indexes, and so forth.) Once stored, an Extract File can be used repeatedly to create new or refresh existing databases. To perform an Extract Process specify: •

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



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



For the data, you can qualify which rows are to be extracted by specifying: Selection criteria for any of the tables, A random selection factor and maximum row limit, and Specific rows in the Start Table.



For the object definitions, table and column definitions are always extracted. You can select which of the following subordinate definitions are to be extracted: Primary Keys and Relationships Indexes Views Aliases Synonyms Column Field Procedure Names

8

Move for DB2

1.1 Processing Flow Access Definition

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 or Compare for DB2 can be used by MOVE. You can also define a temporary Access Definition to be used for a single Extract Process. If BMC's UNLOAD PLUS is available, you can specify whether it is to be used to extract the data.

Insert Process Once an Extract File is created, the data contained in the file can be inserted into the destination tables. These tables may or may not reside in the same DB2 subsystem. Table Maps

Table Maps are used to match source tables to destination tables. Using Table Maps, individual tables can be excluded and unlike named tables can be mapped. You can use an existing Table Map (APPLY command), or define the Table Map along with the other specifications for the process. When the columns in the destination table match the columns in the source table, MOVE automatically inserts the data. When the columns do not match, Column Maps can be used.

Column Maps

Column Maps are used to match source columns to destination columns that have different column names. These maps also enable users to specify defaults, literals, constants, expressions, and exit routines to populate destination columns. Although MOVE automatically handles many transformations, exit routines can be used for more complex processing.

Create Object Definitions

If the destination tables do not exist, MOVE generates the appropriate SQL DDL statements to create the tables either as part of the Insert or as a separate step. The created tables can be identical to the source tables with the destination columns taking on the attributes of the corresponding source columns or the table definitions can be modified. In addition to tables, other object definitions such as primary keys, relationships, indexes, and so forth that have been extracted with the data, can be created by request.

User Manual

9

1. Introduction Insert Processing

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

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



With Update/Insert processing, the row to be inserted replaces or updates the existing row.

MOVE also handles tables that do not have primary keys. Other Processes

10

Several other processes or facilities are provided in addition to Extract and Insert. These include: DB2 LOAD

The Extract File can be transformed to DB2 Load format to take advantage of the IBM DB2 Load Utility to insert large volumes of data. (This option can be modified to use BMC’s LOADPLUS.)

Delete Process

Once an Extract File is created, the extracted data can be deleted from the source tables.

Create Process

The object definitions in the Extract File can be used, without inserting source data, to create tables, primary keys and relationships, indexes, views, aliases, and synonyms.

Convert Process

The data in the Extract File can be transformed based on the Table Map and Column Maps and saved as modified. This is useful to mask source data and create consistent, refreshable test data.

Retry

Retry can be executed when an Insert or Delete process could not be performed for one or more rows in the Extract File. When a process cannot be performed for a specific row, that row is marked as discarded. The Retry Process will attempt the previous operation for just the rows that were discarded.

Move for DB2

1.1 Processing Flow Restart

Restart can be executed when a process does not complete successfully. A process can terminate unexpectedly due to resource restrictions, such as space allocation or time limitations. Using Restart, the process is restarted from the last commit point. MOVE keeps track of the last successfully committed row in the Extract File, and restarts the process with the next row in the file.

Browse

User Manual

The Extract File can be browsed. This is useful for reviewing the error status of individual rows or for determining what data is in an Extract File.

11

1. Introduction

1.2 General Information This section discusses general information about MOVE. This includes the terminology used to describe MOVE and basic system concepts.

1.2.1 Terminology The following paragraphs describe some common terms and how they relate to using MOVE. Tables

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

Access Definitions

MOVE enables you to define and store a description of the set of data to be extracted. This description is referred to as an Access Definition. The same Access Definitions can be used by Access for DB2 to browse and edit data in DB2 tables, by Compare for DB2 to select data from DB2 tables for the Compare Process, 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 the Extract Process.



Optionally, sort and selection criteria.



Various other criteria discussed in later sections of this manual.

An Access Definition can be used repeatedly to extract the same set of data. An Access Definition can be saved for future use. A saved definition can be modified and saved under the same name or a new name. The first table from which the data is extracted is the Start Table. All other tables are accessed in logical sequence based on table relationships and specifications in the Access Definition. The name of an Access Definition is composed of three parts: GROUP.USER.NAME

12

Move for DB2

1.2 General Information The group and user portions are useful when organizing projects by assigning a different group name to each project and, within the projects, a different user value for each person working in the group. Extract File

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

Referential Integrity Rules

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

Directory

The PST Directory contains information necessary for accessing DB2 data. This information includes user-specified: Access Definitions Primary Key Definitions Relationship Definitions Column Maps Table Maps Access Definitions, Column Maps, and Table Maps are unique to Relational Tools, but primary key definitions and relationships are usually available in the DB2 Catalog. MOVE takes advantage of the DB2 Catalog for that information whenever possible. However, when the information is not available in the DB2 Catalog, you can use MOVE facilities to specify the information and store it in the PST Directory.

Primary Key Definition

The primary key definition contains the name of the column or columns that uniquely identifies each row. For example, assume a CUSTOMERS table has a column CUST_ID that contains a unique value for each row in the table. The column CUST_ID would be an acceptable primary key for the CUSTOMERS table. MOVE requires primary keys when:

User Manual



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



Updating a table. The primary key provides the ability to identify whether a row exists.

13

1. Introduction Relationship Definition

The relationship definition is the information that specifies how two tables are related. For the DB2 Catalog, the relationship is defined by a primary key/foreign key pairing. The foreign key is the set of columns in a child table that describe the correspondence with the primary key columns in the parent table. For example, assume an ORDERS table contains a column CUST_ID that can be related to the primary key column CUST_ID in the CUSTOMERS table. The column in the ORDERS table is the foreign key. Although relationships based on the primary key/foreign key pairing can be defined in the PST Directory, users can specify relationships based on any set of compatible columns between two tables. A primary key is not required in either of the tables. In addition, relationships in the PST Directory can be defined using substring and concatenation functions for columns as well as literal and constant values. Whenever a list of relationship definitions is presented, the source is indicated. Relationships from the DB2 Catalog are identified as DB2 relationships, relationships from the PST Directory are PST relationships. Only PST relationships can be created and modified using the relationship definition function provided by MOVE. (DB2 relationships can be created using the Create Process.) However, DB2 relationships can be used as the ‘model’ for new PST relationships. The PST relationships are defined by and available to all Relational Tools interchangeably.

Table Map Definition

The Table Map definition or Table Map is a set of specifications used by MOVE to match the sets of source tables to destination tables. 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. They can be used interchangeably.

14

Move for DB2

1.2 General Information Column Map Definition

The Column Map definition or Column Map is a set of specifications used by MOVE to determine which source data is used to populate each destination column when the Insert Process, Load Process, 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. The Column Maps created using Compare for DB2 can always be used by MOVE. However, the converse is not always possible. MOVE provides additional facilities not available in Compare for DB2.

Object Definitions

This document refers to the parameters required by DB2 to create objects as object definitions. MOVE can be used to migrate these objects from one subsystem to another by extracting the object definitions from the source and creating the objects based on these definitions at the destination. The following objects can be migrated: Tables Views

Indexes Primary Keys Relationships

Aliases Synonyms Column Field Procedure Names

1.2.2 Naming Conventions Naming conventions for the following must conform to DB2 standards: Tables Views Columns Indexes Primary Keys Aliases Relationships Synonyms Authorization ID (also referred to as Creator ID) The following objects are unique to MOVE and must be composed of characters that are valid in SQL identifiers. These object names and the maximum length of each are: Group ID User ID Map ID Access Definition base name Column Map base name Table Map base name

User Manual

8 8 8 12 12 12

15

1. Introduction Delimited Identifiers

A DB2 delimited identifier is a sequence of one or more characters enclosed within SQL escape characters or delimiters. MOVE supports DB2 delimited identifiers for any DB2 objects. Delimited identifiers are not supported for the names of Access Definitions, Table Maps, and Column Maps. Delimited identifiers can be supplied as the operands of primary commands but quotation marks must be used as the delimiters. Since a delimited identifier can exceed the space allocated on the panels for certain output fields, MOVE will truncate any name whose length exceeds the field length on the panel. The field is protected and cannot be edited. Line commands can be used to delete the entry. When line commands are not available (for example, specifying the Start Table or the default Creator ID), the field is large enough to support the maximum width and may be edited. To conserve space, the delimiters are not included with the delimited identifier when the name is provided in the heading of a panel. Delimiters are also omitted when the delimited names are presented in selection lists.

Using DB2 LIKE Syntax

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

File Names

Represents any number of characters Represents any single character

MOVE uses external files to store information necessary for MOVE processes and to provide documentation about those processes. For these files, you can specify unqualified names, without quotes, and the default prefix specified on the User Options panel is automatically added 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 be named: PSTDEMO.SAMPLE.CONTROL.FILE If you want to specify the name explicitly, enclose it in single quotes as in: 'SAMPLE.CONTROL.FILE'

16

Move for DB2

1.2 General Information An asterisk, specified alone or as the last character in the data set name, is used to obtain a selection list. For example, to obtain a selection list of names that begin with PSTDEMO.SAMP, specify: 'PSTDEMO.SAMP* (For more information about specifying a default data set prefix, see Section 6. Specify Options)

1.2.3 Basic Screen Format and Handling This manual describes the process necessary to create an Access Definition, to extract data from a DB2 database, insert the extracted data at a specified destination, and maintain supplemental information stored in the Directory. In so doing, all of the basic screens used to perform these functions will be discussed in a logical order. The size of the screen in the examples varies. During an actual session, the number of lines depends on the type of terminal being used. MOVE emulates ISPF commands and screen format and handling. Common Panel

For the most part, the figures in this manual present the panels as they appear when all Relational Tools are available. Those facilities that are available with MOVE are documented in this manual. Those facilities available exclusively with Access for DB2 are noted in this manual and documented in the Access for DB2 User Manual. Those facilities available exclusively with Compare for DB2 are noted in this manual and documented in the Compare for DB2 User Manual. Those facilities available exclusively with Archive for DB2 are noted in this manual and documented in the Archive for DB2 User Manual.

Pop-up Windows

MOVE incorporates a unique pop-up window facility independent of the current ISPF release. The pop-up windows supply prompts to facilitate 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, a pop-up window containing a list of available tables can be displayed. The tables can be selected directly from this list. When the pop-up window is removed, the selected tables are automatically included in the Access Definition and the definition process continues. The characters used to draw the box around the pop-up window are site-defined. User options are provided to change these characters. Throughout this manual, pop-up windows are delimited by easy-toread dashes and vertical bars.

User Manual

17

1. Introduction Function Keys

The function keys are handled as in ISPF. The keys provide a simple way to execute primary commands. When a function key is pressed, it is evaluated as if the command assigned to the key was typed in the primary command area of the screen. (See the Relational Tools Command Reference Manual for information on assigning values to function keys.) The ISPF command PFSHOW is available to specify whether the function key assignments are displayed on the screen. The ISPF command KEYS is available to display the list of the function key assignments. This list is modifiable. Changes to the PF key assignments during a Relational Tools session only affect the assignments while using Relational Tools. They do not affect the assignments when using other ISPF applications.

Functions Frequently Assigned to Keys

Several functions are frequently assigned to function keys. The following are of note: HELP

Displays information. When an error condition is present, a one-line message is displayed the first time the HELP key is pressed. If the HELP key is pressed a second time, a full-screen display addresses the details of the error and how to correct it. When an error condition is not present, the HELP key displays a full-screen help panel. This information explains the purpose and use of the current panel. It also lists the commands available on the current panel. HELP is usually assigned to PF1.

END

18

Signals that input is to be processed and the current panel is to be terminated. The display returns to the previously displayed panel. END is usually assigned to PF3.

Move for DB2

1.2 General Information Scrolling

All ISPF scrolling functions are supported. Vertical and horizontal scrolling is coordinated with the scroll value specified in the SCROLL field. This value can be specified as: Cursor location determines the scroll amount.

User Manual

PAGE

Full page scroll such that the line or column following the last line or column of the current page is the first line or column of the next page.

DATA

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

HALF

Half page scroll.

n

Specific number of rows or columns to scroll.

MAX

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

19

1. Introduction

20

Move for DB2

2. Session Overview The following overview highlights the key facilities provided with MOVE by presenting a brief sample session. For this sample session, assume you want to create a test database by copying data from one set of related tables to another. This task is comprised of two basic steps: •

Specify the Source Data



Specify the Destination

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

User Manual

21

2. Session Overview

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

------------------ Princeton Softech's Relational Tools -----------------OPTION ===> 0 1 2 3 4 5 6 7 8 9

OPTIONS BROWSE TABLE EDIT TABLE BROWSE USING AD EDIT USING AD ADS DEFINITIONS MIGRATION COMPARE ARCHIVE

-

Site and User Options SQLID ===> Browse a DB2 Table SUBSYS ===> TDB2 Edit a DB2 Table LOCATION ===> Browse DB2 Tables Using Access Definition Edit DB2 Tables Using Access Definition Create or Modify Access Definitions Maintain Primary Keys, Relationships, Maps and ADs Data Migration - Extract, Insert, Delete, ... Compare Two Sets of Data Archive and Restore Data

T C X

TUTORIAL CHANGES EXIT

- Information About Princeton Softech's Tools - Changes from Prior Release(s) - Terminate Product Use

Figure 1. Main Menu Panel Options

To select the desired option, type the one-character identifier corresponding 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 session options, editor options and JOB card and job related information.

1

BROWSE TABLE To browse data from a DB2 table. This facility is documented in the Access for DB2 User Manual.

2

EDIT TABLE To edit data from a DB2 table. This facility is documented in the Access for DB2 User Manual.

3

BROWSE USING AD To browse data from DB2 using an Access Definition. This facility is documented in the Access for DB2 User Manual.

22

Move for DB2

2.1 Main Menu 4

EDIT USING AD To edit data from DB2 using an Access Definition. This facility is documented in the Access for DB2 User Manual.

5

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

6

DEFINITIONS To define and maintain primary keys and relationships that are used when the information is not available in the DB2 Catalog, to define Table Maps and Column Maps used during the INSERT, DB2 LOAD and CONVERT processes, to define Access Definitions and to invoke the 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. This facility is documented in the Compare for DB2 User Manual.

9

ARCHIVE To perform the ARCHIVE processes of Archive and Restore. This facility 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.

User Manual

23

2. Session Overview Panel fields

24

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

The DB2 SQLID used to connect to DB2. On initial entry to MOVE this field is blank since you have not connected to DB2. You can enter a value and MOVE will attempt to use that value when connecting to DB2. The DB2 SQLID is displayed in this field when this panel is redisplayed. You can then change the displayed value and MOVE will attempt to reconnect using the value you entered. The default is the current user's TSO USERID. During the session, you can change the SQLID on any of the menus.

SUBSYS

The DB2 subsystem name. This field is required. In Figure 1. Main Menu, TDB2 is specified. A user option is available to display this value on all of the Relational Tools panels; however, the value for SUBSYS can be modified only on the menus.

LOCATION

The remote access location. This field is displayed only when remote access is available. See site management for the available locations.

Move for DB2

2.2 Specify the Source Data

2.2 Specify the Source Data With MOVE, you use an Access Definition to specify the source data to be extracted. To do this, you can: •

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



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

A full discussion about how to define an Access Definition is provided in Section 3. Specify Access Definitions. Select Migration Option

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

----------------------------- Data Migration -----------------------------OPTION ===> SQLID ===> PSTDEMO SUBSYS ===> TDB2 1 EXTRACT - Extract Data from DB2 (Source) LOCATION ===> 2 INSERT - Insert Data into DB2 (Destination) 3 DB2 LOAD - Create DB2 Load Files and Load 4 DELETE - Delete Data from DB2 Tables 5 CREATE - Create Tables and Related Object Definitions 6 CONVERT - Convert an Extract File Using Table and Column Maps R B

RETRY/RESTART BROWSE

- Retry/Restart an Insert or Delete Process - Browse Content of Extract or Control File

Figure 2. Data Migration Menu

User Manual

25

2. Session Overview Select Option 1 EXTRACT. This is the option used to define the source data and actually extract it from the database. The EXTRACT Process menu is displayed.

------------------------- EXTRACT Process -----------------------------OPTION ===> 1 2 3 4

TABLES PATHS OBJECTS PERFORM

-

Specify Specify Specify Specify

Set of Tables and Selection Criteria Traversal Paths via Relationship List Object Definitions to Extract 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 is specified in response to the Type of Access Definition to Use for Extract prompt. An existing Access Definition is not used and a new Access Definition is not created. If you specify P, you must provide the 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 from which data is to be extracted. Select Option 1 TABLES on the EXTRACT Process menu. The Select Tables/Views for AD panel is displayed. You can directly type the names of the tables as shown in Figure 4. The name of a single table, CUSTOMERS, has been entered. CUSTOMERS is also specified as the Start Table or the table from which data is to be extracted first. GET TABLES RELATED Command

26

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

Move for DB2

2.2 Specify the Source Data For example, in the following figure the GET TABLES RELATED command is entered. The ALL operand is used to insert all tables directly related to the CUSTOMERS table and all tables related to those 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 Start Table ===> CUSTOMERS Start Table Options : None

Table 1 of 1

<<MORE

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 All Related Tables

MOVE checks the DB2 Catalog and the PST Directory for tables related to CUSTOMERS and adds those tables to the list. MOVE then checks for tables related to these inserted tables and adds them also. This chain-like process continues until the complete set of related tables is included. (In this example, SALES and ORDERS are related to CUSTOMERS. ORDERS is related to DETAILS which is related to 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 Start Table ===> CUSTOMERS Start Table Options : None

Table 1 of 5

<<MORE

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

User Manual

27

2. Session Overview

Other Commands

Other commands are provided to display selection lists of all tables, LIST TABLES, or selection lists of all tables related to a specific table, LIST TABLES RELATED. Then, rather than have MOVE automatically add the tables, you can select individual tables from the list as desired. You can scroll and edit the list of table names on the Select Tables/Views for AD panel using standard ISPF-facilities. For example, after using GET TABLES RELATED to add the related tables, you can use the Delete line command to delete a table from the list. For this sample, assume the SALES table is deleted. The REF command is also available on this panel. This command switches the setting for the Reference Table field. This setting specifies whether all the tables except the Start Table are reference tables. The command is specified as REF Y to set the Reference Table field for all columns to Y indicating that all tables are reference tables or REF N to set the Reference table fields for all columns to N specifying that all tables are not reference tables.

Specify Criteria After you have specified the names of the tables, you can specify the selection criteria in a variety of ways. •

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



You can use the commands specific to Access Definitions as listed on the panel. These commands enable you to display column information and to define criteria for row selection. Details about these commands are provided in Section 3. Specify Access Definitions and the Relational Tools Command Reference Manual. In this demonstration only the POINT and REL commands are used.

In this sample, a subset of customers and all of their orders is extracted. Using the CUSTOMERS table as the starting table, you can select specific rows to be extracted from that table. POINT Command

28

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

Move for DB2

2.2 Specify the Source Data When you enter the POINT command, MOVE prompts for the name of a data set containing previously selected rows. If one exists, specify the name and press ENTER. The rows from the Start Table are displayed and any previously selected rows are indicated. If a data set does not exist or you want to stop using an existing data set, leave the field blank and press ENTER. Point-and-Shoot Display

MOVE presents the rows in the Start Table in a browse-only display. Use the Select Related line commands, SR and SSR, or the SELECT RELATED primary command to select the individual customer rows you want to extract. The title of the display indicates Point-and-Shoot row selection. In Figure 6. Point-and-Shoot Display, five rows have been selected as noted by the S in the F or status flag field and the message in the upper right-hand corner of the panel. SR is specified in the line command field for two customers, 07260 Five Star Videos and 07101 Movie Mania. The primary key values for these rows are to be included with the previously selected ones.

---------------- Relational Tools: Point-and-Shoot -------- 5 Rows Selected Command ===> 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 MA sr_ 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 MA sr_ 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 Pointand-Shoot, the Extract Process begins with those rows. In this example, the extract begins with the selected customers. The related rows from the other tables are extracted based on the relationships defined between the CUSTOMERS table and the other tables. For details, see Section 3.4.4 SQL WHERE Clause Specification. Selection Complete

User Manual

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

29

2. Session Overview returns to the Select Tables/Views for AD panel. If a data set is not supplied, the list is temporary. That means it is used only for the current Extract Process and discarded when the process completes. Relationships

You can select which relationships between the specified tables are to be traversed to extract the data. This is especially useful when multiple relationships are defined between tables. Use the REL command on the Select Tables/Views for AD panel to display the Specify Relationship Usage panel. (You can also use END to redisplay the EXTRACT Process menu, Figure 3, and select Option 2 PATHS 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?

Cmd --___ ___ ___

Q Q Child --Relation-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 tables on the Select Tables/Views for AD panel are displayed. The first time this panel is displayed, all of the relationships have a NEW status. The default handling for these new relationships is specified as an Access Definition option. You can specify whether or not all NEW relationships are to be automatically selected. You can explicitly select, S, and unselect, U, any relationship. On this panel, all of the relationships are new and are to be selected as defined. Questions Q1 and Q2 provide control for specifying whether parent rows are extracted to satisfy RI rules and, further, whether the children of those extracted parent rows should also be extracted. For details on selecting relationships and specifying values for questions Q1 and Q2, see Section 3.7 Selecting Relationships.

30

Move for DB2

2.2 Specify the Source Data SHOW STEPS Command

You can request an analysis of the relationship traversal path using the SHOW STEPS command from the Specify Relationship Usage panel. MOVE will describe the traversal path based on the specified source tables and selected relationships and display text documenting the series 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. used and Determines the Rows Selected.

Row List is

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 before actually extracting data. You can make changes as needed to obtain the required set of relationally intact data. After viewing the SHOW STEPS information, use END to return the Specify Relationship Usage panel. Use END again to return to the previous panel.

Specify Object Definitions In addition to the data, you can request that one or more types of associated object definitions are extracted from the source and stored in the Extract File. The available object types include: primary keys and relationships, indexes, views, aliases, synonyms, and column field procedure names. By default, the table definitions are always extracted so that MOVE can automatically create any unknown tables at the destination.

User Manual

31

2. Session Overview Use Option 3 on the EXTRACT Process menu to specify which object 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 Type Use U Line Command to Unselect Associated Objects of Specified Type Cmd --_ _ _ _ _ _

Status --------SELECT SELECT UNSELECT UNSELECT UNSELECT UNSELECT

Note:

Object Type ----------------------------Primary Keys and Relationships Indexes Views Aliases Synonyms Column Field Procedure Names

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 and Relationships 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 to EXTRACT panel are extracted for every table included in the Extract Process when you request that object definitions are to be extracted on the Specify EXTRACT Parameters and Execute panel (discussed in the following section).

32

Move for DB2

2.2 Specify the Source Data

Perform the Extract To perform the Extract Process, select Option 4 PERFORM from the EXTRACT Process Menu. The Specify EXTRACT Parameters and Execute panel is displayed. There are prompts for several parameters 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 Run Process in Batch or Online If Batch, Review or Save JCL

===>

(Y-Yes, N-No)

===> O ===>

(B-Batch, O-Online) (N-No, R-Review, S-Save)

Figure 10. Extract Process Parameters Since the extracted data is stored in an Extract File, specify the name of the sequential file that is to contain the extracted data at the prompt for Extract File DSN. If the file does not exist, MOVE prompts for allocation information and creates the file. You can extract the data, the object definitions or both. Use the second prompt, Extract, to specify your choice. For this demonstration, only data is extracted. If BMC's UNLOAD PLUS is available, additional prompts are provided to specify whether it is used to perform the extract. Perform Convert with Extract allows you to direct MOVE to convert the data before writing it to the Extract File. This useful when you need to mask sensitive data or alter values to be extracted from the database. The other prompts enable you to limit the number of rows of data that are extracted, to execute in batch or online, and, if in batch, to review the JCL. When you request review of the JCL for batch execution, the JCL is displayed in the ISPF editor. You can save this JCL using the ISPF facilities. Use END to return to your MOVE session. (Whether END also automatically submits the job is determined by a user option discussed in Section 6. Specify Options. The saved JCL can be edited and executed from ISPF without entering a MOVE session.

User Manual

33

2. Session Overview Helpful Information

Before the process is executed, the Access Definition is evaluated. Several conditions generate warning messages. These messages are displayed. For example, in the following figure a relationship will not be 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 execute the 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 processed and the number of processed rows. This information is refreshed frequently.

34

Move for DB2

2.2 Specify the Source Data MOVE generates an EXTRACT Process Report. For batch execution, the report is available in a data set or SYSOUT, as specified on the JOB Card and Print Options panel. For online, execution, the report is automatically displayed when the process terminates. The following is a sample of this report. Extract Process Report

--------------------------- EXTRACT Process Report -----------------------Command ===> Scroll ===> PAGE ROW 0 OF 21 ******************************** TOP OF DATA ****************************** EXTRACT Process Report Extract File Access Definition Created by Time Started Time Finished

: : : : :

PSTDEMO.SAMPLE.EXTRACT TEMPORARY ACCESS DEFINITION COHEND 1999-03-07 11.01.31 1999-03-07 11.01.39

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

1

Extracted Object Types ---------------------Table-List Tables

1 2 3 4

Extracted Extract Tables Rows ------------------------ ---------PSTDEMO.CUSTOMERS 132 PSTDEMO.ORDERS 792 PSTDEMO.DETAILS 2176 PSTDEMO.ITEMS 872

4 3972 107

Number -----4

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

Figure 12. Extract Process Report Format The contents of the online display of the EXTRACT Process Report can be directed to a data set or SYSOUT. Use the OUTPUT command to specify the destination of the report. Otherwise, the report is not retained. When the Extract Process is complete, use END to return to the EXTRACT Process menu and END again to return to the Data Migration menu.

User Manual

35

2. Session Overview

2.3 Specify the Destination Once you have used MOVE to extract the source data and generate the Extract File, you can specify the destination using the Insert Option on the Data Migration menu. When you select Option 2 Insert on the menu, the INSERT Process menu is displayed.

-------------------------------INSERT Process ----------------------------OPTION ===> 1 2 3

TABLE MAP PERFORM INSERT PERFORM UPDATE

- Specify Table Map and Column Maps - Specify INSERT Parameters and Perform INSERT - 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 Extract File

The name of the last Extract File you created is provided automatically. This file contains the source data that is to be inserted at the destination. The Extract File is used solely to contain the extracted source data. It is not affected directly by the Insert Process. Therefore, the Extract File can be used by multiple users simultaneously and repeatedly.

Control File

The name of a Control File is also required. There may be instances, during an Insert Process, when a row cannot be inserted. For example, assume RI rules enforce that a row cannot be 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 the process is complete you can browse the entire Extract File or just the rows that were discarded to determine why they could not be processed. Extending the above example, assume that by displaying the discarded rows you determine that some rows were not inserted because a parent row did not exist. You can create the needed parent row to remedy the problem. Then, you can “RETRY” the Insert Process for only those rows that were discarded without duplicating any previous successful processing.

36

Move for DB2

2.3 Specify the Destination Separate Source from Destination

Since the Extract File is designed to contain the source data, it can be reused as needed to insert the same data into different destination tables or to refresh a destination after testing an application. In contrast, the Control File is designed to keep track of a specific processthe destination and the discarded rows. Using the same Extract File and unique Control Files, multiple users can work with the same data and still perform their individual Insert Process requests. For example, programmers can test their applications against their own copy of the data. If necessary, they can refresh that test data over and over using the same source data in the Extract File.

INSERT versus UPDATE

The Insert Process can be performed in one of two ways: 1. You can specify insert only. That means only new rows are to be inserted. Thus, a source row is discarded when the primary key value of the source row matches the value in an existing destination row. 2. You can specify update. That means new rows are inserted and existing destination rows are updated. Thus, when the primary key value of the source row matches the value in an existing destination row, the destination row is updated.

Insert Process Options

The Insert Process menu, as shown in Figure 13. Insert Process Menu, provides three options: TABLE MAP PERFORM INSERT PERFORM UPDATE

TABLE MAP

MOVE can insert the data from the Extract File into destination tables with the same names or different names. When the destination tables do not exist, MOVE can create the destination tables to match the source exactly and then insert the data. When MOVE determines that destination tables must be created, you are prompted to specify whether primary keys, relationships, indexes, and so forth as contained in the Extract File are also created. (If the definitions for these objects have not been extracted, only the tables are listed.) This is useful when moving source data from one subsystem to another and the destination tables have not been defined. You can let MOVE do it for you automatically. By default, MOVE assumes the base destination table names are the same as the source table names. However, at the very least, you must specify a default Creator ID for the destination using the TABLE MAP option.

User Manual

37

2. Session Overview Table Map Panel

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

---------------------------- INSERT Process Table Map ---------------------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 ===> Map ID ===> Extract Tables Destination Table Name Type Column Map or "LOCAL" ------------------ ---------------------------- ------- ------------------************************************ TOP ********************************** CUSTOMERS CUSTOMERS UNKNOWN ORDERS ORDERS UNKNOWN DETAILS DETAILS UNKNOWN ITEMS ITEMS UNKNOWN *********************************** BOTTOM ********************************

Figure 14. Insert Process Table Map - Initial Display MOVE automatically displays the Source Creator ID in the field Src CID, and the names of all of the tables in the Extract File in the field Extract Tables. MOVE assumes these same values for the destination tables in the field Destination Table Name. You must supply the Destination Creator ID in the field Dest CID. (It can be the same as the Source Creator ID to re-insert or update the source data, although this is not typical.) The Type is supplied by MOVE and specifies whether the destination is a table, a view or unknown. On initial display, the destination is UNKNOWN. This is revised after you specify the Dest CID. You can overtype the Dest CID and the Destination Table Names to specify the names you want. MOVE automatically adjusts the Type.

38

Move for DB2

2.3 Specify the Destination Specifying Dest CID

For example, assume you have a test database that has the same structure as the production system. The Creator ID is used to distinguish these two sets of tables. To insert the source data extracted from the production system into the same-name test tables, specify the Dest CID and do not change the Destination Table Names. MOVE automatically identifies the Type for each destination using the Dest CID. In this example, the Dest CID is specified as PSTDEMO2 and all of the destinations are tables.

---------------------------- INSERT Process Table Map ---------------------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 ===> PSTDEMO2 Map ID ===> Extract Tables Destination Table Name Type Column Map or "LOCAL" ----------------- ---------------------------- ------- -------------------************************************ TOP ********************************** CUSTOMERS CUSTOMERS TABLE ORDERS ORDERS TABLE DETAILS DETAILS TABLE ITEMS ITEMS TABLE *********************************** BOTTOM ********************************

Figure 15. Insert Process Table Map - Modify Creator ID Column Maps

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

Apply Existing Table Map

If a suitable Table Map has been defined and stored in the PST Directory, you can use the APPLY command to insert the specifications for that Table Map into the current one. You can determine which specifications are includedonly 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 details on Column Maps, see Section 4.3 Column Maps. Use END to return to the INSERT Process menu.

User Manual

39

2. Session Overview Perform the Process

In this sample session, Option 2 PERFORM INSERT is selected from the 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 If YES, Commit Frequency ===> T Age Date Values Lock Tables During Process Commit Every Nth Row Limit Number of Discarded Rows Run Process in Batch or Online If Batch, Review or Save JCL

===> N ===> N ===> ===> ===> O ===>

(Y-Yes, N-No) (T-After Each Table, E-At End) (Y-Yes, N-No) (Y-Yes, N-No) (1-1000, Blank-Site Limit) (1-999999, Blank-No Limit) (B-Batch, O-Online) (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. For example, you can specify whether the data in the destination tables is deleted prior to performing the insert (perhaps to fully refresh test data), and whether tables are locked during the process and the frequency of committing the data. Limit Discarded Inserts

You can also request that the Insert Process be terminated based on the number of discarded rows. For instance, if more than 50 rows are discarded there may be some problem with RI rules such that rows cannot be inserted because necessary parents do not exist. Rather than continue 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.

Online versus Batch

You can execute the process online or in batch. When online, execution status is displayed in a pop-up window and, when the process is completed, an INSERT Process Report is automatically displayed. When executed in batch, the INSERT Process Report is output to SYSOUT or another user-designated file. After typing your specifications for the Insert Process, press ENTER to direct MOVE to perform the process.

More Details

40

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

Move for DB2

3. Specify Access Definitions An Access Definition describes the data to be extracted from the source 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, and Point-and-Shoot.



The list of relationships that are to be traversed for the tables specified on the list.

The functions used to create a new Access Definition are the same as those used to modify an existing Access Definition. You can initiate the creation of an Access Definition by specifying a unique name to be assigned to the new Access Definition. You can use an existing Access Definition as a model and save it under a new name. A series of panels prompt you through the process of creating and modifying an Access Definition. You can create or modify an Access Definition explicitly by selecting the ADS option or implicitly by selecting the MIGRATION option on the Main Menu. For details about the MIGRATION option, see Section 5. Data Migration. Consider Purpose

User Manual

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

41

3. Specify Access Definitions

3.1 Choose an Access Definition Use Option 5 ADS from the Main Menu or suboption 5 ADS from Option 6 DEFINITIONS on the Main Menu to create or modify an Access Definition. (For information about Main Menu Option 6, DEFINITIONS, see Section 4. Definitions.) When you select the ADS option, the Choose an Access Definition panel 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 or use DB2 LIKE syntax in one or more of the fields. A selection list based on the specifications on this panel is displayed. The fully qualified name of an Access Definition consists of three parts: Group User Name The Choose an Access Definition panel prompts for the three parts of the Access Definition name. ---------------------- Choose an Access Definition ------------------Command ===> SQLID ===> PSTDEMO Access 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 Panel Fields

42

Several prompts are provided on this screen. SQLID

Current SQLID. If you modify this value, MOVE will attempt to reconnect to DB2 using the modified SQLID. Since you can be connected with only one SQLID, the connection with the original SQLID is not maintained. However, if MOVE cannot connect with the specified SQLID, you will be returned to the Main Menu and an error message will be displayed.

SUBSYS

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

Move for DB2

3. Specify Access Definitions connection to the original subsystem is not maintained. However, if MOVE cannot connect to the specified subsystem, you will be returned to the Main Menu and an error message will be displayed. LOCATION

Current location. This field is only displayed if remote access is available. If you modify this value, MOVE will attempt to connect to the remote subsystem. Since you can be connected to only one subsystem at any time, the connection to the original subsystem is not maintained. However, if the connection fails, you will be returned to the Main Menu and an error message will be displayed.

Group

1 to 8-character group ID. The default is the previously entered value or, if GROUP has never been specified, the TSO ID of the current user.

User

1 to 8-character user name. The default is the previously entered value or, if USER has never been specified, the DB2 SQLID of the current user.

Name

1 to 12-character name of the Access Definition.

Use '_' for DB2 LIKE Specifies whether or not the underscore, '_', is to be used as a DB2 LIKE character or character used literally 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 threecharacter name that begins with 'A', ends with 'B', and has any valid character in the middle. The default is No which means that '_' is not handled as a DB2 LIKE character. Specify Name

User Manual

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

43

3. Specify Access Definitions If an explicitly named Access Definition does not currently exist, it is assumed that you are going to create that definition and the Select Tables/Views for AD panel is displayed for you to begin. Obtain Selection List

You may use DB2 LIKE syntax in any of the fields or leave one or more fields blank to obtain a selection list. The content of the selection list is determined by the values specified for Group, User, and Name. For example, a selection list of all Access Definitions, regardless of the Group or User, can be obtained by leaving all three fields blank. A selection list of all Access Definitions in any Group beginning with A and for the User identified as JAA, can be obtained by specifying: Group User Name

A% JAA blank or %

If a selection list is requested and there are no Access Definitions that match the selection criteria, the message "NO MATCHES" is displayed. Subsequent Use

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

Primary Commands

The END command or the CANCEL command can be used to return to the previous menu. The OPTIONS command can be used to display 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 the specifications in the Group, User, and Name fields on the Choose an Access Definition panel. The names are presented in alphabetical order sorted by Group, User, and Name.

44

Move for DB2

3. Specify Access Definitions Use the Select line command, S, to indicate the Access Definition to be modified. In the following figure, the formatted list is displayed and the last 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 Panel fields

The fields on this panel are: Cmd

User Manual

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

Select an Access Definition for processing.

D

Delete an Access Definition. After deleting, the message “*DELETED” appears in the Date field under the Last Modified heading.

C

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

R

Rename an Access Definition. The Rename command allows you to change the name of an existing Access Definition. The Rename Access Definition panel prompts for the new name of the selected Access Definition. After renaming, the message “*RENAMED” appears in the Date field under the heading Last Modified. (See page 49 for details.)

AT

Modify attributes of an Access Definition. The Object Attributes panel allows you to edit the description and security status of the Access

45

3. Specify Access Definitions Definition. (See page 49 for details.) I

Access Defintion

Last Modified

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

Group

The group name supplied when the Access Definition was created.

User

The user name supplied when the Access Definition was created.

Name

The base name of the Access Definition.

By

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

Date

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

Description

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

Access Definition Attributes

To display the attributes of an Access Definition, type I in the Cmd field next to the name of the Access Definition. The following figure shows the Access Definition Attributes panel.

--------------------------Access Definition Attributes Command ===> Group User Name

: GROUP : USER : ADSAMPLE

Description Security Status Last Modified By Modified On

: : : :

-------------------

Sample Access Defintion PUBLIC PSTDEMO 2000-01-12 11.06.42

Number of Tables : 6 Start Table : CUSTOMERS Default Creator ID : PSTDEMO Access Definition Parameters Dynamically Add New Tables Modify Selection/Sort Criteria Begin Table Display with Changes to AD During Edit Use NEW Relationships

: : : : :

Yes Yes Selection Criteria for Start Table Permanent Yes

Figure 19. Access Definition Attributes

46

Move for DB2

3. Specify Access Definitions This is a read-only display. Relational Tools generates and maintains all of the information on this panel according to your specifications for the Access Definition.

User Manual

47

3. Specify Access Definitions Object Attributes

To modify the description and security status attributes of an Access Definition, type AT in the Cmd field next to the name of the Access Definition. The description and security status are specified on the Object 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 display and edit the description. An 8-character area is available to specify one of the following security statuses: PUBLIC PRIVATE READONLY

Anyone can edit and use. Only owner can edit and use. Anyone can use, only owner can edit.

Based on installation options, site management can establish that users may not specify security status on this panel. In that case, the prompt for security status is replaced with “Not Active” on the panel. Any attempt to change the security status will result in an error message. Copy an Access Definition

To copy an Access Definition, type C in the Cmd field next to the name of the Access Definition to be copied. The following figure shows 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 source Access Definition and prompts for a new three-part name for the copy operation.

48

Move for DB2

3. Specify Access Definitions Rename an Access Definition

To rename an Access Definition, type R in the Cmd field next to the name of the Access Definition to be renamed. The following figure shows 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 of the Access Definition and prompts for a new three-part name. Return Display

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

Available Commands

The following primary commands are available when the Select Access Definitions panel is displayed: BOTTOM CANCEL DOWN END

FIND LOCATE OPTIONS RESET

RFIND SELECT SHOW

SORT TOP UP

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

User Manual

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

49

3. Specify Access Definitions

3.2 Components of an Access Definition MOVE provides a series of panels to prompt for the components of an Access Definition. The first panel, Select Tables/Views for AD is used 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 name of each panel is specified in bold text. The command that displays the panel from the Select Tables/Views for AD panel is also displayed in each panel box.

The following sections discuss each of these panels and how they are used to specify the set of source data that is to be extracted. These panels are available from the Extract Process menu as well as through the Main Menu option, ADS. For example, Option 1 TABLES on the Extract Process menu displays the Select Tables/Views for AD panel. All of the panels described above can be accessed from this panel. Option 2 PATHS on the Extract Process menu displays the Specify Relationship Usage panel. (The Extract Process menu is available from the MIGRATION Option on the Main Menu. See Section 5. Data Migration for more information.)

50

Move for DB2

3. Specify Access Definitions

3.3 Table/View Selection The Select Tables/Views for AD panel is used to specify the names of tables that are to be accessed for an Extract Process. This panel is displayed when an Access Definition has been selected on the Select Access Definitions panel or explicitly named on the Choose an Access Definition panel. This panel is also displayed when the TABLES option is selected from the EXTRACT Process submenu when option 7 MIGRATION is selected from the Main Menu. (The Migration Menu is discussed in detail in Section 5.2 Extract Data.) Two Pages

When Access for DB2 and MOVE are available, this panel is presented on two screens, a left-hand and a right-hand “page”. To indicate the presence of right and left pages, More followed by an arrow is presented in the upper right of the panel. The direction of the arrow indicates whether the remaining prompts are to the right or left. Use the primary commands LEFT and RIGHT or the assigned function keys to scroll the pages horizontally. When Access for DB2 is not available, only the right-hand page is displayed. (See Figure 24. Select Tables/Views for AD - Criteria Portion on page 56.) This discussion assumes both products are installed.

Initial Display

User Manual

If an existing Access Definition is selected, the set of tables defined for that Access Definition is shown. If the Access Definition is being created, there are no table names to display and space is provided to enter the name of a table to be included. A variety of commands are available to help populate this list. For example, you can specify the name of a single table and use the GET TABLES RELATED ALL command to populate the list with all of the tables related to that single table.

51

3. Specify Access Definitions Sample Display

Assume that the Access Definition named ADSAMPLE has been selected and contains the name of one table, CUSTOMERS. The lefthand page of the Select Tables/Views for AD panel is shown with the fully qualified name of the current Access Definition on the title line.

-- 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 Start Table ==> CUSTOMERS Start Table Options : None

Table 1 of 1

MORE>>

--- 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 Panel Fields

There are several fields on this panel. Default Creator ID

1- to 8-character identifier. This default Creator ID is used whenever a Creator ID is omitted from the Table/View Name field. The default value, when creating an Access Definition, is the current user’s DB2 SQLID.

Start Table

Name of the table from which data is extracted first. If the Creator ID for the Start Table is not the same as the default, the table name must be fully qualified. Any table defined in the Access Definition may be selected 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 Table field is not in the Access Definition, it is added. You may specify a partial name, with wild card characters to generate a selection list.

Start Table Options

Identifies whether any of the Start Table selection criteria methods have been specified. This is a display-only field that contains one or more of the following: Temp. Row List(POINT)

52

Primary key values have been stored in a Row List and are available only for the current Extract Process.

Move for DB2

3. Specify Access Definitions Row List(POINT)

Primary key values have been stored in a Row List and are available for any Extract Process.

Group Selection (GROUP)

Group selection processing has been specified.

None

Special Start Table criteria have not been specified.

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

Field for line commands. Line commands are used to select the tables for which further definition is required. Specify: ALL

Select all rows. This removes or drops all selection criteria.

ARC

Display Specify Archive Criteria for AD panel. (This command is only available if Archive for DB2 is installed. ARC is not available when creating or modifying an Access Definition through option 7 MIGRATION on the Main Menu.)

COL

Display Describe Columns for AD panel.

EXP

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

GR

Add names of directly related tables to the list.

GP

Add names of directly related parent tables to the list.

GC

Add names of directly related child tables to the list. For GR, GP, and GC a number from 1 through 9 can be specified with the line command to indicate the number of levels to include. Also, the alphabetic character A can be specified to indicate that ALL levels are to

User Manual

53

3. Specify Access Definitions be included. LR

Generate a selection list of related tables.

SEL

Display Specify Selection Criteria for AD panel

SQL

Display SQL WHERE Clause panel.

ISPF-like line commands are available to copy, move, repeat, insert, and delete table names. For more information on the available line commands see page 61. Status

54

Indicates the status of the table. This is a display only field that contains one or more of the following: ARC

Archive criteria or index columns specified.

blank

All columns are selected with default display formatting. Default.

COL

Column attributes specified.

SEL

Selection criteria specified.

SQL

A SQL WHERE clause specified.

UNKNOWN

The named table is not known to DB2. This is possible if the table has not been created yet, has been dropped since the Access Definition was defined, was mistyped, or the default Creator ID is changed and the table name when combined with this value is UNKNOWN. An Access Definition may be saved with an UNKNOWN table. However, an UNKNOWN table may not be defined as the Start Table.

VIEWERR

The named view is not usable. Typically, this means that there is a conflict between the view definition and the underlying base tables. An Access Definition may be saved with a view that is in

Move for DB2

3. Specify Access Definitions VIEWERR status. However, a VIEWERR view may not be defined as the Start Table. REMOTE

The named table is a remote alias to another DB2 subsystem. Remote tables are not supported. This table name must be removed before saving the Access Definition. If remote access is available, change the LOCATION to access these tables.

TEMPTABLE

Table/View Name

The table is a DB2 Temporary Table. It contains no data, should be defined as a reference table and cannot be used as the Start Table or selected for a browse or Pointand-Shoot session. However, you can extract the object definition.

Name of the table or view to be included in the Access Definition. Tables are identified by Creator ID and table name. At least one table or view must be specified. If the Creator ID is not specified here, the Default Creator ID is assumed. A table may be referenced once, therefore a table name can be specified only once. This includes a table and one or more views of that table, or one more aliases or synonyms of that table. (This applies to MOVE only.) If you exit this panel and at least one table is not specified, MOVE deletes the Access Definition. You can specify a Temporary Table, but it must be a reference table and cannot be used as the Start Table. Since there is no data in the table, you cannot join to it during a browse or Point-and-Shoot session

Access Rights

User Manual

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

55

3. Specify Access Definitions Indicates whether the entry is a table, view, alias or synonym. The possible values are:

Type

TABLE VIEW S-TABLE S-VIEW A-TABLE A-VIEW

Table name View name Synonym for a table Synonym for a view Alias for a table Alias for a view

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

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

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

Default Creator ID ===> PSTDEMO Start Table ===> CUSTOMERS Start Table Options : None

Table 1 of 1

<<MORE

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 Panel Fields

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

Identifies whether all of the rows in the table should be selected because the table is a reference or lookup table. Specify: N

Extract only the related rows.

Y

Extract all of the rows.

If Y is specified, the relationships for this table are not displayed on the Specify Relationship Usage panel because they are irrelevant when selecting rows from a reference table. Also, when the Compare Process is performed, reference tables are not linked to related tables to identify related changes. This field is displayed as Ref Tbl if Archive for DB2 is not installed. Use REF command to set all tables except the Start

56

Move for DB2

3. Specify Access Definitions Table as reference tables. Any table on the list, except the Start Table, may be selected as a reference table. Overtype the field with the desired designation. There is no limit to the number of tables that may be specified as reference tables. DA

Specifies whether archived rows are deleted from the table. This field is only available when Archive for DB2 is installed.

Every Nth

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

Row Limit

A numeric value that specifies the maximum number of rows that can be selected from the table. Any value from 1 through 99999999 may be specified.

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

Available Commands

You can specify a description for the Access Definition. Use the ATTRIBUTES command to display the Object Attributes panel. This panel provides a 40-character area to display and edit the description. (Site management determines whether this panel also displays a prompt for Security Status.) For additional information about the Object Attributes panel see Specify Description and Security Status in Section 6.1 User Options. The following commands are available when the Select Tables/Views for AD panel is displayed: ALL ATTRIBUTES BOTTOM BROWSE CANCEL COLUMNS CREATE PRIMARY KEY CREATE RELATIONSHIP DOWN END

User Manual

EXP FIND GET TABLES RELATED GROUP INDENT LIST OPTIONS PARAMETERS POINT REF

RELATIONSHIP RESET RFIND SAVE SEL CRITERIA SORT SQL TOP UP

57

3. Specify Access Definitions If Access for DB2 is installed, the primary commands EDIT, LEFT and RIGHT are available. If Archive for DB2 is installed, the primary commands ARCHIVE and DAA are available.

3.3.1 Specifying Table Names At least one table must be specified in the Access Definition. In addition to manually typing the table names in the field provided on the panel, you may select from a selection list or let MOVE insert the table names automatically. 3.3.1.1 Using a Selection List The LIST command provides a variety of selection lists. LIST TABLES

The LIST TABLES command is used to display an alphabetical list of tables from which one or more may be selected. A name pattern may be specified using DB2 LIKE syntax to limit the selection list. If a name pattern is not specified, the list includes all tables for the default Creator ID. For example to list all tables that begin with A for the default Creator ID use: LIST TABLES A% You can include additional operands (DB, TS, PL, or PKG) to limit the list to tables in a specific database, tablespace, plan, or package. These operands allow DB2 LIKE syntax. For example to list all tables that begin with A for the default Creator ID in a database named 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.

LIST VIEWS

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

LIST ALIASES

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

LIST SYNONYMS

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

58

Move for DB2

3. Specify Access Definitions Assume a new Access Definition is being created and the LIST TABLES command is entered. A selection list displays all tables for the 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 ************* | --- ------ ----------------- | ___ PSTDEMO.DETAILS | *** ********************* | ___ PSTDEMO.ITEMS | ___ CUSTOMERS | S__ PSTDEMO.ORDERS | *** ************************ | ___ PSTDEMO.SALES | | ___ PSTDEMO.SHIP_INSTR | | ___ PSTDEMO.SHIP_TO | | ************ BOTTOM ************* | +----------------------------------------+

Type ---**** ****

Figure 25. Table Selection List This selection list can be scrolled. Any number of tables can be selected using the Select line command, S. Tables can be unselected by overtyping the S with a blank. The selected tables are included in the Access Definition when the ENTER key or END is used to terminate selection list processing. When the list is scrolled, the selections are processed such that the list is shown with a left-justified uppercased S in the Cmd field of every selected table. A maximum of 50 tables can be selected from the selection list. Table Selected

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

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

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

Default Creator ID ===> PSTDEMO Start Table ===> CUSTOMERS Start Table Options : None

Table 1 of 2

<<MORE

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

User Manual

59

3. Specify Access Definitions The selection list can be displayed again as needed. The selection list will not contain any tables that are already included in the Access Definition. Selection List of Related Tables

In addition to a selection list of all tables, a selection list of only the tables related to a specific table can be displayed. The LIST TABLES RELATED primary command or the LR line command are used to display the list of tables related to a specific table. The LIST TABLES RELATED command requires that the name of a table be specified. For example, to display a list of tables that are related to the 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 the relationship definition, and the type of table in the relationship as either parent or child. The source of the relationship definition is specified as DB2 for those relationships obtained from the DB2 Catalog and as PST for those defined to the Princeton Softech Directory. Tables can be selected from the list of related tables in the same manner as selecting tables from the full table list obtained using the LIST TABLES primary command. This list can be redisplayed as needed.

3.3.1.2 Automatically Inserting Table Names The GET TABLES RELATED command obtains the same list as the LIST RELATED command except that GET TABLES RELATED automatically includes the related tables in the Access Definition. A selection list is not presented. You may delete any unwanted related tables. The ALL operand can be specified on the command to obtain the entire 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 are related as shown. The arrows indicate the direction of the relationship as parent to child.

60

Move for DB2

3. Specify Access Definitions Specifying GET TABLES RELATED ALL for any one of the tables in the diagram will populate the table list with all of the table names. Operands are provided to insert only related parents or only related children for a specified number of levels. Note the following examples: •

GET TABLES RELATED TO CUSTOMERS CHILD Inserts all children directly related to CUSTOMERS. In this example, only the ORDERS table is inserted.



GET TABLES RELATED TO CUSTOMERS 2 CHILD Inserts two levels of childrenchildren and grandchildren. In this example, the ORDERS table and the DETAILS table are inserted.

Conversely, the command can also be directed to include parent tables. 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 parentsparents and grandparents. In this example, in addition to the ORDERS table and the ITEMS table, the CUSTOMERS table is inserted because, as parent of the ORDERS table, it is the grandparent of the DETAILS table.

Comparable line commands, GRn, GRA, GPn, GPA, GCn and GCA are also available. Enter the line command in the line command area of any table name on the Select Tables/Views for AD panel. A table designated as a reference table cannot be the subject of either the GET RELATED primary command or any of the GR line commands. By definition, all rows in a reference table are extracted subject to selection criteria regardless of relationships with other tables on the table list. 3.3.1.3 Supporting Facilities You may find, when using the GET RELATED or LIST RELATED commands, that one or more tables you expected are not included or tables you did not expect are included. You can create needed relationships and display the tables in a format based on their relationships.

User Manual

61

3. Specify Access Definitions Creating Relationships

A relationship does not exist when an expected table is not included by GET RELATED or LIST RELATED processing. You can create additional relationships using the CREATE RELATIONSHIP command on the Select Tables/Views for AD panel. This displays the panels used to define relationships stored in the Princeton Softech Directory. (The Definitions option on the Main Menu also displays these panels. The information about defining relationships is discussed in Section 4.2 Relationships.) When you signal that you have completed defining the relationship using END or CANCEL, you are returned to the Select Tables/Views for AD panel. When you execute GET RELATED or LIST RELATED, the newly related tables are included.

Displaying Relationships

The list of the tables in the Access Definition can be viewed in a format that shows parent-child relationships. This information may be helpful when determining which tables are to be included in the Access Definition. Multiple references to a table are indicated. Use the INDENT command on the Select Tables/Views for AD panel or on the Specify Relationship Usage panel to display the indented list. Assume the four tables CUSTOMERS, ORDERS, DETAILS, and ITEMS, as shown in the previous diagram, are listed in the Access Definition. The following panel is displayed when the INDENT command is executed.

----------------------------- Indented Table Display ------------------------Command ===> Scroll ===> CSR ROW 0 OF 10 *********************************** TOP OF DATA ****************************** Default Creator ID : PSTDEMO

1. 2. 3. 4.

Table Name ------------------------------------------------------------CUSTOMERS C:ORDERS C:DETAILS P:ITEMS

Relation Type -------- ---START TABLE RCO DB2 ROD DB2 RID DB2

Figure 27. Indented Table Display Panel Fields

62

The fields on the panel include: Default Creator ID

The default Creator ID as specified on the Select Tables/Views for AD panel.

Table Name

Name of the table. If the Creator ID is not the same as the default Creator ID it is included with the name.

Move for DB2

3. Specify Access Definitions

The Start Table is listed first followed by the other tables ordered and formatted to reflect the relationships. When there is more than one related table, the names of the parents are listed followed by the children. Within these lists of parents and children, the order is determined by the Access Definition table list. Special notation is included with the table name to provide information about the relationships. This notation includes: Parent/Child Indicators Except for the Start Table, the table name is prefixed to indicate whether it is the parent or the child in the relationship defined between the named table and the table under which it is indented. The prefix is either: C: P:

Child Parent

Multiple Reference Indicator Any table that is referenced multiple times is noted by the suffix (n) where n is an integer value indicating the line number on the panel containing the first occurrence. The first occurrence is not displayed with a multiple reference indicator. Thus, table names listed below the first occurrence on the list are not listed again. Cycle Indicator Any table that is included in a cycle is noted by the suffix (CYCLE:n) where n specifies the line numbers of the other tables in the cycle.

User Manual

Relation

Name of the relationship between the higher level table and this table. START TABLE is always specified for the Start Table.

Type

Identifier to denote whether the relationship is defined in the DB2 Catalog, DB2, or in the Princeton Softech Directory, PST.

63

3. Specify Access Definitions If indenting is such that sufficient space is not available to display the full name, the name is preceded with a level indicator (Ln where n is the level number) and positioned to the left such that the entire name fits on the line. Any tables that have been selected as reference tables are noted at the bottom of the list and not directly included in the formatted list. Also, any table included on the list that does not have a relationship with another table on the list is not included in the formatted list. These “unconnected tables” are listed at the bottom after the reference tables. 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 of tables using UP, DOWN, TOP, and BOTTOM. You can also use the FIND command to locate a table name by specifying all or part of the name with the command. To edit the list of tables, you can directly overtype a table name or use line commands. Line Commands

The line commands available for editing include standard ISPF-like commands 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 move operation. Each table name must be unique. Any editing can result in duplicate table names, which must be resolved before saving or using the Access Definition. Rearranging the order in which the tables are listed has no impact on the sequence in which the data is extracted from the tables when the Access Definition is used by MOVE to copy DB2 data.

Delete Names

64

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

Move for DB2

3. Specify Access Definitions name field. Although any number of tables can be deleted from the Access Definition, at least one table must be specified. If all tables are deleted from the Access Definition and the Select Tables/Views for AD panel processing is terminated, the Access Definition is automatically deleted. If the user option, Confirm Delete, is defined as YES, you will be prompted for confirmation before the Access Definition is deleted. Modify Name

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

3.3.3 Access Definition Specific Commands Primary commands, unique to the Princeton Softech tools, are available when defining an Access Definition. These commands are provided to display panels on which to specify additional Access Definition information. The most frequently used commands are listed at the top of the panel. Primary Commands

User Manual

These commands, in alphabetical order, are: ALL

Delete the selection criteria specified for the indicated table so that all rows are selected.

ARC

Display the Specify Archive Criteria for AD panel for the table to select columns for indexing or to specify archive criteria. (This command is only available if Archive for DB2 is installed.)

COL

Display the Describe Columns for AD panel for this table. This portion of the panel is used to specify the display behavior of the columns and the sort criteria. The display behavior is specified on the Describe Columns for AD panel and is used for displaying data for a Point-and-Shoot session.

GET TABLES

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

65

3. Specify Access Definitions

Line Commands

RELATED

3.3.1.2 Automatically Inserting Table Names.)

GROUP

Display the Start Table Group Selection Processing prompt. This panel is used to specify random selection of Start Table rows based on values in one column.

INDENT

Display the list of tables in an indented format. This format indicates the hierarchy in which the tables are to be accessed. Tables are identified as parent or child in the relationship with the next higher level table. Multiple references to a single table are noted.

PARM

Display the Access Definition Parameters panel for this Access Definition.

POINT

Display the data from the Start Table as a Point-andShoot session. Users select the rows from the Start Table to be used as the starting point of an Extract Process. The primary key value for each selected row is saved.

REL

Display the Specify Relationship Usage panel for this Access Definition. This specifies the relationships to be traversed when extracting data.

SEL

Display the Specify Selection Criteria for AD panel for this table. This portion of the panel is used to specify the selection criteria when extracting data from each table and displaying the data for a Pointand-Shoot session.

SQL

Display the SQL WHERE Clause panel for this table. This panel is used to specify an SQL WHERE Clause. The SQL WHERE Clause is used when extracting data from a table and displaying data for a Point-and-Shoot session.

The line commands listed on the Select Tables/Views for AD panel are discussed with the Cmd field for Figure 23. Select Tables/Views for AD – Access Rights on page 52. Use END to return to the Select Tables/Views for AD panel from any of these displays. Use the CANCEL command to abandon any changes made on these panels and then return.

66

Move for DB2

3. Specify Access Definitions

3.3.4 Completed Table Selection Use the END command to signal that specifications on the Select Tables/Views for AD panel are complete. The Access Definition is stored in the Princeton Softech Directory. The Select Access Definitions panel, the Choose an Access Definition panel, or the EXTRACT Process menu is redisplayed depending on how the Select Tables/Views for AD panel was requested. Error Handling

When an error condition is encountered, it must be resolved. Some errors prevent the user from proceeding in the definition process; other errors 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 Access Definition. • • •

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 display additional information. SAVE Command

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

CANCEL Abandons Changes

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

User Manual

67

3. Specify Access Definitions

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-Shoot facility.



Random sampling specifications for the Start Table using group selection processing.



A sampling rate to be used to extract a random set of rows for an individual table.



A maximum number of rows for an individual table or for the entire 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 Table along with selection criteria, a prompt is displayed on the Specify EXTRACT Parameters and Execute panel enabling you to specify whether only the Point-and-Shoot values or both the values and selection 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 based only on the related data they contain and, if specified, a random selection factor and maximum row limit value. Prompts for a random factor and a row limit for a table are provided on the Select Tables/Views for AD panel and are discussed in Section 3.3 Table/View Selection. The Point-and-Shoot facility is available from the Select Tables/Views for AD panel and is discussed in Section 3.5 Using the Point-and-Shoot Facility. Group selection processing is available from the Select Tables/Views for AD panel and is discussed in Section 3.6 Group Selection Processing. The prompts for selection criteria and an SQL WHERE clause are displayed on different panels and discussed with the appropriate panel description in the following sections.

68

Move for DB2

3. Specify Access Definitions ALL Command

To remove the selection criteria and the SQL WHERE Clause specification from a table, use the ALL primary or line command on the Select Tables/Views for AD panel. For example, to remove the criteria for 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 and determine 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 the selection criteria for each table. By default, all rows in each table are included, subject to user and site maximums. To specify selection criteria, use either the SEL primary or SEL line command on the Select Tables/Views for AD panel. SEL Command

For example, to specify selection criteria for the CUSTOMERS table using the primary command enter: SEL CUSTOMERS Alternatively, you can enter the line command, SEL, in the Cmd field next to the table name as shown in the following figure. (This figure assumes that four tables have been specified for the Access Definition GRP.USER.ADSAMPLE.)

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

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

Default Creator ID ===> PSTDEMO Start Table ===> CUSTOMERS Start Table Options : None

Table 1 of 4

<<MORE

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

User Manual

69

3. Specify Access Definitions The prompts for selection criteria are displayed: -- Specify Selection Criteria for AD: GRP.USER.ADSAMPLE ------------------Command ===> Scroll ===> CSR Table Name: PSTDEMO.CUSTOMERS Combine All Column Criteria by ===> A

Col 1 of 9

<<MORE

(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 Panel Fields

The fields on the panel are: Table Name

The name of the current table or view.

Combine All Column Criteria by

Specifies the logical operator to apply to the column criteria.

Cmd

A

All criteria are logically ANDed. Default.

O

All criteria are logically ORed.

Line command entry field. The supported line commands include: M or MM A or B Z

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

The names cannot be edited and columns can not be inserted or deleted on this display. By default, the columns are listed initially in the order in which they were specified to DB2. Use the Move line command to rearrange the order for Point-and-Shoot. The order has no impact on data selection or sort sequence.

70

Move for DB2

3. Specify Access Definitions Column Name

The name of the column. All columns in the table are listed. Notation is displayed to the right of the Table Name indicating the relative position of the first displayed column name within the list. This notation is displayed as Col x of y where x represents the relative position of the first displayed column and y the total number of columns in the list.

Selection Criteria

Specifies the selection criteria for each column. Any valid SQL predicate is allowed. Valid Operators = > <

<> >= <=

IN (a,b,c,d...) IS NULL LIKE BETWEEN x AND y

Specifying the Criteria

User Manual

¬= ¬> ¬< NOT IN (a,b,c,d...) IS NOT NULL NOT LIKE MPT BETWEEN x AND y

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

71

3. Specify Access Definitions The following figure displays the selection criteria to obtain customers who satisfy both conditions.

-- Specify Selection Criteria for AD: GRP.USER.ADSAMPLE ------------------Command ===> Scroll ===> CSR Table Name: PSTDEMO.CUSTOMERS Combine All Column Criteria by ==> A

1 of 9

<<MORE

(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 Available Commands

The primary commands available on the Specify Selection Criteria for AD panel include: BOTTOM BROWSE CANCEL CAPS

COLUMNS DOWN END LEFT

OPTIONS RESET SAVE SQL

TOP UP ZOOM

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 column specifications for the selected table. These specifications apply to the Point-and-Shoot session only and do not affect the Extract Process. Use the COL command on the Select Tables/Views for AD panel or the Specify Selection Criteria for AD panel. You can also scroll the Specify Selection Criteria for AD panel left.

72

Move for DB2

3. Specify Access Definitions 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-- -HeadingCmd 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 Panel Fields

The information on this portion of the panel is used for a Point-andShoot or browse session to determine how data is displayed. In addition to the Cmd field and the Column Name field, the panel includes: Disp

Specifies whether the column is included or omitted when the Access Definition is used for Point-andShoot. Use the DISPLAY command to set all columns 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 display only or can be modified using Access for DB2. If Access for DB2 is not installed, this field is not displayed. Regardless, it has no impact on MOVE processing. For information about this field see the Access for DB2 User Manual.

Sort

Specifies the sort criteria for displaying the data for a Point-and-Shoot session. If values are not specified, the order in which rows are displayed is undetermined. Columns used to sort the data do not have to be assigned a DISP value of Y. Sort specifications are composed of two values: Lvl

User Manual

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

73

3. Specify Access Definitions specifying the highest sort priority. The Lvl fields must contain unique and consecutive values starting with 1. A/D Heading

Specify sort direction as (A)scending, the default, or (D)escending.

Specifies the heading to be displayed with the column and the position of the heading when the data is displayed for Point-and-Shoot browsing. Valid heading values are: N L

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

The position of the heading is determined in relation to the width of the data for a column. When the width of the data exceeds the width of the heading, this value positions the heading. However, if the width of the heading exceeds the width of the data, the data is positioned based on this value. The valid values for the heading position are: L R C

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

The display position of the data within the data field depends on the data type. Character data is left-justified and numeric data is right-justified. Data Type

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

Field Format

VARCHAR LONG VARCHAR FLOAT 4 byte length FLOAT 8 byte length

VARCHR LVARCHR SINGLE FLOAT DOUBLE FLOAT

This field is for display only. Null

Indicates whether the column is nullable. This field is for display only. The possible values are: YES NO

74

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

Move for DB2

3. Specify Access Definitions Crit

Indicates whether selection criteria have been specified on the Selection Criteria for AD panel. The possible values are: YES NO

Criteria have been specified. Criteria have not been specified.

This field is for display only. Available Commands

The primary commands available on the Describe Columns for AD panel include: BOTTOM BROWSE CANCEL CAPS

COLUMNS DOWN END OPTIONS

RESET RIGHT SAVE SQL

TOP UP ZOOM

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 rather than scrolling left and right to complete the specifications, use the ZOOM command. This command toggles between displaying the information on two panelsDescribe Columns for AD and Specify Selection Criteriaand a one-panel single column display. ZOOM can be assigned to a program function key. Zoom Line Command

User Manual

The Zoom line command can also be used to zoom the display for a specific column by entering Z in the Cmd field of the column on the Describe Columns for AD or the Specify Selection Criteria for AD panels. Use the ZOOM primary command to return to the column list display.

75

3. Specify Access Definitions The zoomed display is shown in the following figure: -- Describe Columns for AD: GRP.USER.ADSAMPLE ----------------------------Command ===> Scroll ===> CSR Table Name: PSTDEMO.CUSTOMERS Combine All Column Criteria by Column Name Data Type Updatable by DB2

Col 1 of 9 ==> A

(A-AND, O-OR)

: CUST_ID : CHAR(5) : YES

Display This Column Sort Level Ascending or Descending Column Heading Position Column Heading Access Rights Criteria ===>

===> ===> ===> ===> ===> ===>

Y __ _ C L S

NOT NULL

(Y-Yes, N-No) (1-64 or blank) (A, D or blank) (L-Left, R-Right, C-Center) (L-Use Label, N-Use Name) (S-Select, U-Update)

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 the relative position of the currently displayed column and the total number of columns in the table. The prompt for Access Rights is only displayed when Access for DB2 is available. Although Combine All Column Criteria is displayed with each column in zoom mode, it is a global setting and applies to the entire table. Modifying the value when any column is displayed modifies the value for the table. Available Commands

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

3.4.4 SQL WHERE Clause Specification Sometimes the column selection criteria can not be adequately specified on the Specify Selection Criteria for AD panel. For example, it may be necessary to specify a combination of OR and AND logical operators. For those situations, use the SQL WHERE Clause panel to specify the WHERE clause for the SQL SELECT statement. SQL Primary Command

76

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

Move for DB2

3. Specify Access Definitions Columns for AD panels, enter the SQL primary command with no operands to display the panel for the current table. SQL Line Command

You can display the SQL WHERE Clause panel for a specific table on the Select Tables/Views for AD panel by typing SQL in the Cmd field 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 WHERE Cmd 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 FROM heading near the top of the panel. This heading includes an ellipsis, ..., following SELECT to indicate the column list will include all columns because, generally, the list is too long to provide in the allocated space. Correlation Name

To simplify entering the table name in the SQL WHERE clause, you can specify a 1–18 character string for the prompt Correlation Name and substitute that string for the fully qualified table name in the FROM clause. This is especially useful for qualifying a column name when there are multiple tables referenced in the SQL.

Data area

Specify the desired SQL in the data area of the panel. The data area displays the SQL in segments of six lines containing 72 positions. A maximum of 200 lines is available for specifying the SQL and selfdocumenting comments. Standard DB2 conventions apply to comments; each line must begin with two hyphens (--). This area is scrollable. Notation in the upper right above the data area indicates the total number of lines and the relative position of the first displayed line.

Editing SQL WHERE Clause

User Manual

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

77

3. Specify Access Definitions

78

Move for DB2

3. Specify Access Definitions Several functions can be performed using line commands. The functions and the line commands are: Copy Insert Repeat

Cn, CC In Rn, RR

Delete Move

Dn, DD Mn, MM

For Copy and Move, use A or B to indicate the destination. When you type the data, all leading and trailing spaces on each line are maintained. Only the trailing spaces at the end of the last line of the SQL WHERE clause are deleted. LIST COLUMNS

You can display a list of columns in the table using the LIST COLUMNS primary command. This list can be scrolled and selections can be made directly from this list using the Select line command. When a column is selected, it is added to the end of the current SQL WHERE clause text.

SQLEDIT

You can use the SQLEDIT command to invoke an ISPF edit session for the current SQL WHERE clause. All of the standard ISPF facilities are available. You can use the ISPF COPY command to insert data from a file and edit as desired. When you terminate the ISPF session using END, the Enter an SQL WHERE Clause for a Table or View panel is redisplayed. The edited data is inserted into the panel.

Delete WHERE Clause

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

Available Commands

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. Specification Complete

After you have completed specifying the SQL WHERE clause, use END to save the current specifications and terminate editing. Use the SAVE command to save the current specifications and continue editing. You may want to use SAVE periodically to validate the 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 be acceptable to DB2. In either case, a message is displayed detailing

User Manual

79

3. Specify Access Definitions the error. Errors must be resolved before you can save the SQL WHERE clause and exit this panel. When the SQL WHERE Clause is valid, the panel that was previously displayed is redisplayed. When the Select Tables/Views for AD panel is redisplayed, the Status field in the panel will contain SQL to indicate that an SQL WHERE clause has been specified for the selected table. In the following figure, an SQL WHERE clause has been specified for the ORDERS table.

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

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

Default Creator ID ===> PSTDEMO Start Table ===> CUSTOMERS Start Table Options : None Cmd --*** ___ ___ ___ ___ ***

Table 1 of 4

<<MORE

R D --Extract Parms-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 Selection Criteria and SQL WHERE Clause

When selection criteria has been specified on both the Specify Selection Criteria for AD panel and the SQL WHERE Clause panel, the two are logically ANDed. The presence of both is indicated by SEL/SQL in the Status field of the Select Tables/Views for AD panel.

Archive Criteria

Archive criteria determine the columns that are indexed in the PST Directory and limit the set of rows archived from each table. Archive criteria can be specified for one or more columns and are combined with selection and other criteria in an Archive Process. This command is only available if Archive for DB2 is installed.

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

80

Move for DB2

3. Specify Access Definitions criteria has been specified. However, if the default column settings have not been modified and selection criteria has not been specified, COL and SEL are not displayed in the Status field. In the following figure, column specifications and selection criteria have been defined for the CUSTOMERS table.

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

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

Default Creator ID ===> PSTDEMO Start Table ===> CUSTOMERS Start Table Options : None Cmd --*** ___ ___ ___ ___ ***

Table 1 of 4

<<MORE

R D --Extract Parms-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

User Manual

81

3. Specify Access Definitions

3.5 Using the Point-and-Shoot Facility MOVE provides the Point-and-Shoot facility to enable you to select specific rows from the Start Table. These selected rows are used to start an Extract Process. If selection criteria have also been defined for the Start Table, you can specify whether the Point-and-Shoot list overrides the criteria or is used to supplement the selection criteria. (The Extract Parameter, Every Nth, is always ignored if a Point-andShoot list is used.) Primary Key

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

Value Stored

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

Permanent or Temporary

The Point-and-Shoot facility can be invoked from the Select Tables/Views for AD panel when defining an Access Definition or when specifying an Extract Process. Specifications made while defining an Access Definition must be permanent so they can be used in a future Extract Process request. The Point-and-Shoot specifications made when defining an Extract Process can be stored permanently or used only for the current request. A temporary Row List can be specified for the current Extract Process only through the TABLES option on the Extract Process menu.

82

Move for DB2

3. Specify Access Definitions POINT Command

Use the POINT command on the Select Tables/Views for AD panel to invoke the Point-and-Shoot facility. MOVE prompts for the name of an Input DSN. The Input DSN is a data set that contains previously specified primary key values for the Start Table.

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

COL, SEL, SQL, REL, POINT, GROUP, GET TABLES RELATED, INDENT, ARC 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 Panel Field

The field on the panel is: Input DSN

The Input DSN. If this is a new Access Definition or an Input DSN has not been previously specified for this Access Definition, the field is blank. You can use a previously saved row list by specifying the name of an input data set containing the row list to be used. If an Input DSN has been previously specified for the selected Access Definition, the name is supplied by MOVE. Overtype the name to use another Input DSN. To stop using the named input data set, erase the field.

How the values in the Input DSN field are handled is based on whether 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 previously selected rows are identified on the display. If the Input DSN field is blank, there are no

User Manual

83

3. Specify Access Definitions previous selections. END

The display returns to the Select Tables/Views for AD panel. If an Input DSN is supplied, the primary key values in the named input data set are to be used. Thus, you can use the primary key values from an existing input data set without entering a Point-and-Shoot session. If the Input DSN field is blank, there are no primary key values to be used. You can erase the Input DSN name and use END to drop a previously specified Input DSN. This does not delete the data set, but discontinues its use for this Access Definition.

CANCEL

Intervening Changes

The display returns to the Select Tables/Views for AD panel and any data entered on the prompt is disregarded.

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

Press ENTER to proceed.



Use END to remove non-matching rows from the Point-and-Shoot file.



Enter the CANCEL command to terminate the Point-and-Shoot session without modifying the file.

The following sections discuss the facilities that are available during a Point-and-Shoot session. For more information about the primary and line commands discussed in these sections, see the Relational Tools Command Reference Manual.

84

Move for DB2

3. Specify Access Definitions

3.5.1 Initial Display for Point-and-Shoot The initial display for a Point-and-Shoot session is determined by the Start Table defined on the Select Tables/Views for AD panel, any selection criteria that have been defined for the Start Table, and the Begin Table Display With field on the Access Definition Parameters panel. The following options are available for the Begin Table Display With field (see Figure 89. Access Definition Parameters). D

Data Begin with data from the named Start Table and all subsequent tables. This is the default. If selection criteria and an SQL WHERE Clause have been specified, they are used to limit the data display. For example, if you defined selection criteria to select only the customers in the state of Massachusetts, only those customers are displayed in the Point-and-Shoot session.

S

Criteria for Start Table Only Begin with a selection criteria prompt for the named Start Table. All other tables begin with the data display.

A

Criteria for All Tables Display the selection criteria prompt for the named Start Table and for each table added to the display via the JOIN command before displaying the data for that table during a Point-and-Shoot session.

SELECTION CRITERIA Command

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

Selection Criteria Prompt

The Specify Selection Criteria for Table panel is displayed to prompt for selection criteria. All of the facilities for the Specify Selection Criteria for AD panel when defining an Access Definition are available. (For details on this panel see Section 3.4 Specifying Criteria.) After specifying the desired selection criteria, use ENTER or END to display the data. If the selection criteria for the Start Table are changed such that the set of rows in the Point-and-Shoot file are not appropriate, MOVE will prompt you to specify whether to continue with the session or to retain or discard the previously selected rows.

User Manual

85

3. Specify Access Definitions

3.5.2 Point-and-Shoot Basics A Point-and-Shoot session is very similar to an ISPF/PDF browse session. However, the ability to select specific rows (and therefore the primary key values) while browsing DB2 data requires additional screen elements and facilities. This section discusses Point-and-Shoot screen elements, commands, and display modes. Display Format

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

CUST_ID ------07053 07101 07103

CUSTNAME -------------------Replay Video Movie Mania Video Edge

ADDRESS ==================== 9032 Dickerson St 571 Front St 400 Pittsfield Rd

CITY STATE ------------ ----Amherst MA Auburn MA Lenox MA

In sidelabels format, the column headings are displayed down the left side 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 are displayed for that row:

CUST_ID CUSTNAME ADDRESS CITY STATE ZIP YTD_SALES SALESMAN_ID PHONE_NUMBER

: : : : : : : : :

07053 Replay Video 9032 Dickerson St Amherst MA 01002 123.00 RP0013 5171234567

You can toggle between the two display formats by using the SIDELABELS primary command or the SID line command. Most of the screen examples throughout this manual are shown in columnar format.

86

Move for DB2

3. Specify Access Definitions 3.5.2.1 Screen Elements The screen elements provided by columnar and sidelabels format are the same; only the positioning is different. Columnar Format

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

------------------ 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 ------- -------------------- ==================== ------------ ----*** ********************************** 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 Sidelabels Format

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

------------------ Relational Tools: Point-and-Shoot -------- 3 ROWS SELECTED Command ===> Scroll ===> CSR == Table: PSTDEMO.CUSTOMERS(T1) ================== ROW == LineCmd ==> ___ Row Status: S COLUMN CUST_ID CUSTNAME ADDRESS CITY STATE ZIP YTD_SALES SALESMAN_ID PHONE_NUMBER

: : = : : : : : :

1 OF 20 ======== 1 OF 9

07053 Replay Video 9032 Dickerson St Amherst MA 01002 123.00 RP0013 5171234567

Figure 38. Sidelabels Screen Elements

User Manual

87

3. Specify Access Definitions These elements are:

88

Column Headings

By default, the DB2 column names are displayed as the column headings. You can specify that the DB2 column labels are to be used on the Describe Columns panel. (See Section 3.4 Specifying Criteria)

Line Command Field

Line command entry field.

Status Flag Field

Status flag field identifies which rows have been selected by displaying an S in this field for each selected row. In Figure 37. Columnar Screen Elements, three rows have been selected.

Table Name

The name of the table or view, including the Creator ID, currently displayed. The table name may be truncated if the combined length of the Creator ID and table name exceeds 22 characters.

Short Name

A short name or identifier for each table (Tn) or view (Vn), where n uniquely identifies the table or view. For example, in a multi-table display, T1 identifies the first table, T2 the second table, and so on. The Tn or Vn value can be used as a command operand in place of the table name.

Truncated Column Indicator

In columnar format, the maximum display width of columns can be in the range of 15 to 70 characters. In sidelabels format, the maximum display width can be in the range of 50 to 32767. These values are controlled by editor options and apply to all displayed columns. When the width of a column exceeds this value, the data from that column is truncated. In columnar format, this is indicated by equal signs, =, underlining the column heading. In sidelabels format, an equal sign is displayed to the right of the column heading. The complete data in these columns can be displayed using the EXPAND command (see page 98 for details).

Row Count

Indicates the current position within the total set of rows. The total row count includes the line the 'Excluded Lines' message is on but

Move for DB2

3. Specify Access Definitions not the excluded lines themselves. Horizontal Scroll Indicator

(Displayed in columnar format only.) Indicates that more data is displayed to the left, <<MORE, or right, MORE>>. Use the LEFT and RIGHT commands, usually assigned to PF10 and PF11, to scroll the display horizontally. (For more information on scrolling see Section 3.5.4 Scrolling Data.)

Column Count

Displayed in sidelabels format only. Indicates the current position within the total set of columns.

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

When the number of rows to be displayed exceeds the available number of lines on the screen, the rows can be scrolled vertically using the UP and DOWN commands (usually assigned to PF7 and PF8). When all of the columns do not fit on the screen, the display can be scrolled horizontally using the RIGHT and LEFT commands (usually assigned to PF10 and PF11). These commands perform the same functions in both columnar and sidelabels format. In columnar format, sufficient screen space must be available to accommodate the display width of a column. When the specified display width of the column exceeds the available space, the column is not displayed on the current screen. Scroll left or right as appropriate. For example, if the display width of a column is 20 characters but only 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 columns may be displayed.

COUNT Command

When the Maximum Fetch Limit is less than the total number of rows that satisfy the criteria, a message displays indicating that all possible rows have not been retrieved. You can use the COUNT command to display the total number of rows in a named table that satisfies the search criteria. You can respecify the selection criteria to retrieve fewer rows.

MAX ROWS Command

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

User Manual

89

3. Specify Access Definitions rows, and the COUNT command shows that there are 300 rows that satisfy the criteria, you can use the MAX ROWS command to change the Maximum Fetch Limit to 300. Specify MAX ROWS 300 and refetch. This command only affects the current session. To increase the maximum number of fetch rows for all of your sessions, use the Maximum Fetch Rows option on the Editor and Display Options panel. 3.5.2.2 Displaying Column Attributes When selecting rows to be extracted, it may be helpful to display the attributes of the columns. During a Point-and-Shoot session, you can use the ATTRIBUTES command to specify whether column attributes are displayed. Alternatively, you can set the option Display Column Attributes on the Editor and Display Options panel. The column attributes 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 the data type and n.n is the length of the column. The presence of :N indicates nullability. To conserve space on the screen, certain data types are abbreviated. The data type indicators and the DB2 data types that they represent are listed below.

90

Indicator

DB2 Data Type

CH VCH LVR DEC INT SMALLINT DATE TIME TIMESTAMP SNGL FLOAT DBL FLOAT

CHAR VARCHAR LONG VARCHAR DECIMAL INTEGER SMALLINT DATE TIME TIMESTAMP SINGLE FLOAT DOUBLE FLOAT

Move for DB2

3. Specify Access Definitions When the attributes mode is activated, attributes are displayed regardless of the display mode in effect (columnar, sidelabels, or hex mode). To remove the column attributes from the display, use the ATTRIBUTES OFF command or use the ATTRIBUTES command with no operand to toggle between displaying and not displaying column attributes. 3.5.2.3 Available Commands Both primary and line commands are available. Many of these commands are introduced in the following sections. Detailed information about each command is provided in the Relational Tools Command Reference Manual. Primary Commands

The following is a list of primary commands available during a Pointand-Shoot session. ANCHOR ATTRIBUTES BOTTOM CANCEL CAPS COLUMNS COUNT DOWN END EXCLUDE EXPAND FIND HEX

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 when using sidelabels format. Line Commands

User Manual

The following line commands are available during a Point-and-Shoot session. Function

Line Command

Exclude First Join Last Select Related Show Sidelabels Unselect Related Unjoin

X, Xn, XX F, Fn J L, Ln SR, SSR S, SS SID UR, UUR UNJ

91

3. Specify Access Definitions Zoom

Z

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

3.5.3 Selecting Rows Rows are selected from the Start Table using the Select Related line commands or the SELECT RELATED primary command. For example, in the following figure rows are selected by specifying the SR and SSR line commands. ------------------- 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 ------- -------------------- ==================== ------------ ----*** *********************************** TOP ******************************** ___ S 07053 Replay Video 9032 Dickerson St Amherst MA sr_ 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 ssr 07126 Movie Rentals 101 Munson St Greenfield MA ___ 07140 Showcase 1150 Indiana Terr Beverly MA ___ 07141 Showcase II 57 Rock Hollow Salem MA ssr 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 primary command. For example, to select all customers in the city of Amherst, the command can be entered as: SELECT RELATED IN CITY ALL AMHERST Individual rows that have been selected can be unselected using the Unselect Related line command or the UNSELECT RELATED primary command. In the following figure, the last selected row, Reely Great Videos is unselected.

92

Move for DB2

3. Specify Access Definitions

------------------- Relational Tools: Point-and-Shoot -------- 8 ROWS SELECTED Command ===> 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 UR_ 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 the Extract Process will also be extracted if the related Start Table row is extracted.

3.5.4 Scrolling Data Several commands are available to scroll the data. You can scroll vertically when the number of rows to display exceeds the number of lines available on the screen. You can scroll horizontally when the width of the data exceeds the width of the screen. 3.5.4.1 Vertical Scrolling The scrolling commands UP, DOWN, TOP, and BOTTOM may be entered 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 identically to vertical scrolling in ISPF. Scrolling a multi-table display is discussed 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 may not all fit on the screen. When the combined width of the columns exceeds the width of the screen, the scroll indicator, MORE and an appropriate direction arrow, are displayed on the information line for the table.

User Manual

93

3. Specify Access Definitions You can scroll horizontally using LEFT and RIGHT to display the remaining columns. Operands for these commands enable you to scroll by column name, numeric value, or cursor position. When multiple tables are displayed, indicate which table to scroll by specifying a table name or identifier with the column name (for example, T2.CUST_ID) or by cursor position. If a table is not indicated, 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 specified columns on the screen when scrolling left and right. The LOCK command repositions the named column to the left of the screen and retains the column in that position when a horizontal scroll is performed. Multiple columns may be locked. The UNLOCK command unlocks the named locked column and returns it to the original position. For example, assume that the combined width of the displayed column data for the CUSTOMERS table exceeds the width of the screen, therefore the display must be scrolled left and right to view all of the data. By locking the column named CUSTNAME, the remaining columns in the CUSTOMERS table can be scrolled left or right, but CUSTNAME will always remain on the screen. Assume that the LOCK command has been entered to retain the CUSTNAME column on the display. The column is repositioned to the left of the display and is retained in that position regardless of left and 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

94

Move for DB2

3. Specify Access Definitions Identifying Locked Columns

The locked column is identified by a series of plus signs, +, under the column heading. The first locked column is placed in the left-most position. Each succeeding locked column is positioned to the right of the previously locked columns. When the length of a column exceeds the maximum column display width, that column is indicated by equal signs, =, under the column heading. If that column is also locked, it is identified by a series of dots under the column heading to distinguish it from the locked columns that are not truncated. (For more information on handling this truncated data, see Section 3.5.7 Expanding Truncated Data.)

Locking Multiple Columns

Any series of columns may be locked as long as enough space remains to display the widest column that is not locked yet in addition to the locked columns. The reserved area is determined by the user-defined maximum display width for any column. For example, if the userdefined maximum display width is 20 characters, then the right-most 21 character positions on the screen are reserved for unlocked columns. This ensures that at least one unlocked column is always displayed. More columns may be displayed if they fit, in their entirety, in the remaining area. Use LOCK KEY to lock all of the columns that compose the primary key in a single command execution.

Unlocking Columns

The UNLOCK command with no operands unlocks all of the locked columns. Specify the name of the column with the command to unlock only that column. If it is desirable to rearrange the display order of the columns, use the COLUMNS command to modify the column display attributes. The COLUMNS 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 to exclude some of those rows from the display leaving a more manageable set. The EXCLUDE primary command and the Exclude line commands can be used to remove any lines from the display. These rows are retained in the table, but are not displayed. In the following figure the Exclude line command is used.

User Manual

95

3. Specify Access Definitions

------------------- 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 ********************************** ___ 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 xx_ S 07156 Prime Tyme 982 Upper State St Marion MA ___ 07160 Reely Great Videos 590 Frontage Rd Amherst MA xx_ 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 location and number of excluded rows.

-------------------- Relational Tools: Point-and-Shoot ------ 7 ROWS SELECTED Command ===> 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. The excluded lines message counts as one line. The EXCLUDE primary command can be used to exclude rows globally based on a variety of criteria. The excluded rows can be redisplayed with the SHOW primary command or the Show (S), First (F), or Last (L) line commands.

96

Move for DB2

3. Specify Access Definitions

3.5.6 Finding Specific Data The FIND command and the ONLY command are available to locate specific data. FIND Command

The FIND command locates a row containing a specified value and positions 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 searched table. In a multiple table display, any lower level tables that are displayed are automatically scrolled appropriately. A variety of operands are available for the FIND command to specify where the search should begin and whether the search should include excluded rows. The FIND command is similar to the ISPF FIND command. However, the MOVE FIND command has been extended to support DB2 data. For example, to locate the first occurrence of the string MA in the STATE column, enter: FIND FIRST MA IN STATE If the column name is omitted, all columns with an appropriate data type as the search string are searched. A table name should be entered if the column name is present in more than one displayed table. 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 in apostrophes 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 search string includes quotation marks, use apostrophes as in 'M"A'.

FIND ALL

The FIND ALL command is useful when issued after excluding all rows, to display all occurrences of the specified character string. For example, to display all rows containing "AMHERST" specify: EXCLUDE ALL FIND ALL AMHERST

ONLY Command

The only command provides in one command the results obtained from executing EXCLUDE ALL followed by FIND ALL. For example, to display all rows containing "AMHERST" specify: ONLY AMHERST You can limit the search to a specific column. For example, to limit the search to the CITY column specify: ONLY AMHERST IN CITY

User Manual

97

3. Specify Access Definitions As with EXCLUDE and FIND, use the SHOW command to display excluded rows.

3.5.7 Expanding Truncated Data When the actual column width exceeds the user-specified maximum column display width, the data in that column is truncated. Such columns are identified by a series of equal signs, =, under the column heading or, in sidelabels format, by an equal sign to the right of the column name. For example, the ADDRESS column is defined to DB2 as 50 characters. This exceeds the maximum display width of 20 characters defined in the editor options. To display all of the data in the column, you can change the column display width or expand the column. The maximum column display width can be changed on the Editor and Display Options panel. The maximum display width must be greater than or equal to 15 and less than or equal to 70 characters for columnar display. (The value specified for sidelabels display must be greater than or equal to 50 and less than or equal to 32767.) Use the OPTIONS EDITOR command to display the Editor and Display Options panel. When the maximum width does not provide sufficient display space for a specific column or changing the maximum display width is undesirable, the EXPAND primary command can be used to display all of the data in that column. This command can be used on data types of CHAR, VARCHAR, and LONG VARCHAR, even if the length of the data does not exceed the maximum display width. This command can be used on data types of TIMESTAMP and DECIMAL only if the data exceeds the maximum display width.

------------------- Relational Tools: Point-and-Shoot ------- 7 ROWS SELECTED Command ===> 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

98

Move for DB2

3. Specify Access Definitions The EXPAND command is cursor sensitive. You can type the EXPAND command on the command line as shown above, position the cursor to the column in the row to be expanded, and press ENTER. You can also assign EXPAND to a program function key. If the EXPAND command is entered in the command field and the cursor is positioned on the ADDRESS column of the customer named Video Way, the following pop-up is displayed.

------------------ Relational Tools: Point-and-Shoot --------- 7 ROWS SELECTED Command ===> 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 top borderline. The row count indicator is also displayed. Scrolling

When the column length exceeds the width of the expanded display, 66 characters, the data can be scrolled horizontally using the LEFT and RIGHT commands. The starting and ending column positions currently displayed are indicated on the bottom border of the window. The following line commands can be used to scroll left and right: >nn +nn
Scroll right nn spaces Scroll right nn spaces. Scroll left nn spaces Scroll left nn spaces

Use the UP and DOWN commands to scroll the data in the expanded window by row. The row counter displayed on the top border of the window indicates which row is currently displayed. When you have finished viewing the expanded data, use END to terminate the expanded display.

User Manual

99

3. Specify Access Definitions

3.5.8 Displaying Hexadecimal Data Under certain circumstances, you may find it necessary to display the hexadecimal (or hex) value of data. Use the HEX primary command to display each line of data in the standard text format and its hexadecimal representation. Note that the hexadecimal representation is displayed only for character data type columns. The hex display remains in effect until explicitly terminated by specifying HEX again. When data is displayed in hex mode, each row of data uses three lines on 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 EBCDIC character are displayed directly under that character, as shown in the following 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 in standard display mode are available in hex mode. Some commands, such as the FIND command, have operands specifically for hex mode. FIND Command

To locate a specific hex value anywhere in the data, use the FIND command with the HEX operand. This is useful when you want to locate a non-displayable value. For example, to locate the first occurrence of the hex value 00, enter FIND HEX 00. To locate the next occurrence of the search value, 00 in this case, use the RFIND command (usually assigned to PF5).

100

Move for DB2

3. Specify Access Definitions Trailing Blanks and Nulls

Trailing blanks in CHAR columns are stored in the database as blanks. They are displayed in hex mode as the hex value 40. Trailing blanks in VARCHAR columns are not stored in the database. They are 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 the standard columnar format. The sidelabels format displays column headings vertically at the left of the panel, followed by the data for each column. Generally, this format displays more columns per panel and more data per row. However, only a single row in a single table is displayed at one time. You can change from columnar format to sidelabels format by entering the SIDELABELS primary command, SID line command, or by specifying sidelabels format on the Editor and Display Options panel. The SIDELABELS command acts as a toggle between the two display formats. Once you specify sidelabels format, whether by the command or from the options panel, it remains in effect until you respecify the format. A sample sidelabels display is shown in the following figure.

------------------ 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_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 SHIP_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 the previous or next row in the table. When all of the columns in the row do not fit on a single screen, use LEFT or RIGHT (usually assigned to PF10 and PF11) to scroll up or down to display the remaining columns in the same row.

User Manual

101

3. Specify Access Definitions Locking a Column

You can lock one or more columns using the LOCK command. The locked columns are positioned to the beginning of the display and remain in that position when the display is scrolled. For example, if LOCK SHIP_UPDATED is entered on the command line, the SHIP_UPDATED column is positioned to the beginning of the display and is marked with a plus sign, +, as shown in the following figure.

-------------------- 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 locked columns. Specify the name of a column with the command to unlock only that column. 3.5.9.2 Displaying Wide Data When the maximum display width permits, wide rows are automatically wrapped for the width of the column. For example, in Figure 48. Sidelabels Display, the ORDER_SHIP_INSTR column contains more characters than fit on one line. The data is divided into 50-character segments and presented on multiple lines. Although, the column ORDER_SHIP_INSTR is 254 characters long, only 100 characters (the maximum display width in this example), are displayed. The truncated data indicator, =, is shown. Column Display Width Option

102

The maximum column display width is specified by the Sidelabels Max Display Width option on the Editor and Display Options panel. You can use the OPTIONS EDITOR command to display this panel. The minimum is 50 characters; the maximum is 32767 characters.

Move for DB2

3. Specify Access Definitions Assuming the maximum display width value is changed to 254, the data in the ORDER_SHIP_INSTR column is no longer truncated as indicated by the colon replacing the equal sign in the following figure.

--------------------- 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_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 (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 and continues, in 50-character segments, on the next five lines. The beginning and ending character positions of each segment are displayed under the column heading. For VARCHAR columns, the entire column is displayed regardless of the actual length of the data. However, when a table has several wide columns that do not contain correspondingly long data, you may prefer to decrease the maximum display width so that more columns from the table are displayed per screen. EXPAND Command

User Manual

Instead of changing the maximum display width to display all of the data in the column, you can use the EXPAND command to display the column in an expanded window. Type the EXPAND command at the command prompt, place the cursor anywhere in the column to be expanded, and press ENTER.

103

3. Specify Access Definitions The displayed data is dependent upon the cursor location when the command is entered. In the following example, the cursor was positioned at the beginning of the first line of data in the column or in the column name field of the column ORDER_SHIP_INSTR when the EXPAND command was entered.

-------------------- 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_ID : 106 SHIP_INSTR_ID : 10013 ORDER_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 the column, the expanded display begins with the data on that line. For example, if the cursor is positioned on the second line of a wrapped column, the expanded display starts at position 51. When the width of the column exceeds the width of the window, the beginning and ending position of the expanded data is displayed on the bottom of the expanded window. Use RIGHT and LEFT to scroll the data within the column. Use the UP and DOWN commands to scroll the data in the expanded window by row. The row counter on the top border of the window indicates 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 are available during sidelabels. However, several differences should be noted.

104

Move for DB2

3. Specify Access Definitions ATTRIBUTES Command

When the ATTRIBUTES command is used, the column attributes are displayed to the left of the column names. When there is insufficient space available to display both the attributes and the full column names, column names are truncated.

------------------ 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 SMALLINT:N SHIP_ID : 106 DEC(5,0):N SHIP_INSTR_ID : 10013 VCH(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 Displaying Column Attributes. Line Commands

The line commands available in columnar format are available in sidelabels format. However, since only a single row is displayed at a time in sidelabels format, some line commands are better suited for standard columnar format.

Join Restricted

You cannot issue the JOIN command while in sidelabels format, since this format accommodates one table at a time. However, if multiple tables are already joined in columnar format, you can specify any joined table as the target of the SIDELABELS command. If the table name is omitted, the lowest level table is displayed in sidelabels format. You can specify the table name or short name (for example, T1). During the sidelabels display, the joined tables are retained and redisplayed when you return to columnar format.

Zoom

You can display any currently joined table using the ZOOM command from the sidelabels display.

User Manual

105

3. Specify Access Definitions

3.5.10 Joining Tables The Point-and-Shoot session begins with the specified set of rows from the table defined as the Start Table. Additional tables in the Access Definition may be added to the display through a join operation. The currently displayed table, or anchor table, is joined to a related table and the related rows from that table are displayed. Data from the newly joined table is displayed at the bottom of the screen. This table is referred to as the lowest level displayed table. A join is always performed with the lowest level displayed table. Join Requirements

To perform a join, MOVE requires the name of the table to join and a relationship between the named table and the anchor table. The relationship may be defined in the DB2 Catalog or in the Princeton Softech Directory. When joining tables, it does not matter which table is the parent and which is the child. You can join from the parent to the child or from the child to the parent.

JOIN Command

The JOIN primary command or the Join line command is used to join tables. You can specify a table name with the JOIN command or omit the table name to generate a selection list of related tables in the Access Definition.

3.5.10.1 One Related Table When the Access Definition contains only one table that is related to the anchor table, you can enter the JOIN command with or without that table name to automatically join to that table. For example, if an Access Definition contains the CUSTOMERS table and the ORDERS table and these two tables are related, a join can be performed to include the ORDERS table on the display.

106

Move for DB2

3. Specify Access Definitions In the following figure, the JOIN ORDERS command is entered on the command line and the cursor is positioned on the row for CUST_ID 07118. The JOIN command could also have been entered without the table name.

------------------- Relational Tools: Point-and-Shoot -------- 7 ROWS SELECTED Command ===> 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 MA n __ 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 the CUSTOMERS and ORDERS tables. The CUST_ID column is the primary key in the CUSTOMERS table and the related column in the ORDERS table.

User Manual

107

3. Specify Access Definitions When ENTER is pressed, the two tables are joined as shown in the following figure. Since the join was specified for CUST_ID 07118, all of the rows in the ORDERS table having that CUST_ID are displayed:

------------------- Relational Tools: Point-and-Shoot -------- 7 ROWS SELECTED Command ===> 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 the related row in the Start Table has been selected. This example uses cursor position to indicate the row on which to perform the join. However, positioning the cursor is optional. If the cursor is not positioned on a specific row, the first displayed row in the CUSTOMERS table is assumed to be the anchor row. Assign JOIN to PF Key

108

For convenience, the JOIN command can be assigned to a function key. Then, you position the cursor on the desired anchor row and press the function key.

Move for DB2

3. Specify Access Definitions 3.5.10.2 Several Related Tables When there are several related tables in the Access Definition and you are 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 line command is used, a selection list of related tables is displayed.

------------------ 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 *** ___ ___ ___ J ___ ___ ___ ___ ___ ___ ___ ___ ___ ___ ___ ___ ___ ___ ___ ___ ***

********** +---------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 ******************** | MA 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 From column indicates whether the table is related to the anchor table by a DB2 or PST relationship, or both. The Type column indicates whether the table is a child or parent of the anchor table. Use the S line command to select a table. Press ENTER or use END to terminate the selection list. If only one relationship exists between the anchor table and the selected table, the tables are joined as shown in Figure 54. Join to Display Cycles

The selection list includes all related tables in the Access Definition even those tables currently displayed. This enables you to browse cycles during Point-and-Shoot.

Multi-way Joining

More than one table can be selected. For information about multiway joining see Section 3.5.12 Special Considerations for Multiway Joining.

User Manual

109

3. Specify Access Definitions 3.5.10.3 No Related Tables When there are no related tables in the Access Definition, a join cannot be performed during the Point-and-Shoot session. If you request a Join, MOVE displays a message. You can terminate the Point-and-Shoot session. Then, add tables to the Access Definition on the Select Tables/Views for AD panel and, if needed, create new relationships using the CREATE RELATIONSHIP command to display the prompts to create a relationship. After completing these additional specifications, start a new Point-and-Shoot session. 3.5.10.4 More than One Relationship There may be more than one relationship between the anchor table and the selected table to join. In this situation, the following prompt is displayed requesting you to select a relationship.

------------------- 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 *********************************** ___ 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 use END to terminate the selection list and display the joined tables as shown in Figure 54.

110

Move for DB2

3. Specify Access Definitions

3.5.11 Handling Multiple Tables As new tables are joined, the row on which the join is anchored is displayed along with the related data from the joined table. All displayed tables can be scrolled. Additional tables can be joined and unjoined. 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 the CUSTOMERS table and the DETAILS table has been joined to the ORDERS table. These tables are displayed as follows:

------------------ Relational Tools: Point-and-Shoot --------- 7 ROWS SELECTED Command ===> 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 the name of the table, the identifier supplied by MOVE, the relative row number and the total number of rows selected for display. The status flag field contains S for the lower level tables when the Start Table row is selected.

User Manual

111

3. Specify Access Definitions The TOP marker, before the first line, and the BOTTOM marker, after the last line, are displayed only for the lowest level table, the DETAILS table in the figure. These markers indicate the first and last selected rows of the table. Display Levels

The maximum number of tables or levels that can be displayed depends on the size of the physical screen being used. This maximum is computed by subtracting three header lines (title line, command line, and long message line) from the total number of lines on the screen, and then dividing that value by five (the minimum number of lines required for any table display). The result of this division, regardless of the remainder, is used as the maximum number of display levels for the current screen. When hexadecimal mode is activated (requiring three lines to represent each row of data), the maximum number of display levels for the current screen is reduced. Although the screen size limits the number of displayed levels, the join function itself is limited to 64 tables. When the screen cannot fit another table and a join is requested, the highest level table is removed from the display, and all lower level tables are repositioned to accommodate the newly joined table.

Changing Highest Display Levels

The START command can be used to change which table is currently displayed as the highest level table. This is useful when: •

Multiple tables are joined and you want to display more rows than are currently displayed from the lowest level table.



Changing from split screen to full screen processing and you want to display a higher level table in the additional space.

Any currently active table may be specified with the START command provided space is available to display at least one row from the current lowest level table. 3.5.11.2 Coordinated Scroll In a multiple table display, scrolling a table automatically scrolls the lower level joined tables. For example, scrolling the CUSTOMERS table automatically scrolls the ORDERS table to the orders for the displayed 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 or identifier on the command or by cursor position. For example, UP T2 causes the table identified as T2 to be scrolled backward. If the

112

Move for DB2

3. Specify Access Definitions cursor is not positioned in any window and no operands are given on the scroll command, the lowest level displayed table is scrolled. You can also scroll by positioning the cursor to a specific row in any of the tables and pressing one of the PF keys assigned to scroll. All lower 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 can be displayed during a multi-table display. The Zoom line command, Z, or the ZOOM primary command toggles from a multi-table display to a single table display without impacting the currently joined tables. Zoom Line Command

To switch a multi-table display to focus on a single table, the Zoom line command is entered in the Cmd field of a displayed row of the table to be zoomed. To return to a multi-table display, enter the Zoom line command in the Cmd field of any displayed row. The row on which the command is entered becomes the first row displayed for the table.

ZOOM Primary Command

The ZOOM primary command can be specified with the name of a table to change the display to a single table display including only the rows from the named table. The ZOOM command with no operands acts as a toggle between multi-table and single-table displays. The ZOOM command is cursor sensitive. Thus, if the cursor is in the window of a table, the table name operand is not necessary. In addition, if the cursor is positioned on a data line for that table, the zoom 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 in the zoomed display, when ZOOM is requested again, the line containing the cursor will be scrolled to the first position. If the cursor is not positioned on a data line, the first displayed row is assumed.

Impact on Joined Tables

User Manual

All joined tables are retained when zoom is used. The single-table zoomed display can be scrolled and edited. If the table is scrolled during a zoomed display, any lower level joined tables are logically scrolled. When the multi-table display is restored, the scrolled data is displayed.

113

3. Specify Access Definitions The following example uses ZOOM to change the display from a multi-table display to a display of the CUSTOMERS table. The primary command can be entered as ZOOM CUSTOMERS or ZOOM T1.

-------------------- Relational Tools: Point-and-Shoot ------- 7 ROWS SELECTED Command ===> 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 SELECTED Command ===> 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 was displayed when the zoom was requested. If the zoomed display is scrolled, the first currently displayed row will be the row displayed for the table when the multi-table display is redisplayed. Use the UNZOOM primary command to return to the multiple table display. Specify a row other than the first displayed row by cursor position. Also, you can use the Z line command. The row on which the cursor is positioned is scrolled to the top of the window for that table.

114

Move for DB2

3. Specify Access Definitions 3.5.11.4 Unjoining Tables The UNJOIN command severs the join between the tables and removes the unjoined tables from the display. The display is then adjusted to include additional lines from the new lowest level table if space is available. Any higher level table not currently displayed is repositioned at the top of the panel, in the order of lowest to highest, with each successive execution of the UNJOIN command. The UNJOIN command can be specified to sever the relationship between any two tables by positioning the cursor on the desired table, regardless of level, or by specifying that table as an operand. This also severs the relationships between all of the tables lower than the unjoin request table. All unjoined tables are removed from the display. The UNJoin line command can also be used. Type UNJ in the Cmd field of the highest level table to unjoin. All lower level tables are also unjoined.

3.5.12 Special Considerations for Multi-way Joining Most tables are related to more than one other table. When multiple tables are related, several navigational paths are available for joining when browsing the data. You may find it useful to display the related data obtained by traversing more than one of these paths. Use multiway joining to access more than one related table without losing any of the paths through the data. Consider the following example. A database contains the following related tables:

You can start a Point-and-Shoot session with CUSTOMERS and request a selection list of tables to join. The selection list displays ORDERS, SALES and SHIP_TO. You can select all of these tables. All selected tables are joined and active. Although all tables are active, only one table is displayed. The other tables are “hidden”.

User Manual

115

3. Specify Access Definitions When multiple tables are joined to a single table, the multiple tables are “stacked” in the order in which they were joined. The most recently joined table is on top of the second most recent, the second on top of the third and so on. The table on the top of the stack is displayed; the other tables are “hidden”. You can display any table from the stack. Stack handling is “wrapped”. For example, assume ORDERS, SALES, and SHIP_TO are joined to CUSTOMERS in that order. As each table is joined, it is placed at the top of the stack. Therefore, the stack contains: SHIP_TO SALES ORDERS The SHIP_TO table, the table at the top of the stack, is displayed. If you display SALES, SHIP_TO is placed at the bottom of the stack and SALES is pushed up. The order in the stack is: SALES ORDERS SHIP_TO Then, if ORDERS is displayed, SALES is placed at the bottom of the stack, and ORDERS is pushed up. ORDERS SHIP_TO SALES 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 are hidden 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. Joining to the Lowest Level

For example, assume only CUSTOMERS is displayed. It is the lowest level table. Three tables, ORDERS, SALES, and SHIP_TO, are related to CUSTOMERS. You can request a join either by the Join line command or by the JOIN primary command. More than one table is related to CUSTOMERS so the JOIN Selection List Prompt is displayed. The selection list for all related tables contains the three tables ORDERS, SALES, and SHIP_TO in that order. You can select any or all of the tables on the list. Assuming all three tables are selected, the SHIP-TO table, the last table on the selection list, is displayed. (The stack is created such that

116

Move for DB2

3. Specify Access Definitions the last selected table is on the top of the stack and the first selected table is on the bottom.) Joining to Another Level

You can stack multiple tables at any display level; therefore, you can request a join to a table other than the lowest level table. For example, assume ORDERS is the lowest level table and is the only table joined to CUSTOMERS. You can join a different table to CUSTOMERS without unjoining ORDERS. To join SHIP_TO to CUSTOMERS, 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 of possible tables to join at any level. For example, assume only ORDERS is joined to CUSTOMERS. To display a selection list to join additional tables to CUSTOMERS, specify: JOIN S% FROM CUSTOMERS All tables that begin with “S” are included on the list. You can select one or all listed tables. You can use the level indicator to specify the target for the FROM operand. For example, the CUSTOMERS table is assigned T1. You can 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 the command, you can position the cursor on the CUSTOMERS table and enter the JOIN command.

User Manual

117

3. Specify Access Definitions Example

In the following figure, multiple tables are joined to the CUSTOMERS table. 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 displayed child table is also scrolled. Sometimes when scrolling, the child table has no related rows to display. You can set the Editor and Display Option, AutoSwitch Mode, such that when the parent table is scrolled and the currently displayed child table has no related rows, AutoSwitch automatically displays the first child table in the stack that has at least one related row. For more information about the AutoSwitch Mode, see Section 6.2 Editor and Display Options. Switching the Displayed Table

You can display any “hidden” table in the stack using the SWITCH command. By default, the SWITCH command operates on the lowest level. If more than one other table is joined, SWITCH displays a selection list. If only one other table is joined, that table is displayed and the previous table is hidden. If no other tables are joined, a message is displayed. Use the operands on the SWITCH command to display a specific table at a specific level stack. For example, to display the next table in the stack on the second level, specify: SWITCH T2 NEXT You can also specify the name of a table. To display the ORDERS table in the stack on the second level, specify: SWITCH T2 ORDERS

118

Move for DB2

3. Specify Access Definitions In addition to specifying NEXT and a specific table name, you can use the keyword ALL on the command for the default process. That is, you can display a selection list of all of the tables in a stack. To display 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 target level. If only one other table is joined, that table is displayed automatically. You can also use cursor position to indicate the target level. You may find it useful to assign the SWITCH command to a PF key and 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 not displayed, all joined lower levels are not displayed also. If you switch the display from one table to another, the joined related tables are included in the switching. 3.5.12.3 Displaying Traversal Paths With multi-way joining the Point-and-Shoot session can become very complex. In addition to keeping track of all the tables in a stack, you may have joined to tables on lower levels for one or more tables within the stack and you may have nested stacks. You can obtain a list of all active tables in the session and select a table on that list to switch the displayed tables. Use the INDENT command to display an indented list of the active tables in the session on the Indented Table Display panel. The format of this list identifies the display level hierarchy of all the tables and all the stacks. (This command is available regardless of whether you have stacked joined tables; however, since it is especially useful when tables are stacked, it is discussed in this section.)

User Manual

119

3. Specify Access Definitions 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 the tables are indicated on the left. All tables in a stack are on the same level. All tables in the stack, other than the active table, are indicated by the (STACKED) notation to the right of the name. ----------------------------- Indented Table Display ------------------------Command ===> Scroll ===> CSR Default Creator ID: PSTDEMO Cmd --*** ___ ___ ___ ___ ___ ___ ___ ***

Lvl --*** 1* 2* 3* 4* 2 2 3 ***

1 OF 7

Table Name -----------------------------------------------------*********************** TOP ************************** CUSTOMERS C:ORDERS C:DETAILS P:ITEMS C:SALES (STACKED) C:SHIP_TO (STACKED) C:SHIP_INSTR ********************** BOTTOM ************************

Line Commands:

Relation Type -------- ---******** **** START TABLE RCO DB2 ROD DB2 RID DB2 RSC DB2 RCST DB2 RSTSI DB2 ******** ****

(S)elect - Switch to Specified Table

Figure 61. Indented Table Display Panel Fields

The fields on the panel include: Default Creator ID

Default Creator ID as specified on the Select Tables/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 the same as the default Creator ID it is included with the name. The Start Table is listed first followed by the other tables ordered and formatted to reflect the edit session. Tables in a stack are listed in stack order. Special notation is included with the table name to provide information about the relationships. This notation includes: Parent/Child Indicators Except for the Start Table, the table name is prefixed to indicate whether it is the parent or the child in the relationship defined between the named table and the table under which it is

120

Move for DB2

3. Specify Access Definitions indented. The prefix is either: C: P:

Selecting another table in the stack

Child Parent

Relation

Name of the relationship between the higher level table and this table. START TABLE is always specified for the Start Table.

Type

Identifier to denote whether the relationship is defined in the DB2 Catalog, DB2, or in the Princeton Softech Directory, PST.

On the Indented Table Display panel you can select any table in the stack to be the displayed table using the Select line command. The command can be specified for any table joined to a table in a stack as well as the stack table. For example, in the figure SHIP_INSTR is joined to SHIP_TO. SHIP_TO is a table in a stack. You can select either SHIP_TO or SHIP_INSTR. Use END on the Indented Table Display panel to return to the edit session.

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 the target table are unjoined. By default, the UNJOIN command unjoins the lowest level. If there are stacked tables for that level, the displayed table is unjoined, removed from the stack and the next table on the stack is displayed. You can use the operands on the UNJOIN command to unjoin a specific 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 at that level, the ALL operand is ignored and the table at the lowest display level is unjoined. To unjoin a specific table, in this example ORDERS, in the stack at the lowest display level, specify: UNJOIN ORDERS

User Manual

121

3. Specify Access Definitions If there is no stack at the lowest display level, UNJOIN searches for a displayed table named ORDERS. When you have created multiple stacks, you can specify the target stack using the level indicator, either Tn or Vn as displayed on the panel. 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 to display a generalized form of the SQL that was used to fetch the rows from any of the displayed tables. By default, the SQL for the lowest level table is displayed. To display the SQL for another table, either supply the table name or identifier with the command or position the cursor to the desired table. For example, to display the SQL for the highest level table, enter: SHOW SQL T1 The table name is shown in the window heading. The generated SQL may contain three parts:

122



Host variables are declared if the corresponding columns have different data types or dimensions.



Pseudo code is generated to populate the host variables if they are declared.



The "generalized" SELECT statement, which incorporates the host variables.

Move for DB2

3. Specify Access Definitions Assume the CUSTOMERS table and the ORDERS table are displayed. The SHOW SQL command is entered to display the SQL used to fetch the rows from the ORDERS table. The SQL statement is displayed as:

------------------ 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 +------------------------------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 Generalized WHERE Clause

The actual SQL generated by MOVE contains the specific data values for columns defined in the relationship. Therefore, the SQL in the previous 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 the generalized 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 provided with a meaningful name that represents the processing.

User Manual

123

3. Specify Access Definitions Saving the SHOW SQL Output

You can save or print the output of the SHOW SQL command by using the OUTPUT command. When you enter the OUTPUT command, the Output Data Options panel is displayed as shown in the 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 Panel Fields

The fields on this panel are: Output Type

Specify whether the SQL is to be saved in a dataset or as a SYSOUT class for printing.

If Dataset: DSN

Specify the name of a new or existing dataset. The dataset must be either a sequential file, with a record format of fixed or fixed block, or a Partitioned Data Set (PDS) with a member name enclosed in parentheses. The dataset name is automatically prefixed unless it is enclosed in apostrophes. The prefix is determined by the Data Set Prefix user option (see Section 6. Specify Options for details). Alternatively, you may specify an asterisk, *, or the DB2 LIKE character, %, at the end of the DSN specification to generate a selection list. For example: 'PSTDEMO.DDL*' or 'PSTDEMO.DDL%' Both generate a selection list of all datasets having a DSN beginning with PSTDEMO.DDL and having a

124

Move for DB2

3. Specify Access Definitions valid format (that is, PDS or sequential file with a record format of fixed or fixed block). If the specified dataset does not exist, MOVE displays the Allocate Dataset panel (see Appendix B. Allocating External Files for details). Disposition

For an existing, sequential dataset only. Specify one of the following: M

MOD. The SQL data is appended to the dataset.

O

OLD. The contents of the file are replaced with the SQL data.

If SYSOUT: You can direct the output to a SYSOUT class and use an output processor, such as SDSF, to print it. SYSOUT Class

Specify the output class to which the printed output belongs. This can be a character in the range A through Z, 0 through 9, or an asterisk, *.

Destination

Specify a valid SYSOUT destination. The destination can be a local or remote terminal, a node in the JES network, a local or remote printer or workstation, 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 an operator.

N

Output is not held.

When you have entered all the desired information on this panel, press ENTER to continue processing. To return to the previous panel without specifying output data options, use END or CANCEL.

3.5.14 Reporting At any time during a Point-and-Shoot or browse session, you can produce a report about the contents of the session. Use the reporting facility to generate a report that includes some or all of the retrieved rows in a variety of formats. To invoke the report facility, use the

User Manual

125

3. Specify Access Definitions REPORT command. MOVE prompts for the report specifications on the 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 Panel Fields

The fields on the panel are: Table Name, Tn or 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 or Vn, or the word LAST (for the lowest level displayed table). This value combined with the specification for Process All Tables or One determines the set of data that is displayed. For more information about how this specification affects the report contents refer to the discussion, Determining Report Contents on page 127.

Process All Tables or One

Specify whether one or all tables are to be included in the report. Specify: A N

Report Title

Specify a title to be included in the heading for the report. Any characters, including upper case and lower case letters, can be specified.

Output Type

Specify the output type as either: D

126

All tables Only the named table

Dataset

Move for DB2

3. Specify Access Definitions S

SYSOUT

If Dataset

Specify the dataset name if the Output Type is D. If the dataset does not exist, MOVE prompts for allocation information and allocates the file before generating the report.

If SYSOUT

Specify SYSOUT parameters if the Output Type is S. The parameters are: SYSOUT Class Destination Hold

Display Report Parameters

Specify whether you want to review the prompts for report parameters. Specify: Y N

Yes to review prompts No to not review prompts.

Determining Report Contents The combination of your specifications for table name and one or all tables determines the actual contents of the report. For example, assume you are currently editing four tables joined for display in the following order: CUSTOMERS ORDERS DETAILS ITEMS 1. To report on all the rows from a single table, specify the table name and “N” for the prompt Process All Tables or One to include only one table. For example, to include only all the DETAILS rows in the report, specify: Table Name, Tn, or LAST Process All Tables or One

===> DETAILS ===> N

All the rows in the DETAILS table, regardless of which ORDERS rows (the next highest table) are displayed, are included in the report. No other tables are included in this report. 2. To limit the report to a specific level, specify the name of the table for which all rows on the current level are included. For reference, the current rows in all next higher level tables are included. The lower level tables are always included with this specification.

User Manual

127

3. Specify Access Definitions For example, to report on the DETAILS rows for the currently displayed ORDERS row and the related ITEMS for each of the DETAILS, specify: Table Name, Tn, or LAST Process All Tables or One

===> DETAILS ===> A

The report lists the displayed the single row for the CUSTOMERS and ORDERS table and each DETAILS row, one at a time, along with the related ITEMS rows for each of the DETAILS. 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 Process All Table or One. For example, assume the CUSTOMERS table is the Start Table, specify: Table Name, Tn, or LAST Process All Tables or One

===> CUSTOMERS ===> A

If you want to include all of the information for a single CUSTOMERS row, specify ORDERS as the table name. Then, the current CUSTOMERS row is included along with all of the current ORDERS rows, related DETAILS and ITEMS rows. Format

The format of the rows in the report conforms to the display format in the editor. A header identifies the table, column headings are presented above the columns, and the row(s) of data are provided beneath the headings. You can specify the parameters for the report format. When there are multiple lower level tables, the data display is handled similarly to the editor. •

For each table that is not the lowest level table, only one row is displayed.



For the lowest level table, all rows are displayed.



When there are multiple rows for a table that is not the lowest level table, each row is displayed in order along with the lower level related rows.

Report Format Parameters When you specify Y to the Display Report Parameters, prompts are displayed. Normally, you set these parameters once, and use them consistently for all reporting.

128

Move for DB2

3. Specify Access Definitions

--------------------- 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 Panel Fields

The following fields are displayed on this panel: Lines per Page

Maximum Report Rows per Table

User Manual

Specifies the maximum number of lines to be printed on a page. Normally, this is the number of physical lines that fit on a page minus the number of lines for the top and bottom margins. The default is 57. Specify: 0

Print the title line at the start of the report and do not insert page breaks. Use 0 if you are writing to a dataset and do not want page breaks.

20-999

Print the specified number of lines per page. When the number of lines have been printed, insert a page break, print the title at the top of the new page and increment the page number by 1.

Specify the maximum number of rows fetched for each table in the report. The value must be from 1 through the value specified by site management. Leave the field blank to use the value specified for Max Fetch Rows in the Editor and Display Options.

129

3. Specify Access Definitions Report Line Width

Specify the maximum number of characters on a line in the report. If the row length exceeds this value, it is wrapped or truncated as specified for the Oversized Lines option on this panel. To set the line width value to the largest row of any table in the report, leave the field blank. The minimum value is 80. If less than 80, the value is reset to 80. Use 80 if the report is directed to a data set for browsing on the screen. If the report is directed to a printer, this value is the line length of the printer (132 for most printers). The carriage control byte in the first position of the line is NOT included in the value.

Oversized Lines

Specify how lines that exceed the maximum width should be handled. Specify: T

Data is truncated. Columns that do not fit in their entirety on the line are omitted from the report.

W

Data is wrapped. Each row occupies as many lines as is necessary to include the entire row. Line breaks occur between columns unless the column width exceeds the line width.

Maximum Character Column Width

Specify the maximum number of characters that can be included for CHAR and VARCHAR columns. Leave the field blank to use the value specified for Columnar Max Display Width on the Edit and Display Options panel.

New Page per Start Table Row

Specify whether each Start Table row should be printed at the top of a new page. Specify: Y N

Print on a new page. Continue printing on the current page.

If the report is for a single table, this is ignored. Blank Lines between Levels

130

Specify the number of blank lines that are to be inserted between levels. Specify a value between 0 and 3.

Move for DB2

3. Specify Access Definitions Blank Lines between Rows

Specify the number of blank lines that are to be inserted between rows. This parameter applies only to the tables for which all relevant rows are included; only a single line is included for other tables. Specify a value between 0 and 3.

Blank between Columns

Specify the number of blanks that are to be inserted between columns. Specify a value between 0 and 20. This value is the minimum number of blanks between any two columns. The report may display more blanks between some columns depending on the contents of the column and the justification of that data.

Indent for Subordinate Tables

Specify the number of positions to indent a subordinate table to distinguish it from the immediately preceding table. Use this to present a clear visual representation of the display levels. The value specified for this parameter is subtracted from the Report Line Width to determine the actual number of characters in the indented table that can fit on a line. Specify a value between 0 and 40.

Omit Table Name Heading Line

Specify whether or not the line containing the table name and level number for each level is included in the report. Y N

Omit Subordinate Table Headings

Include heading Do not include heading

Specify whether or not all header lines for all tables other than the Start Table are included in the report. Sometimes including the column titles and table names is unnecessary. For those reports, use this option to eliminate such unnecessary clutter. Y N

Omit Redundant Table Headings

User Manual

Include heading Do not include heading

Specify whether or not the table headings are included more than once on a page. That is, if a table is included on a page more than once, the headings are included with only the first occurrence.

131

3. Specify Access Definitions Y N

Show Inactive Multi-Way Tables

Specify whether all joined tables involved in a multiway join are included. Although all tables cannot be currently active, all must have been displayed during the session. Y N

Additional Notes

132

Omit redundant table headings. Include table headings for all occurrences of a table on a page.

Include all tables in a multi-way join Include only the currently displayed table in a multi-way join.

The following notes apply to reports: •

Excluded rows are included in the report. When you return to the session after generating a report, the excluded rows are redisplayed.



If a multi-way join is in effect for subordinate levels, the Show Inactive Multi-way Tables option determines whether the hidden tables are included.



If you specify a table that is involved in a multi-way join and only one table is to be printed, only the active table is included. The hidden tables on that level are not printed regardless of the Show Inactive Multi-way Tables option.



All locked column specifications are respected. Therefore, locked columns are positioned as in the edit session.



The specifications on the Describe Columns panel for column and label handling are used in formatting the report lines.



The REPORT command is not available during a ZOOMed display.

Move for DB2

3. Specify Access Definitions

3.5.15 Terminating a Session When you have completed your selections, use END to return to the Select Tables/Views for AD panel. A prompt is displayed.

------------------- 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 ******************************** ___ 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 Output DSN Name

If an Input DSN was supplied, the name is shown in the Output DSN field. Press ENTER to update the named data set. You can overtype the name to create a new data set or update a different existing data set. This name is saved with the Access Definition and replaces any previous data set name.

Extract Process Note

If you have entered Point-and-Shoot from within an Extract Process request, 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 Row List for the current Extract Process only.

User Manual

133

3. Specify Access Definitions Subsequent Requests

You can re-enter a Point-and-Shoot session to modify the Start Table primary key values that were saved. When the POINT command is entered for a subsequent request during the same session and the changes were to be temporary, the following is displayed to confirm that 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 Changing the Start Table

If you change the Start Table and rows had been specified, MOVE notifies you that the Start Table specifications including Point-andShoot values and group selection specifications may be dropped since they 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

134

Move for DB2

3. Specify Access Definitions

3.5.16 Row List Status Indicated After you terminate the Point-and-Shoot session, the Select Tables/Views for AD panel is redisplayed. The Start Table Options field contains a value indicating whether or not a Row List has been defined for the current Access Definition. Assume a permanent Row List has been defined for the Access Definition. The Select Tables/Views for AD panel is displayed as:

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

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

Default Creator ID ===> PSTDEMO Start Table ===> CUSTOMERS Start Table Options : Row List (POINT) Cmd --*** ___ ___ ___ ___ ***

Table 1 of 4

<<MORE

R D --Extract Parms-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

User Manual

135

3. Specify Access Definitions

3.6 Group Selection Processing MOVE provides group selection processing to enable you to specify a sample set of rows from the Start Table with which to start an Extract Process. This is especially useful when you want to extract a representative sample set of related data for specific data groups. Although other options on the Select Tables/Views for AD panel enable you to qualify the data to be extracted (i.e., Point-and-Shoot to select specific rows, selection criteria, extract every nth row, and so forth), group selection processing enables you to specify that the selected rows are limited to some number of different values in a specific column and that a maximum number of rows can be extracted for each value. For example, you can specify that five rows from each of ten states are to be extracted from the Start Table. Group selection processing can be used in combination with most of the other selection criteria. The EveryNth specification and group selection processing are mutually exclusive. For the other types of selection criteria, the other criteria is applied first and then the group processing is applied to the result. For group selection processing, enter the GROUP command on the Select Tables/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 Column Name

136

To use group selection processing, you must specify the name of the column in the Start Table to be used for forming groups. Enter this at the prompt, Column Name to be used for Group. If you are not sure of the names of the columns in the Start Table, use the LIST command to display a selection list of the names. When the list is displayed, use S to select one.

Move for DB2

3. Specify Access Definitions To eliminate group selection processing, clear the Column Name to be used for Group field. To simplify the discussion of the prompts for Number of distinct values to use and Number of rows with each value, assume the CUSTOMERS table is the Start Table and the STATE column is specified as the Column Name to be used for Group. Distinct Values Limit and Number of Rows for Each

The criteria for selecting the rows can be based on distinct values in the STATE column. That is, you can specify that a group of rows for some number of different states in the STATE column are to be selected. The states are selected randomly. However, if you want to define which states are to be used, specify them on the Specify Selection Criteria panel or on the Specify SQL WHERE Clause panel. Since the selection criteria is processed first, you can be sure to select rows from only the states 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 specifying criteria. 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 the Number of rows for each value field.

You can use an asterisk to specify that MOVE is to use all rows found. For example, specify an asterisk for Number of rows for each value to obtain all of the rows for each included state. Alternatively, specify an asterisk for Number of distinct values to obtain a specific number of rows from all included states. You can specify an asterisk for either Number of distinct values or Number of rows for each value, but not both. After you have specified the group selection processing options, use ENTER or END to return to the Select Tables/Views for AD panel. The status of the group selection processing is displayed in the Start Table Options field.

User Manual

137

3. Specify Access Definitions In the following figure, group selection processing has been specified in addition to a Row List.

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

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

Default Creator ID ===> PSTDEMO Table 1 of 4 <<MORE Start Table ===> CUSTOMERS Start 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

138

Move for DB2

3. Specify Access Definitions

3.7 Selecting Relationships MOVE uses the relationships between the tables specified on the Access Definition table list to determine the paths by which to extract data. By default, all of the relationships are used. You can control which relationships are used to extract the data on the Specify Relationship Usage panel. On that panel, you can also specify how RI rules influence which rows are extracted based on the parent-tochild and child-to-parent extraction sequence. Data only

These specifications impact only the data to be extracted. When relationship definitions are to be extracted, all relationships, including unselected relationships and relationships for reference tables, are extracted.

Specify Relationship Usage Panel

The Specify Relationship Usage panel provides a list of all relationships between tables on the table list, except tables marked as reference tables. You display this panel by specifying the REL primary command on the Select Tables/Views for AD panel or selecting PATHS on the EXTRACT Process panel. Relationships defined to the PST Directory are displayed along with the DB2 relationships 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 Panel Fields

The fields on the panel are: Cmd

Field for line commands. The available line commands: S U D I

User Manual

Select a relationship Unselect a relationship Delete an unknown relationship Display information about a relationship

139

3. Specify Access Definitions STATUS

Indicates the status of the relationship. The possible values: NEW

This relationship is new to the list. Either a new table has been added to the list or a new relationship has been defined since this panel was last displayed, or this is the initial display of the list.

SELECT

This relationship is to be used when extracting data. Any number of relationships can be selected.

UNSEL

This relationship is not to be used when extracting data.

UNKNWN

This relationship is not defined for the listed tables. This can occur when the default Creator ID has been changed and one or more tables listed on the table list are not fully qualified. As a result, a relationship that was valid with the previous default Creator ID, is not now valid or was deleted. The relationships are always grouped by status on the display. The order of the possible statuses is NEW, SELECT, UNSEL, and UNKNWN. The order of the relationships within each status is determined by the order in which the parent table is included on the list of tables on the Select Tables/Views for AD panel.

Q1

Q2

140

Specifies whether the parent row of a selected child row should be extracted to satisfy RI rules. Specify: Y

Extract all parent rows. Default.

N

Do not extract all parent rows. This option is provided to ensure the referential integrity of the retrieved rows, therefore selection criteria is not applied.

Specifies whether all children of a parent row previously extracted to satisfy RI rules should be

Move for DB2

3. Specify Access Definitions extracted. This option is only relevant when Q1 is specified as Y for any relationship where the parent table in this relationship is the parent. Y

Extract all children

N

Do not extract all children. Default.

Sample scenarios to help in clarifying specifications for Q1 and Q2 are provided later in this section. Child Limit

Specifies a maximum number of child rows to extract for each parent using a specific relationship. (e.g., Extract five ORDERS for each CUSTOMERS row using the relationship RCO.) Specify 0 to direct MOVE to not use the relationship to extract any child rows for a specific parent. This is useful when you include a relationship to prevent orphans (extract parents for children) but do not want to extract additional children. Do not confuse this specification with the Row Limit parameter on the Select Tables/Views for AD panel. The Row Limit parameter specifies a total number of rows extracted from the table regardless of relationship traversal.

Parent

The name of the parent table in the relationship. The name is listed exactly as specified on the Select Tables/Views for AD panel. The Creator ID is included with the table name only when it is included on the Select Tables/Views for AD panel. If more than one relationship is defined between two tables with the same parent and child designation, an asterisk, *, is displayed prior to the name of the parent table of each occurrence.

User Manual

Child

The name of the child table in the relationship. The name is listed exactly as specified on the Select Tables/Views for AD panel. The Creator ID is included with the table name only when it is included on the Select Tables/Views for AD panel.

Relation

The name of the relationship.

141

3. Specify Access Definitions Type

The type of relationship. This indicates whether the relationship is defined in the DB2 Catalog or in the PST Directory noted as: DB2

DB2 Catalog

PST

Directory

QUES1/QUES2

The commands QUES1 and QUES2 can be used to change the specification for Q1 and Q2 respectively to either YES or NO for all listed relationships. This is useful, for example, when there are many relationships and you want to override the default setting for most of them or, after making several changes, you want to reset the specifications to the default.

CREATE RELATIONSHIP

If necessary, you can create additional relationships using the CREATE RELATIONSHIP command on the Specify Relationship Usage panel. This displays the panels used to define relationships stored in the Princeton Softech Directory. (The Definitions option on the Main Menu also displays these panels. The information about defining relationships is discussed in Section 4.2 Relationships.) When you signal that you have completed defining the relationship using END or CANCEL, you are returned to the Specify Relationship Usage panel. The new relationships that you have defined between tables on the table list are included in the list of relationships and assigned the NEW status.

Available Commands

The following commands are available when the Specify Relationship Usage panel is displayed: BOTTOM CANCEL CREATE PRIMARY KEY CREATE RELATIONSHIP DELETE DOWN END

142

INDENT OPTIONS OUTPUT QUES1 QUES2 RESET SAVE

SHOW STEPS TOP UNSELECT UP USE

Move for DB2

3. Specify Access Definitions

3.7.1 Displaying Information You can display information about a relationship to help in deciding which relationships to select. Use the Info line command, I, in the Cmd field next to the desired relationship. In the following figure, information about the relationship RCO is displayed 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 Panel Fields

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 be used in the relationship. Column Name field is provided for a table under the table name.

Data Type

Data type of the columns. In addition to the standard DB2 data types, this field can contain EXPR indicating that the value specified for the column name is an expression whose data type is determined when the relationship is used.

Use END or ENTER to return to the Specify Relationship Usage panel.

User Manual

143

3. Specify Access Definitions

3.7.2 Relationship Status When the Specify Relationship Usage panel is first displayed, the relationships are listed in the order in which the parent tables are listed on the Select Tables/Views for AD panel. The names of the tables are shown exactly as entered on the Select Tables/Views for AD panel. NEW Status

The first time a relationship is listed, it is assigned the NEW status as shown in Figure 75. Selecting Relationships for MOVE Functions.

Select and Unselect

On the relationship list, you can select and unselect relationships to be used for the Extract Process. Use the S line command to select a relationship and U to unselect a relationship. Any relationship assigned the NEW status that is not explicitly selected or unselected is automatically assigned a value based on your response to the Use NEW Relationship prompt on the Access Definition Parameters panel. If YES is specified for the prompt, NEW relationships are selected and automatically included in the Extract Process. If NO, NEW relationships are not selected. In Figure 75. Selecting Relationships for MOVE Functions, the first and third relationships are selected, the second is unselected, and the last two are not explicitly selected or unselected. Assume the response to the prompt Use NEW Relationships is YES. (This prompt is displayed on the Access Definitions Parameters panel available from the Select Tables/Views for AD panel by entering the PARAMETERS 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 DB2 u__ NEW Y N *CUSTOMERS ORDERS RTCOR PST s__ 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 Revised Status

144

If the REL command is used again on the Select Tables/Views for AD panel to redisplay the Specify Relationship Usage panel for this set of tables, the status is revised as shown in the following figure.

Move for DB2

3. Specify Access Definitions

------------------------ 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 Cmd Status 1 2 Limit Parent Table --- ------ - - ----- ---------------------*********************************** TOP ___ SELECT Y N *CUSTOMERS ___ SELECT Y N ORDERS ___ SELECT Y N *DETAILS ___ SELECT Y N *DETAILS ___ UNSEL Y N *CUSTOMERS ******************************** BOTTOM

--Relation-Child Table Name Type ---------------------- -------- --*********************************** ORDERS RCO DB2 DETAILS ROD DB2 ITEMS RID DB2 ITEMS RTDI PST ORDERS RTCOR PST ***********************************

Figure 76. Status Revised The revised status is shown in the STATUS field and in the position of the relationship on the list. Selected relationships have the SELECT 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 NEW Relationships prompt. Relationships are added and deleted from the list by changes made on the Select Tables/Views panel and by changes to the relationship definitions. 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 the NEW status and placed at the beginning of the list. New relationships are included on the list when the Specify Relationship Usage panel is displayed or the Extract Process is invoked. The Extract Process can be invoked without displaying the panel and selecting or unselecting the new relationships. A warning message is displayed, but the Extract Process can proceed. Since this default action may not be what you intended, you should display the Specify Relationship Usage panel to handle changes to the relationship list. In fact, it is recommended that you display the Specify Relationship Usage panel any time you modify the table names or Creator ID of one or more tables on the Select

User Manual

145

3. Specify Access Definitions Tables/Views for AD panel to ensure that the desired relationships and traversal paths are used. Add a Table An Example

Assume the Select Tables/Views for AD panel is redisplayed and the SALES table is added to the list. When the REL command is entered, the list is revised to include any additional relationships pertinent to the added table. In the following figure, all relationships with a NEW status are listed first, followed by the SELECT status, and then the UNSEL 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 on the response to the prompt Use NEW Relationship. New Relationships

Relationships that are defined between displays of the Specify Relationship Usage panel are handled in the same manner as relationships added to the list because a new table has been included.

USE Command

You can specify the USE NEW command to change all relationships with the NEW status to the SELECT status. You can specify USE ALL, to change all relationships with either the NEW status or the UNSEL status to the SELECT status.

Creator ID Changed

Changing the Default Creator ID on the Select Tables/Views for AD panel can have an impact on the relationship list. The Default Creator ID affects all of the tables that are not explicitly qualified with a Creator ID.

UNKNWN Status

Frequently, sets of tables that differ only by Creator ID use comparable relationships with the same names. In those instances, MOVE identifies the same names and maintains the assigned status. However, when a same-name relationship is not defined for both sets, any previously listed

146

Move for DB2

3. Specify Access Definitions relationships are assigned the UNKNWN status and any new relationships 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 new table name has been supplied. Change Default Creator ID An Example

Assume the Default Creator ID has been changed causing two new relationships to be added and an existing relationship to become unknown. The other relationships are the same. In the following figure, the two new relationships are added at the top of the list. The unknown relationship is placed at the bottom of the list. The other relationships 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 Delete UNKNOWN

You can use the Delete line command, D, to delete any relationship from the list that is UNKNWN. However, since you can use the same Access Definition for similar sets of tables with different Creator ID's, you may decide to retain the unknown relationships on the list. That minimizes your efforts if you intend to use the same Access Definition multiple times and change only the Creator ID. MOVE retains the original status of all relationships that are unknown and reapplies that status when the Creator ID is modified such that the relationship is applicable. This does not impact the performance of MOVE processing. Unknown relationships are ignored.

Important Note

User Manual

If tables are added, new relationships are created, or the Creator ID is modified, the list of relationships is not automatically revised and the changes are not immediately incorporated into the Access Definition.

147

3. Specify Access Definitions These changes are incorporated when the REL command is executed or the Extract Process is invoked. These changes can result in NEW and UNKNWN relationships. If they are not handled explicitly on the Specify Relationship Usage panel, warning messages are issued when the Extract Process is performed. (For more information about the Extract Process, see Section 5.2.3 Perform the Extract Process.) The Start Table is always included in the MOVE process. To include other tables, a relationship is required. A table included in the Access Definition is not traversed if it is not part of a selected relationship. In fact, if you unselect all of the relationships, only rows from the Start Table are extracted. Any number of relationships can be selected or unselected. OUTPUT command

You can use the OUTPUT command to direct the contents of the displayed text to an output file or SYSOUT. (If you want the report to include traversal information, use SHOW STEPS discussed below.)

3.7.3 Displaying Traversal Information SHOW STEPS Command

After you have completed the Specify Relationships Usage panel, you can request information about how the extract will be performed using the SHOW STEPS command. This information is used to ensure that the extracted data and the traversal paths used to extract the data are as you expect. The SHOW STEPS command evaluates the specified tables and relationships and displays the series of steps that will be performed to accomplish an Extract Process.

SHOW STEPS Example

148

Assume data is to be extracted from three tables, CUSTOMERS, ORDERS, and DETAILS. The CUSTOMERS table is the Start Table. The ORDERS table is a child of CUSTOMERS, and DETAILS is a child of ORDERS. The SHOW STEPS text is displayed as: 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.

Move for DB2

3. Specify Access Definitions The text for the first step, extracting from the Start Table, varies depending 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 used without a Point-and-Shoot list: Selection Criteria and/or Statistical Controls are used and Determine the Rows Selected.



When there is no selection criteria, statistical controls, or Pointand-Shoot list, all rows are extracted from the Start Table: No Row List, Selection Criteria or Statistical Controls used, therefore Start Table 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 on relationships and specifications on the Specify Relationship Usage panel. A single step can extract rows from more than one table or extract rows from one table to satisfy more than one relationship. For example, if the DETAILS table is related to both the CUSTOMERS table and the ORDERS table, Step 3 is: Step 3:

Extract Rows from PSTDEMO.DETAILS which are Children of Rows Previously Extracted from PSTDEMO.CUSTOMERS in Step 1 using Relationship RCD. --AND-Extract Rows from PSTDEMO.DETAILS which are Children of Rows Previously Extracted from PSTDEMO.ORDERS in Step 2 using Relationship ROD.

Any table may be revisited multiple times in successive steps. Cycles may be involved causing a set of tables to be traversed iteratively until a complete pass through the cycle does not result in extracting any additional rows. Based on the information provided by SHOW STEPS, you can respecify the relationship usage and execute the SHOW STEPS command again. Handling the Text

All of the standard ISPF scrolling commands are available while displaying the SHOW STEPS text. Also, you may use the OUTPUT command to direct the contents of the SHOW STEPS display and the Specify Relationship Usage panel to an output file or SYSOUT. You are prompted for the output parameters and, based on your responses, MOVE writes the output to the specified destination. Use END to return to the Specify Relationship Usage panel.

User Manual

149

3. Specify Access Definitions END and CANCEL Commands

On the Specify Relationship Usage panel, use the END command to return to the Select Tables/Views for AD panel. Use the CANCEL command to remove all changes made on the current panel and return to 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 may need 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 the information on the Relationship Usage panel and displays prompts for 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 Tools Command Reference Manual.)

150

Move for DB2

3. Specify Access Definitions

3.8 Using Relationships MOVE uses the relationships between tables to determine the traversal path for extracting data. You specify which relationships are traversed from table to table and how those relationships are used on the Specify Relationship Usage panel.

3.8.1 Sample Scenarios A simple database structure is used throughout the examples in this section to explain the specifications on the Specify Relationship Usage panel. This structure includes four tables: CUSTOMERS, ORDERS, DETAILS, and ITEMS. CUSTOMERS is the parent of ORDERS, ORDERS, and ITEMS are parents of DETAILS. Basic Traversal Path

The most common traversal is to begin at the Start Table and proceed through the data model traversing all relationships from parent to child. For example, if the Start Table is CUSTOMERS, MOVE automatically traverses down to ORDERS and DETAILS. Alter Traversal Path

Using the Specify Relationship Usage panel, you can alter the traversal path by unselecting and selecting relationships. In addition, there are two specifications that you can use to expand the traversal path. These are designated Q1 and Q2 on the panel shown in Figure 79. Default Specifications for Q1 and Q2. These specifications are relevant when:

User Manual



The Start Table is a child table. For example, when the ORDERS table is the Start Table, these specifications determine whether the related CUSTOMERS rows are extracted.



A table has more than one parent table. For example, when the ITEMS table is the Start Table, rows are extracted from the DETAILS table automatically because it is a child of the ITEMS

151

3. Specify Access Definitions table. However, since the ORDERS table is also a parent of the DETAILS table, you specify whether the related ORDERS rows are extracted by traversing from child to parent. Q1

The first question, Q1, determines whether MOVE follows a relationship from child to parent to extract data. By default, Q1 is Y or Yes, MOVE should follow the relationship from child to parent. This default behavior ensures the relational integrity of the extracted data. A parent row is extracted for every child row. In the following figure, the default for Q1, Yes, is shown for all three relationships.

------------------------ 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 Multiple Parent Tables

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 to Yes. MOVE extracts the selected CUSTOMERS rows, then follows the relationship RCO to extract the related child rows in the ORDERS table. Next, MOVE follows the relationship ROD between ORDERS and DETAILS to extract the child rows in the DETAILS table. Since the ITEMS table is a parent to the DETAILS table, Q1 must be Yes to direct MOVE to follow the relationship RID from child to parent and obtain the ITEMS related to the extracted DETAILS.

Q2

152

The second question, Q2, determines whether additional child rows are extracted if a parent row has been extracted because of Q1. In other words, if MOVE has followed a relationship from child to

Move for DB2

3. Specify Access Definitions parent and extracted a parent row, additional children of that parent are extracted when Q2 is Yes. Child as Start Table

Assume you need to extract a set of CUSTOMERS and all of their ORDERS beginning with specific criteria for the ORDERS. You can: 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 the following 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 Start Table, only the row for order 2 is selected. Q1 and Q2 are YES for the relationship RCO between CUSTOMERS and ORDERS. The rows are extracted in the sequence shown in the following figure. STEPS 1.

The ORDERS row 2 is extracted based on the Point-and-Shoot selection.

1.

The CUSTOMERS row is extracted because of Q1.

2.

ORDERS rows 1 and 3 are extracted because of Q2.

Since Q2 is Yes, MOVE also extracts the other ORDERS rows that are children of the extracted CUSTOMERS rows.

User Manual

153

3. Specify Access Definitions Note any rows extracted from a table because of Q2 must meet the selection criteria specified for that table. In addition, they are subject to the statistical controls. Child to parent for multiple relationships

Consider another example. Orders are shipped only when all items are available. If any one of the ordered items is out of stock, the order is not shipped to the customer. Assume you need to determine which orders are outstanding because of a specific out-of-stock item. The set of extracted data should contain the full details of all of the orders. To obtain complete information, 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 ITEMS row. (Extract the item with a quantity of 0.) 3. Specify the Specify Relationship Usage panel as shown in the following figure. Note that Q2 is YES for only the relationship ROD.

------------------------ 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:

154

Move for DB2

3. Specify Access Definitions ITEMS to DETAILS

After the specified ITEMS rows are selected, the related DETAILS are extracted by traversing the relationship RID from parent to child. STEPS 1. The single ITEMS row with a quantity of zero is extracted based on the selection criteria. 2. The DETAILS rows containing the item are extracted because of the parent to child traversal of relationship RID.

DETAILS to ORDERS

The ORDERS related to the DETAILS are extracted, followed by the CUSTOMERS related to the ORDERS. 3. The ORDERS that are related to these DETAILS are extracted by traversing the relationship ROD from child to parent because Q1 is Yes.

ORDERS to CUSTOMERS

4. The CUSTOMERS that placed these ORDERS are extracted by traversing the relationship RCO from child to parent because Q1 is Yes.

The additional DETAILS related to these ORDERS are extracted. ORDERS to DETAILS

5. The other DETAILS that are part of the ORDERS are extracted because Q2 is Yes for the relationship between ORDERS and DETAILS.

The ITEMS for the additional extracted DETAILS are extracted.

User Manual

155

3. Specify Access Definitions

DETAILS to ITEMS 6. The ITEMS for the additional DETAILS are extracted because Q1 is Yes for the relationship between ITEMS and DETAILS.

No Additional ORDERS

Only the ORDERS for the selected ITEMS are extracted. Additional ORDERS for the extracted CUSTOMERS are not obtained because Q2 is No for the relationship RCO between CUSTOMERS and ORDERS.

Summary

Q2 allows you to direct MOVE to extract additional children. That is, if parent rows are extracted to satisfy Q1 (make the set of extracted data referentially-intact), the additional children to those parents are also extracted.

Multiple Children

There are tables that are parent to more than one child table. The specifications for Q1 and Q2 are applied only to each pair of tables that have a relationship between them. For example, if a row of the CUSTOMERS table is extracted because Q1 is Yes for the relationship between CUSTOMERS and ORDERS, then Q2 for that relationship only applies to related rows from the ORDERS table. To extract data from other child tables, Q2 would have to be set to Yes for those relationships. Assume the SHIP_TO and the ORDERS tables are children of the CUSTOMERS table. To obtain the shipping information for specific orders, 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 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 Y N CUSTOMERS ORDERS RCO DB2 ___ SELECT Y Y CUSTOMERS SHIP_TO RCST PST *********************************** BOTTOM ********************************

Figure 82. Set Q1 and Q2 for Multiple Children

156

Move for DB2

3. Specify Access Definitions ORDERS to CUSTOMERS to SHIP_TO

The extract process proceeds as follows: STEPS 1. A single ORDERS row is extracted based on the selection criteria. 2. The CUSTOMERS row is extracted because Q1 is Yes for the relationship RCO between CUSTOMERS and ORDERS. 3. The SHIP_TO row is extracted because Q2 is Yes for the relationship RCST between CUSTOMERS and SHIP_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 each relationship. Extending the example on page 154 for extracting all of the related data about orders for out-of-stock item, a traversal cycle results by extracting all of the items with a quantity of zero that have been ordered and then traversing as noted by the following steps to obtain a complete set of orders.

User Manual

157

3. Specify Access Definitions ITEMS is the Start Table. (Note, the CUSTOMERS table is not used in this example. The relationship between CUSTOMERS and ORDERS, RCO, is unselected.) The Specify Relationship Usage panel 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 traversing the relationship RID from parent to child. 3. Extract the ORDERS related to the DETAILS by traversing the relationship ROD from child to parent. (Q1 is YES.) 4. Extract the additional DETAILS for those ORDERS by traversing the relationship ROD from parent to child. (Q2 is YES.) 5. Extract the ITEMS related to the additional DETAILS by traversing the relationship RID from child to parent. (Q1 is YES.) One complete cycle is made. MOVE began with the ITEMS table and ended at the ITEMS table. Multiple Traversal Cycles

MOVE can also process multiple traversal cycles. Although unlikely, the previous example can be extended to show multiple traversal cycles. After extracting the ITEMS rows for the additional items in Step 5, you may want to extract the ORDERS and DETAILS for these ITEMS. To accomplish this, Q2 for the relationship RID is set to YES. After Step 5 in the example, MOVE traverses the relationship

158

Move for DB2

3. Specify Access Definitions RID from parent to child to extract the remaining DETAILS related to these additional ITEMS. Then Steps 3, 4, and 5 are repeated to extract additional ORDERS, the DETAILS related to those ORDERS, 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 by referential cycles. With a referential cycle, you start at one table and return to it after traversing a series of one or more relationships. (In contrast, many DB2 databases are defined as hierarchies or networks. To extract data, you proceed up or down through the hierarchy or the network and never return to the Start Table.) Two Tables

For this discussion, assume there are two tablesDEPARTMENT and EMPLOYEE. The tables are defined as:

DEPT_ID is the primary key of the DEPARTMENT table; EMP_ID is the primary key of the EMPLOYEE table. Relationship

User Manual

The relationships are shown in the following figure:

159

3. Specify Access Definitions The data in each table is as follows:

The following is a sample company organization chart with pertinent values in the tables.

In the following pages a sample query is used to demonstrate how to handle cyclic relationships through the specifications for Q1 and Q2. Changing these specifications changes the set of data extracted from these tables.

160

Move for DB2

3. Specify Access Definitions Example 1

Extract all of the employees in the Development Department, including those employees that are members of subordinate departments. The DEPARTMENT table is the Start Table. The Point-and-Shoot facility is used to select the appropriate row in the DEPARTMENT table. Since MOVE needs to follow the existing relationships only from parent to child, specifications for Q1 and Q2 are set to No 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 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 table for all employees in the Development Department, EMPLOYEE.DEPT_ID=‘D’. Three EMPLOYEE rows are extracted: EMP_ID = 9 EMP_ID = 10 EMP_ID = 11 3. The relationship MANAGER is used to search the DEPARTMENT table to determine if any of the extracted employees 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 EMPLOYEE table to extract all employees that belong to the Support Department, DEPT_ID = ‘F’.

User Manual

161

3. Specify Access Definitions Two EMPLOYEE rows are extracted: EMP_ID = 14 EMP_ID = 15 5. The relationship MANAGER is used to search the DEPARTMENT table to determine if either of the two extracted rows in step 4 are managers. They are not. MOVE does not extract any more rows. Summary

Two rows are extracted from the DEPARTMENT table: DEPT_ID = 'D' DEPT_ID = 'F' Five rows are extracted from the EMPLOYEE table: EMP_ID = 9 EMP_ID = 10 EMP_ID = 11 EMP_ID = 14 EMP_ID = 15

Example 2

In addition to all of the employees in the Development Department and subordinate departments, extract the manager of the Development Department. As with Example 1, the DEPARTMENT table is the Start Table and the row in the DEPARTMENT table where DEPT_ID = ‘D’ is selected during Point-and-Shoot. To extract the manager of the Development Department, the relationship MANAGER must be traversed from child to parent. Q1 for the relationship MANAGER is changed 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

162

Move for DB2

3. Specify Access Definitions The steps shown for Example 1 are performed by MOVE to extract the data. In addition, Step 2 will also traverse the relationship MANAGER 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. Example 3

In addition to all of the employees in the Development Department and the manager of the Development Department, extract any other departments this manager manages. To obtain these other departments, both Q1 and Q2 for the relationship MANAGER are set 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 Y EMPLOYEE DEPARTMENT MANAGER DB2 ********************************** BOTTOM *********************************

Figure 86. Set Q1 and Q2 to YES In this example, after MOVE has extracted Laurie from the EMPLOYEE table, it follows the MANAGER relationship from parent to childfrom EMPLOYEE to DEPARTMENT. MOVE checks the DEPARTMENT table to determine whether Laurie is manager of any other department. Based on the sample employee hierarchy used for these examples, no additional rows are extracted. Laurie manages only one department.

User Manual

163

3. Specify Access Definitions Example 4

In addition to all of the employees in the Development Department, the manager of the Development Department, and any other departments these extracted managers manage, extract any other departments 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 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 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 the EMPLOYEE table, it follows the MEMBER relationship from child to parent, from EMPLOYEE to DEPARTMENT. MOVE checks the DEPARTMENT table to determine whether Laurie is a member of any other department. Laurie is a member of the Executive Department. An additional row from the DEPARTMENT table is extracted, DEPT_ID = ‘A’. Since Q1 is Yes for the MANAGER relationship, MOVE follows this relationship from child to parent, from DEPARTMENT to EMPLOYEE, and extracts the manager of the Executive Department, Fred. An additional row from the EMPLOYEE table is extracted, EMP_ID = 1.

164

Move for DB2

3. Specify Access Definitions Example 5 Disabling RI Cycles

Extract only the employees that are members of the Development Department. Unlike Example 1, do not extract employees in subordinate departments. To obtain only the employees in the Development Department, Q1 and Q2 are set to No for the relationship MEMBER. In addition, the relationship MANAGER is unselected. This relationship is not to be traversed 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 row for the Development Department. Then, using the relationship MEMBER, traverses from parent to child to extract the three employees in the department. Since the MANAGER relationship is unselected, it is not traversed. The extract is complete.

User Manual

165

3. Specify Access Definitions

3.9 Dynamically Defining the Access Definition You can define several of the specifications for the Access Definition dynamically when you invoke the editor from the Main Menu option or the Definitions Menu option. Using the BROWSE command, you invoke a browse session for the set of data defined by the Access Definition. During this session you can "join" to tables not included in the Access Definition and specify sort and selection criteria for any of the tables as you display the data. This dynamic capability provides another means of defining an Access Definition. Rather than respond to the prompts, you can view the set of data you want to define to ensure the correct definition. However, these dynamic specifications are saved in the Access Definition only if you are editing the definition from the Main Menu option or the Definitions Menu option. If you browse while editing an Access Definition from the Extract option on the Migration Menu, the dynamic specifications are not saved in the Access Definition. (Also, any dynamic specifications you make during a Point-and-Shoot session are not saved.) For the most part, the facilities available when browsing are the same as those provided during a Point-and-Shoot session and are not discussed here. Based on the Access Definition parameters, the following facilities are also available when editing the Access Definition from the Main Menu option or the Definitions Menu option. •

The NEW operand is available on the JOIN command enabling users to specify the name of a table not currently in the Access Definition. The new, joined table and any pertinent relationships are automatically included in the Access Definition. (Only the tables in the Access Definition may be displayed during Pointand-Shoot or when browse is invoked from the Extract Process.)



All specifications for sort and selection criteria are included in the Access Definition. (These are not included when specified from a Point-and-Shoot session or when the editor is invoked from the Extract Process.)

The Group Selection Processing and random factors are ignored when obtaining the set of data for browsing or for Point-and-Shoot because the set of selected rows is arbitrary and may vary for each session.

166

Move for DB2

3. Specify Access Definitions

3.10 Database Changes An Access Definition can be affected by changes to the database. The extent of the effect is determined by what is changed and whether or not it is directly referenced in the Access Definition. The following lists the possible changes and the potential impact. Column Added

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 a Column Map are included in the list of unused columns in the map. If the column is added to the destination table, MOVE attempts to assign a matching source column to the new column and if none is available applies the defined column default. (For information on Column Maps see Section 4.3 Column Maps.)

Column Deleted

When a column is deleted from a table and that table is included in an Access Definition, you should be aware of the impact. If you quit and access the affected table you will either receive: Error

You will receive an error message if the column is referenced. 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 in the Access Definition. Warning

You will receive a warning message if the deleted column is not explicitly referenced. Although a warning message is issued, the Extract, Insert, and Delete processes can be performed.

Any column that is deleted from the table cannot be explicitly designated in a Column Map. Column Modified

If the characteristics of a column have changed since the Access Definition was last modified, a warning message is issued when an Extract, Insert, or Delete process is attempted. For example, if the column length or the data type changes, this has an impact on how the data is handled by an Insert or Delete Process if the column participates in the process. An appropriate warning

User Manual

167

3. Specify Access Definitions message is issued. You should check to ensure that the desired data will be processed. Table Added

Adding a table to the database has no direct impact on the Access Definition or any of the processes.

Table Deleted

If a table in an Access Definition is deleted from the database, the table is labeled as UNKNOWN in the Access Definition. The Access Definition can be used, but the deleted table can not be the Start Table. MOVE issues a warning message for this table when an Extract Process is requested.

Relationships Added, Deleted, or Modified

When relationships are added or deleted, they directly impact the specifications on the Specify Relationship Usage panel for MOVE. Deleted relationships are placed at the bottom of the list and assigned the UNKNOWN status. New relationships are included at the top of the list and assigned the NEW status. If the Specify Relationship Usage panel is not displayed, all NEW relationships are included in the Extract Process by default and a warning message is displayed to inform the user of this situation. You specify NO on the Use NEW Relationship prompt on the Access Definitions Parameter panel to prevent these NEW relationships from being traversed. Modified relationships are handled like newly specified relationships.

168

Move for DB2

3. Specify Access Definitions

3.11 Access Definition Parameters You can specify a variety of parameters for the Access Definition using the Access Definition Parameters panel. You can display this panel by specifying the PARAMETERS primary command on the Select 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 Panel Fields

The fields on the panel are: Dynamically Add Tables

Modify Selection Criteria

User Manual

Specifies whether tables that are not included in the Access Definition can be accessed via a JOIN command. This applies when defining an Access Definition and a Browse session is invoked or for Access for DB2 only when a browse or edit session is invoked from a menu option. Specify: Y

New tables can be added. Default.

N

New tables cannot be added.

Specifies whether selection criteria can be specified or modified when browsing data while defining an Access Definition (for all Relational Tools), when editing data (for Access for DB2), or during a Point-and-Shoot session (for MOVE and Compare for DB2). Specify: Y

Criteria can be specified or modified. Default.

N

Criteria can not be specified or modified.

169

3. Specify Access Definitions Specifies what the first display will be if an Access Definition is used to browse data from the Access Definition panels (for all Relational Tools), to browse and edit data at any time (for Access for DB2), or to invoke a Point-and Shoot session (for MOVE). Specify:

Begin Table Display with

Available Commands

D

Data Display begins with data from named Start Table. Default.

S

Criteria for Start Table Only Display begins with a selection criteria prompt for the named Start Table.

A

Criteria for All Tables Display begins with a selection criteria prompt for the named Start Table and all subsequently joined tables.

Changes to AD During Edit

Specifies whether changes to an Access Definition during the edit or browse session are to apply only to the current session or saved for future use. Editing is available with Access for DB2 only. All Relational Tools enable users to browse the data while defining an Access Definition.

Use New Relationships

Specifies whether relationships that are NEW and have not been specifically selected or unselected are 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 Access Definition Parameters panel is displayed. BROWSE

CANCEL

END

OPTIONS

SAVE

The EDIT command is available when Access for DB2 is also installed. Use END to signal that specifications on the Access Definition Parameters panel are complete. The display returns to the Select Tables/Views for AD panel.

170

Move for DB2

3. Specify Access Definitions

3.12 Defining for Relational Tools An Access Definition can be used by any of the Relational Tools regardless of which was used to create it or for which it was originally created. However, care should be taken when sharing Access Definitions among the products. Modifications to an Access Definition during an edit session can change the selected set of data. This may be undesirable for MOVE processes. Duplicate Tables

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 same restrictions as MOVE, Access for DB2 allows multiple references to a single table.) If an Access Definition containing such an entry is used for an Extract Process, an error message is displayed and you are prompted to delete the duplicate entries. You will not be able to perform the Extract Process if duplicate entries are present. Similarly, when duplicate tables are present while editing an Access Definition, 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 Specify Relationship Usage panel. This is not a concern when using the Access Definition with Access for DB2.

User Manual

171

3. Specify Access Definitions

172

Move for DB2

4. Definitions This section describes how to create and maintain primary keys, relationships, Column Maps, and Table Maps in the Princeton Softech Directory and to display primary keys and relationships from the DB2 Catalog. This section also discusses how to export the objects defined in the Princeton Softech Directory of one subsystem and then import these object definitions to another Directory of another subsystem. When Option 6 Definitions is selected on the Main Menu, the Choose a 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 Maps 4 TABLE MAPS - Maintain Table Maps 5 ADS - Maintain Access Definitions E I

EXPORT IMPORT

- Export Princeton Softech Object Definitions - Import Princeton Softech Object Definitions

Figure 90. Choose a Definition Option Panel options

The available options are: PRIMARY KEYS

Primary keys are those columns that uniquely define a row in a table. Use Option 1 to create new primary keys and modify and delete existing primary keys in the Directory. You can browse DB2 primary keys.

RELATIONSHIPS

Relationships are the set of columns from each of two tables used to define a correspondence between these tables. Use Option 2 to create relationships and modify and delete existing relationships in the

User Manual

173

4. Definitions Directory. You can browse DB2 relationships. COLUMN MAPS

Column Maps are used by MOVE to map source columns to destination columns, or to transform the data for a destination column as part of the Insert, Load, or Convert Processes. Column Maps are also used to exclude columns from participating in a process. Use Option 3 to create new Column Maps and modify and delete existing Column Maps.

TABLE MAPS

Table Maps are used by MOVE to map the source tables to their corresponding destination tables, so that tables with different names in the source and destination can be mapped and tables in the source can be excluded from the process. Use Option 4 to create new Table Maps and modify and delete existing Table Maps.

ADS

Access Definitions are used by MOVE to specify which related data is to be extracted. You can specify the set of tables, selection criteria, relationships to use, and other criteria to define the desired set of data. Use Option 5 to create new Access Definitions and modify and delete existing Access Definitions. (This functions the same as selecting Option 5 ADS on the Main Menu.)

EXPORT

The Export Process is used to extract object definitions specific to Relational Tools from the PST Directory and store them in an external file. This file can then be used by the Import Process to add the object definitions to the PST Directory used by other subsystems. Use Option E to export object definitions from the PST Directory.

IMPORT

The Import Process is used to import previously exported Relational Tools object definitions. The imported definitions are stored in the PST Directory. Use Option I to import object definitions.

174

Move for DB2

4. Definitions Panel fields

There are three input fields on the menu enabling you to change the SQLID, subsystem and remote location. This is especially useful for accessing the definitions for a specific database, or when exporting and importing for connecting to the desired target database. SQLID

Current SQLID. If you modify this value, MOVE will attempt to connect using the modified SQLID. Since you can be connected with only one SQLID, the connection with the original SQLID is not maintained. However, if MOVE cannot connect with the specified SQLID, a rollback is performed and you are reconnected with 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 subsystem at any time, the original subsystem is disconnected. However, if MOVE cannot connect the specified subsystem, a rollback is performed and you are reconnected to the original subsystem.

LOCATION

Current location. This field is only displayed if remote access is available. If you modify this value, MOVE will attempt to connect to the remote subsystem. Since you can be connected to only one subsystem at any time, the original subsystem is disconnected. However, if the connection fails, the Relational Tools session is restarted and the Main Menu is redisplayed.

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 a traversal path for an extract—the relationship information from the DB2 Catalog is used. If the required information is not defined in the DB2 Catalog, MOVE searches for the information in the Princeton Softech Directory. If the information is not defined in the Directory, you can specify the relationship definition through a series of prompts provided by MOVE. This information is then stored in the Directory and becomes available to all Relational Tools users. The Directory is an extension of the DB2 Catalog.

User Manual

175

4. Definitions Updating the Directory

176

You can add primary keys and relationships to the Directory by using the series of panels described in Sections 4.1 Primary Keys and 4.2 Relationships. Alternatively, the IMPORT option can be used to import relationship information from third party dictionaries or case tools.

Move for DB2

4.1 Primary Keys

4.1 Primary Keys MOVE prompts to create a primary key definition for a table when it is required for the current operation the user is attempting or when the user explicitly requests processing of a primary key. The responses to the prompts are stored in the Directory. These prompts are displayed: •

Upon entry into a Point-and-Shoot session when the Start Table does not have a primary key.



When extracting from a table with two or more parents and these multiple parents are involved in the Extract Process.



When updating a table.



When Option 1 is selected on the Choose a Definition Option panel.

The first three situations are controlled by MOVE, the last by user request. The same primary key information is required in these situations and the same prompts are displayed. For Relationships

User Manual

If defined, primary keys assist in defining relationships. Specifically, when you create a relationship and a primary key has been defined for the parent table, MOVE automatically inserts the primary key columns into the Define Relationship panel. You can then modify the column information as desired.

177

4. Definitions

4.1.1 Specifying a Primary Key To define a primary key, select Option 1 PRIMARY KEYS, on the Choose a Definition Option panel. The following panel is displayed.

----------------------- Choose a Primary Key ------------------------Command ===> Primary Key: Creator ID ===> Table Name ===> Primary Key Type

===> B

Use '_' for DB2 LIKE character ===> N

(P-PST, D-DB2, B-Both) (Y-Yes, N-No)

Figure 91. Choose a Primary Key Panel Fields

178

The fields on this panel are: Creator ID

1- to 8-character Creator ID of the table for which the primary key is being defined or modified. DB2 LIKE syntax is used to display a selection list. If the field is blank or '%' is specified, a list of tables which have primary keys defined is displayed, as specified in the Table Name field, for all Creator IDs. To create a generic primary key, specify an asterisk in this field (refer to Section 4.1.4 Defining Generic Primary Keys for more information).

Table Name

1- to 18-character name of the table for which the primary key is being defined or modified. DB2 LIKE syntax is used to display a selection list. If the field is blank or '%' is specified, a list of all tables that have primary keys defined, based on the specified Creator ID, is displayed.

Primary Key Type

Specifies whether the primary key selection list includes primary keys defined in the PST Directory (P) or the DB2 Catalog (D), or both (B).

Use '_' for DB2 LIKE character

Specifies whether the underscore, '_', is to be used as a DB2 LIKE character or used literally as part of the name. For example, A_B could be assumed to be a threecharacter name containing the characters 'A_B' as entered or a three-character name

Move for DB2

4.1 Primary Keys that begins with ‘A’, end with ‘B’, and has any valid character in the middle. The default is No which means that '_' is not handled as a DB2 LIKE character. Explicit Table Name

Selection List

User Manual

When an explicit Creator ID and Table Name are supplied: •

MOVE checks the DB2 Catalog for the specified table and, if a primary key is defined, displays the primary key information. This information is not modifiable.



When the DB2 Catalog does not contain a primary key for an existing table, MOVE checks the PST Directory. If there is a primary key defined in the PST Directory, it is displayed and is modifiable.



If the table exists, but primary key information is not available, MOVE assumes you want to define a new primary key for the table. Once completed, the primary key definition is stored in the PST Directory.



If the table does not exist, an error message is displayed on the Choose a Primary Key panel.

A selection list is requested by using DB2 LIKE syntax or leaving a field blank. (You must specify at least one character in one of the fields along with the DB2 LIKE syntax.) •

MOVE constructs a list of tables for which primary keys are defined in the DB2 Catalog, the PST Directory, or both, depending on the value specified for the Primary Key Type field on 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.

179

4. Definitions

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 --___ ___ ___ s__

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 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 key is defined. The Creator ID and table name are displayed. An asterisk, *, in the Creator field indicates a generic primary key. The Type field indicates whether the primary key is defined in the PST Directory (PST) or the DB2 Catalog (DB2). The Type field is also used to indicate that a primary key is being modified by another user (*Busy) or that a PST primary key has been deleted during this session (*Deleted). Once a key has been deleted, the line command area for that entry is protected. Description

A user option controls whether or not the description of each PST primary key is displayed on this panel. See Section 6.1 User Options for information about the Selection List Format option.

Line Commands

The Cmd field on the left side of the panel is used to enter line commands. The following line commands are available:

180

S

Select a primary key. PST primary keys can be modified and, if selected, are displayed on the Modify PST Primary Key panel. (See section 4.1.3 Modifying a Primary Key for more information.) DB2 primary keys cannot be modified and, if selected are displayed on the Browse DB2 Primary Key panel.

D

Delete a PST primary key. After deleting, the message “*DELETED” appears in the Date field. A DB2 primary key cannot be deleted.

C

Copy a primary key to create a new one. The Copy Primary Key panel prompts for the name of the new primary key. The message

Move for DB2

4.1 Primary Keys “*COPIED” appears in the Date field under the heading Last Modified. (See page 182 for more information.)

Primary Key Attributes

R

Rename a primary key. The Rename Primary Key panel prompts for the new name of the selected primary key. The message “*RENAMED” appears in the Date field under the heading Last Modified. (See page 182 for more information.)

AT

Modify attributes of a primary key. The Object Attributes panel allows you to edit the description of the primary key. (See page 182 for more information.)

I

Display information about the primary key attributes.

To display the attributes of a primary key, type I in the Cmd field next to the name of the primary key. The following figure shows the Primary Key Attributes panel.

------------- Primary Key Attributes ----------------COMMAND ===> Table ID Table Name Description

: PSTDEMO : SHIP_TO :

Last Modified By Modified On

: PSTUSER : 1999-12-29-08.16.08

Figure 93. Primary Key Attributes This is a read-only display. Relational Tools generates and maintains all of the information on this panel based on your specifications for the primary key. (See Specify Description and Security Status in Section 6.1 User Options for information about the panel.)

User Manual

181

4. Definitions Object Attributes

To modify the description of a primary key, type AT in the Cmd field next to the name of the primary key to display the Object Attributes panel.

+-------------------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 and edit the description Copy a Primary Key

To copy a primary key, type C in the Cmd field next to the name of the primary key. The following figure shows the Copy Primary Key panel. +------------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 original primary key and prompts for the new two-part name for the copy. A primary key can only be copied if the destination table exist with the same key columns as the source table. Rename a Primary Key

To rename a primary key, type R in the Cmd field next to the name of the source primary key. The following figure shows the Rename Primary Key panel. +-----------Rename Primary Key----------+ ¦ ¦ ¦ Existing Name: PSTDEMO.CUSTOMERS ¦ ¦ ¦ ¦ New Name: ¦ ¦ ¦ ¦ Creator ID ===> PSTUSER ¦ ¦ Table Name ===> CUSTOMERS ¦ +---------------------------------------+

Figure 96. Rename Primary Key

182

Move for DB2

4.1 Primary Keys The Rename Primary Key panel displays the current name of the primary key and prompts for a new two-part name. A primary key can only be renamed if the destination table exists with the same key columns as the original table. Primary Commands

The following primary commands are available: Use the FIND command to locate a specific character string anywhere in the selection list. For example, FIND PST will locate the character string 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 keys containing the specified string in either the Creator, Table, or Type fields. For example, SHOW CUST displays only the primary keys that contain CUST in any of these fields. Use SHOW ALL to restore the 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 Type field. Use the LOCATE command to locate a value that is equal to or greater than the specified search value. The LOCATE command searches 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 CANCEL DOWN

User Manual

END LIST TABLES OPTIONS

SELECT TOP UP

183

4. Definitions

4.1.3 Modifying a Primary Key When you specify the fully qualified name of a table that has a PST primary key, the Modify PST Primary Key panel is displayed. When you specify the fully qualified name of table that does not have a primary key, the Define PST Primary Key panel is displayed to enable you to create a primary key. The operation of these panels is identical.

----------------------- 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 ----------------------- --------------***************** TOP ***************** SHIP_INSTR_ID DECIMAL(5,0) *************** BOTTOM ****************

1 OF 1

Figure 97. Modify PST Primary Key Panel Fields

The fields on this panel are: Cmd

Column Name

Line command entry field. The possible line commands are: D, Dn or DD

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, Mn or 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.

Names of the columns to be included in the primary key. At least one column name must be specified. A maximum of 64 columns containing a total of 254 bytes can be specified.

Data Type

Data type of the column. This field is provided for information and cannot be modified. When you specify a column name, MOVE automatically displays the data type for that column in this field.

The name of the table is included in the INSTRUCTIONS on the panel.

184

Move for DB2

4.1 Primary Keys Description

You can specify a description for any primary key stored in the PST Directory. You cannot supply a description for primary keys stored in the DB2 Catalog. Use the ATTRIBUTES command to display the Object Attributes panel for a PST primary key. This panel provides a 40-character area to display and edit the description. For additional information about the Object Attributes panel see Specify Description and Security Status in Section 6.1 User Options.

Selection List of Columns

A selection list of the columns in the table can be displayed using the LIST COLUMNS command. Assume the LIST COLUMNS command is entered to display the columns in the SHIP_INSTR table. The Select One or More Columns prompt is displayed. Only the columns 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 the column. The Cmd field on the left side of the prompt is used to enter line commands. 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 selected columns are inserted in the list of columns comprising the key. You may redisplay and select from the list of columns as needed. Selection List of Indexes

You can use the LIST UNIQUE INDEX primary command to obtain a list of unique indexes for the table. You can select an index from the list to be used as the primary key. MOVE uses the column names from the index 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 timeconsuming.

User Manual

185

4. Definitions Specification Complete

When you are satisfied with the specifications for the primary key, press ENTER or use END to signal the end of the Modify PST Primary Key panel processing. The primary key information is stored in the Directory. It is automatically used the next time the table is accessed. This primary key information is available to all MOVE users, therefore it only needs to be defined once for any table.

Deleting a Primary Key

Use the DELETE command on the Modify PST Primary Key panel to delete a primary key. You can also delete the primary key by erasing all of the column names and then using END.

Available Primary Commands

The following primary commands are available: ATTRIBUTES BOTTOM CANCEL DELETE

DOWN END GENERIC LIST COLUMNS

LIST UNIQUE RESET TOP UP

4.1.4 Defining Generic Primary Keys Frequently, sets of tables are created that contain the same base names, columns, and attribute specifications but are distinguished by different Creator IDs. This enables users or groups of users to have their own set of tables and data. Rather than define an explicit primary key for each table, you can define a generic primary key to be used for all tables having the same base name, regardless of the Creator ID. Generic primary keys are always identified by an asterisk, *, as the Creator ID. You can create a generic primary key in the same manner as an explicit primary key, or you can convert an existing primary key to a generic primary key as described in this section.

186

Move for DB2

4.1 Primary Keys Creating a Generic Key

To create a generic primary key, select Option 1 PRIMARY KEYS on the Choose a Definition Option panel. The Choose a Primary Key panel is displayed. Type an asterisk in the CREATOR ID field and the desired table name in the TABLE NAME field. In the following example, *.SHIP_INSTR is specified.

---------------------------- Choose a Primary Key ---------------------Command ===> Primary Key: Creator ID ===> * Table Name ===> SHIP_INSTR Primary Key Type

===> B

Use '_' for DB2 LIKE character ===> N

(P-PST, D-DB2, B-Both) (Y-Yes, N-No)

Figure 99. Name a Generic Primary Key Before you can specify the columns to be included in the generic primary key, MOVE requires that you supply a Creator ID to identify a table that will be used as a base table to validate the generic primary key definition. When you press ENTER on the Choose a Primary Key panel, the Define PST Primary Key panel is displayed and overlaid with a CreatorID Prompt panel, as shown in the following figure.

-------------------------- 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 the INSTRUCTIONS text of the Define PST Primary Key panel is replaced with the Creator ID. You can then specify the columns to be included in the generic key as documented previously in this section for explicit keys. This generic primary key can be used by all tables named SHIP_INSTR containing the key columns regardless of Creator ID.

User Manual

187

4. Definitions Converting to a Generic Key

To convert an explicit primary key to a generic key, use the GENERIC command. The GENERIC command can be entered on the Modify PST Primary Key or the Define PST Primary Key panels to convert the currently displayed explicit primary key into a generic primary key. The GENERIC command is also available when browsing a DB2 primary key. (A generic primary key cannot be converted into an explicit primary key.) During the conversion of a PST primary key, the following prompt is displayed. Specify whether the original, explicit primary key is to be deleted or retained as requested on the prompt.

-------------------------- Modify PST Primary Key -----------------------COMMAND ===> SCROLL ===> CSR INSTRUCTIONS:

Cmd --*** ___ ***

Modify PST Primary Key for PSTDEMO.SHIP_INSTR Limit Key to 64 Columns and 254 Bytes

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 Duplicate Name

If the generic key name already exists, the following prompt is displayed prior to the Confirm GENERIC Processing prompt. You can 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

188

Move for DB2

4.1 Primary Keys Modifying a Generic Key

If the generic key specified on the Choose a Primary Key panel or Select Primary Keys panel exists, the Modify PST Primary Key panel is displayed. You are prompted for a Creator ID to identify a base 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 to create the generic key, but all of the columns referenced in the key must be included in the new base table. If the key columns are not contained in the table indicated by the Creator ID you specify, you are given the choice of respecifying the Creator ID or overriding the existing generic key. If you elect to override, the existing generic key is deleted and you are prompted to specify columns from the table identified with the new Creator ID. After a base table is established, you may use the facilities described for modifying a primary key. Using Generic Primary Keys

User Manual

There is no difference in function or appearance between generic keys and explicit keys. Explicit primary keys take precedence over generic keys. Therefore, if an explicit primary key exists for an individual table it will be used regardless of whether a generic key exists.

189

4. Definitions

4.2 Relationships MOVE enables you to define relationships prior to extracting data when the required relationships are not already provided in the DB2 Catalog. You can request the prompts to define relationships using:

Extended Relationships



Option 2 RELATIONSHIPS on the Choose a Definition Option panel.



The CREATE RELATIONSHIP command issued from the Access 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 explicit Princeton Softech’s “extended” relationships. These extended relationships are more flexible than those defined to DB2. DB2 relationships require that each parent table have a primary key that contains between 1 and 64 columns and guarantees uniqueness. DB2 relationships also require that each child table have a corresponding foreign key consisting of the same number of columns. Corresponding columns in the primary and foreign keys must have identical 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 table and a list of corresponding columns from another table. The corresponding columns need not be identical, but must be compatible. Compatible column types are described in Appendix F. Compatibility Rules for Relationships.



In addition to corresponding column lists, any column name can be replaced by an expression that may include string literals, numeric constants, concatenation, and substrings.

This flexibility allows PST relationships to reflect the type of relationships found in many applications and allows Relational Tools to manipulate relational sets of data as desired.

190

Move for DB2

4.2 Relationships

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 the following figure. This panel is also displayed when the CREATE RELATIONSHIP command is entered from the Access Definition table list or relationship list.

---------------------------- Choose a Relationship -----------------------------OPTION ===> 3 1 2 3

CREATE MODIFY LIST

- Create a Relationship for Specified Parent or Child Table - Modify a Relationship for Specified Child Table - 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 ===> Use '_' for DB2 LIKE character

===> N

(P-PST, D-DB2, B-Both) (Y-Yes, N-No)

Figure 104. Choose a Relationship Panel When specifying a table on this panel, you can provide a complete Creator ID and table name, referred to as a fully qualified table name in the following text. Alternatively, you can provide DB2 LIKE syntax for either or both of these fields, referred to as a partial table name. (You must specify at least one character for either of these fields along with the DB2 LIKE syntax.)

User Manual

191

4. Definitions Panel Options

The options on this panel are: 1 CREATE

Use this option to create a new relationship involving the specified table. If a fully qualified table name is supplied, the Create a New Relationship panel is displayed. If a partial table name is supplied, a selection list of tables is displayed. Once you select a table from the list, the Create a New Relationship panel is displayed. In either case, if you provide a Relationship Name on the Choose a Relationship panel, it is automatically displayed on the Create a New Relationship panel. Alternatively, you can omit the relationship name initially and provide it on the Create a New Relationship panel. The specified table can be either the parent or child in the relationship—you specify this on the Create a New Relationship panel. This panel is described in Section 4.2.3 Creating a Relationship.

2 MODIFY

Use this option to modify an existing relationship. Relationships are uniquely identified by the fully qualified child table name and the relationship name. If you specify the fully qualified child table name and the relationship name, the Modify Relationship panel is displayed. If you specify a partial child table name or relationship name, a selection list of relationships is displayed. Once you select a relationship, the Modify Relationship panel is displayed.

3 LIST

Use this option to list the relationships in which the specified table is either a parent or child. If a fully qualified table name is supplied, a selection list of relationships involving the named table is displayed. If a partial table name is supplied, a selection list of tables is displayed. Select one or more tables from this list to generate a selection list of relationships in which at least one selected table participates. The selection list is discussed in Section 4.2.2 Selection List of Relationships.

192

Move for DB2

4.2 Relationships Panel Fields

The fields on this panel are: Creator ID

1- to 8-character Creator ID of the table for which the relationship is being created or modified. Use DB2 LIKE syntax or leave this field blank to generate a selection list. To create a generic relationship, specify an asterisk in this field (refer to Section 4.2.7 Generic Relationships for details).

Table Name

1- to 18-character name of the table for which the relationship is being created or modified. Use DB2 LIKE syntax or leave this field blank to generate a selection list.

Relationship Name

1- to 8-character name of the relationship. Use DB2 LIKE syntax or leave this field blank to generate a selection list for Option 2.

Relationship Type

Specifies whether the relationship selection list includes relationships defined in the PST Directory (P), the DB2 Catalog (D), or both (B). This field is applicable only for Options 2 and 3.

Use '_' for DB2 LIKE Specifies whether the underscore, '_', is to be used as a DB2 LIKE character or used character literally as part of the name. For example, A_B could be assumed to be a threecharacter name containing the characters '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 not handled as a DB2 LIKE character.

User Manual

193

4. Definitions

4.2.2 Selection List of Relationships When a selection list is requested using Option 2 or 3 on the Choose a Relationship panel, the Select Relationships panel is displayed. Assuming the table PSTDEMO.CUSTOMERS was specified and Option 3 was selected on the Choose a Relationship panel, the following 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 sorted using the SORT command (see the information in this section about primary commands for details). Each line in the selection list displays a single relationship. The list provides the Creator ID and table name of the parent table and the child table, and the name of the relationship. The Type field indicates whether the relationship is defined in the PST Directory (PST) or the DB2 Catalog (DB2). The Type field is also used to indicate a generic relationship (GEN). Description

A user option controls whether or not the description of each PST relationship is displayed on this panel. Site management determines whether this panel also displays a prompt for Security Status. See Section 6.1 User Options for information about the Selection List Format option.

Line Commands

The Cmd field on the left side of the panel is used to enter line commands. The following line commands are available:

194

S

Select a relationship. PST relationships are modifiable. DB2 relationships are not modifiable.

D

Delete a PST relationship. You cannot delete a DB2 relationship.

Move for DB2

4.2 Relationships

Relationship Attributes

C

Copy a relationship to create a new one. The Copy Relationship panel prompts for the name of the copied version of the relationship. After copying, the message “*COPIED” appears in the Date field under the heading Last Modified (See page 196 for more information.)

R

Rename a relationship. The Rename Relationship panel prompts for the new name of the selected relationship. After renaming, the message “*RENAMED” appears in the Date field under the heading Last Modified. (See page 197 for more information.)

AT

Display the Object Attributes panel for the selected relationship. This command is only available for PST relationships. (See page 196 for more information.)

I

Display information about a relationship.

LR

List all of the relationships that involve the table that was not specified on the Choose a Relationship panel or selected from a table selection list. For example, if LR is entered for the last relationship displayed in the previous figure, the resulting list would include all of the relationships involving PSTDEMO.SALES as the parent or child in the relationship.

To display the attributes of a relationship, type I in the Cmd field next to the name of the relationship. The following figure shows the Relationship Attributes panel.

-------------------------- Relationship Attributes -------------------------Command Child Table ID Child Table Name Relationship Name

: PSTDEMO : ORDERS : RCO

Description Security Status Last Modified By Modified On

: : PUBLIC : PSTDEMO : 1999-12-21-09.58.37

Parent Table ID Parent Table Name

: PSTDEMO : CUSTOMERS

Figure 106. Relationship Attributes Panel This is a read-only display. MOVE generates and maintains all of the information on this panel based on your specifications for the relationship.

User Manual

195

4. Definitions Object Attributes

To modify the description and security status of a relationship, type AT in the Cmd field next to the name of the relationship to display the Object 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 display and edit the description. An 8-character area is available to specify one of the following security statuses: PUBLIC PRIVATE READONLY

Anyone can edit and use. Only owner can edit and use. Anyone can use, only owner can edit.

Based on installation options, site management can establish that users may not specify security status on this panel. In that case, the prompt for security status is replaced with “Not Active” on the panel. Any attempt to change the security status will result in an error message. (See Specify Description and Security Status in 6.1 User Options for information about the panel. Copy a Relationship

To copy a relationship, type C in the Cmd field next to the name of the source relationship. The following figure shows the Copy Relationship 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 original relationship and prompts for the new three-part name for the copy. A

196

Move for DB2

4.2 Relationships relationship can only be copied when the participating tables of the new relationship exist. Rename a Relationship

To rename a relationship, type R in the Cmd field next to the name of the relationship. The following figure shows the Rename Relationship 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 the relationship and prompts for a three-part name. Primary Commands

Several primary commands are available. Use the FIND command to locate a specific character string anywhere in the selection list, for example, FIND ITEMS. RFIND is used to find subsequent occurrences using the same FIND search criteria, but continuing from the current cursor position. Use the SHOW command to redisplay a selection list of relationships for tables with the specified string in the Creator ID, table name, relationship name or relationship type fields. For example, SHOW CUST displays only the relationships between tables that contain CUST in either of the Creator IDs or table names, or the relationship name. 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 have the headings Creator and Table, the following are available: SORT TABLE SORT CREATOR SORT PTABLE SORT PCREATOR SORT CHILD SORT PARENT SORT RELATION

User Manual

Sorts using the values in the Child Table field. Sorts using the values in the Child Creator field. Sorts using the values in the Parent Table field. Sorts using the Parent Creator field. Sorts using the fully qualified child table name. Sorts using the fully qualified parent table name. Sorts using relationship name.

197

4. Definitions SORT TYPE

Sorts using type of relationship. (Use this to group the DB2 relationships and the PST relationships.)

Use the LOCATE command to locate a value that is equal to or greater than the specified search value. The LOCATE command searches for the value in the field sorted last or, by default, the Creator ID of the child table. In addition to the commands described above, the following primary commands are also available: BOTTOM CANCEL Relationship Selected

DOWN END

LIST OPTIONS

SELECT TOP

UP

If you select a PST relationship, the Modify Relationship panel is displayed. (This panel is discussed in Section 4.2.4 Editing Relationships.) If you select a DB2 relationship, the Browse DB2 Relationship panel is displayed. If you select more than one relationship, MOVE displays each relationship in turn as you use END. After all relationships have been displayed, 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 a fully qualified table name is specified, either on that panel or from the subsequent table selection list, the Create a New Relationship panel is displayed, as shown in the following figure.

--------------------------- Choose a Relationship --------------------------OPTION ===> 1 2 3

CREATE - Create a Relationship for Specified Parent or Child Table M 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

198

Move for DB2

4.2 Relationships Panel Fields

The fields on this panel are: Specified Table

The table name specified on the Choose a Relationship panel. This is a protected, nonmodifiable field.

Table Type

Indicate whether the Specified Table is the parent (P) or child (C) table in this relationship. For example, if you specify P, MOVE assumes the table specified as the Other Table is the child. If you specify C, MOVE assumes the Other Table is the parent. The default value is C, however this value is profiled and retained across MOVE sessions.

Other Table Creator ID

Specify the Creator ID of the other table in the relationship. To generate a selection list of tables, leave this field blank or specify DB2 LIKE syntax. By default, the Creator ID specified for the corresponding table is assumed.

Table Name

Specify the table name of the other table in the relationship. To generate a selection list of tables, leave this field blank or specify DB2 LIKE syntax.

Relationship Name

If you specified a relationship name on the Choose a Relationship panel, that name is displayed in this field. Otherwise, the field is blank. Specify a 1- to 8-character relationship name.

When you have filled in this panel, press ENTER to display the Define Relationship panel to create a new relationship or the Modify Relational panel to edit an existing relationship.

4.2.4 Editing Relationships When you enter the required information on the Create a New Relationship panel, the Define Relationship panel is displayed. When you select an existing relationship, either explicitly on the Choose a Relationship panel or from a selection list, the Modify Relationship panel is displayed. The Define Relationship and Modify Relationship panels are identical except for the panel title and text, which reflect the current activity. Description

User Manual

At any time during the session you can specify a description for any relationship you are editing. Use the ATTRIBUTES command to

199

4. Definitions display the Object Attributes panel. This panel provides a 40character area to display and edit the description. (Site management determines whether this panel also displays a prompt for Security Status.) For additional information about the Object Attributes panel see Specify Description and Security Status in Section 6.1 User Options. Define Relationship panel

A sample Define Relationship panel is shown in the following figure. The upper portion of the panel indicates the relationship name and lists commands that are especially useful when defining or modifying a relationship. The lower portion of the panel is divided into two parts. The left portion displays the parent table name followed by space for a list of parent table column names and data types. The right portion indicates the child table name followed by space for a list of 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 Cmd --*** ___ ***

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 111. Define Relationship Panel MOVE provides several editing facilities for constructing a relationship. Most often, a relationship is composed of corresponding lists of columns from the parent and child tables. There are three ways to populate a relationship definition with column names. 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 the Define Relationship panel with as much meaningful relationship information as possible.

200

Move for DB2

4.2 Relationships Existing Primary Key

If the parent table has a primary key, the primary key column names and data types are populated on the left side of the panel. If the child table contains any column names that match the primary key column names and have compatible data types, those column names are populated on the right side of the panel. (Note that unlike a DB2 relationship, a PST relationship does not require that corresponding columns have identical attributes. However, corresponding columns must be compatible, as defined in Appendix F. Compatibility Rules for Relationships of this manual.) When there are no matching names in the child table, MOVE checks the child table for a single column with identical attributes, regardless of the name. If there is only one column with identical attributes, that column name is inserted. Otherwise, no child table column names are inserted. If the parent table does not have a primary key, a blank line is provided for you to enter column names for the parent table and the child table.

Manually Inserting Column Names Regardless of whether column names have been automatically populated by MOVE, you can manually insert additional column names. Use the I line command to insert a blank line in the relationship definition. You can then type the column names in the appropriate fields. MOVE automatically inserts the data type of the column in the Data Type field. Literals and Constants

In addition to specifying column names, you can enter character string literals and numeric constants in the child and parent Column Name fields. For example, instead of specifying the column name CUST_ID, you can specify the value 50215 as a string literal by entering the following in the Column Name field: '50215' String literals must be enclosed in single quotes. Only a string literal can be specified if the corresponding column has a data type of CHAR or VARCHAR. You cannot specify NULL as a literal value. A numeric constant can only be specified if the corresponding column has a data type of DECIMAL, INTEGER, or SMALLINT. Numeric constants cannot contain floating point or hexadecimal values. At least one parent table column and one child table column must be referenced in a relationship and at least one relationship entry must relate 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

User Manual

201

4. Definitions a literal or constant to a literal or constant. MOVE issues an error message for either of these conditions. When you specify a literal or a constant in a Column Name field, the Data Type field for that column reflects the attributes of the string literal or numeric constant.

--------------------------- Define Relationship ------------------------COMMAND ===> SCROLL ===> CSR Define Relationship CUSTORD Special Commands: LIST COLUMNS, EXPAND, GENERIC, MODEL Parent: PSTDEMO.CUSTOMERS Cmd --*** ___ ___ ***

Child: PSTDEMO.ORDERS

1 OF 1 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 Data Driven Relationships

202

A table is sometimes related to one of many other child tables based on the data in a particular column. This is referred to as a data driven relationship. You can define such a relationship by using literals. To demonstrate, consider the following sample tables used to determine employee insurance rates for males and females.

Move for DB2

4.2 Relationships The EMPLOYEE table contains each employee’s ID, age, and sex. EMPLOYEE EMPLOYEE_ID AGE 058-44-2244 38 106-46-0619 40 248-91-2890 27

SEX F M M

The FEMALE_RATES table contains the insurance rates used for females based on the female’s age. The MALE_RATES table contains the insurance rates used for males based on the male’s age. FEMALE_RATES AGE RATE 38 .25 39 .33 40 .43

MALE_RATES AGE 38 39 40

RATE .31 .38 .47

The EMPLOYEE table should be related to the FEMALE_RATES table if the employee is female, and to the MALE_RATES table if the employee is a male. To accomplish this, two relationships are defined. The first relationship relates the EMPLOYEE table to the FEMALE_RATES table when the SEX column corresponds to the string literal 'F'. The AGE column in the EMPLOYEE table corresponds to AGE column in the FEMALE_RATES table. EMPLOYEE

SEX AGE

FEMALE_RATES

'F' AGE

The second relationship relates the EMPLOYEE table to the MALE_RATES table and is identical to the first relationship, except that the SEX column corresponds to the string literal 'M'. EMPLOYEE

SEX AGE

MALE_RATES

'M' AGE

Therefore, for any given row in the EMPLOYEE table, only one of the relationships can be satisfied, since the column EMPLOYEE.SEX must be 'M' or 'F'. Once the appropriate relationship is chosen, the related rows are identified by comparing the AGE columns.

User Manual

203

4. Definitions Selecting Columns from a List Selecting column names from a selection list is faster and less error-prone than inserting them manually. You can list the columns in the parent or child table by using the LIST COLUMNS command. Columns already included in the relationship are not displayed in the list. The list includes the data type of each column to assist you in selecting compatible columns. To demonstrate, assume that the following command has been entered: LIST COLUMNS CHILD Along with the selection list prompt, the Define Relationship panel is redisplayed with a new field, Num, and the columns in the parent table are numbered. This enables you to select each desired child column by specifying the number of the corresponding parent column. In the following figure, a 1 is typed in the Cmd field to the left of CUST_ID to match it to the CUST_ID column in the CUSTOMERS table.

----------------------------- Define Relationship ---------------------------COMMAND ===> SCROLL ===> CSR Define PST Relationship CUSTORD Special Commands: LIST COLUMNS, EXPAND, GENERIC, MODEL

Cmd --*** ___ ___ ___ ***

Parent: PSTDEMO.CUSTOMERS

Child: PSTDEMO.ORDERS

Num Column Name Data Ty --- ------------------------ ------********************************* TO 1 CUST_ID CH(5) 2 ADDRESS VCH(50) 3 CITY VCH(15) ******************************* BOTT

+------------ Child Columns -------+ | | | Select Columns by Matching 'Num' | | | | Num Column Name Data Type | | --- ----------------- ---------- | | *** *********** 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 is reached. The column selection numbers must be sequential. You can specify a number that exceeds the last numbered entry on the panel by one, to insert a new entry in the relationship. Additional new entries are inserted if you specify a sequential series of numbers that begin with the number one greater than the number of the last entry.

204

Move for DB2

4.2 Relationships When END is used, the selected column name is inserted in the appropriate Column Name field of the child table, as shown in the following 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 Cmd --*** ___ ___ ___ ***

Child: PSTDEMO.ORDERS

1 OF 3 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 select columns from the selection list. These names are added, in the same order as shown on the selection list, at the end of the list in the Column Name field. Conversely, you can request a selection list of columns for the parent table using the LIST COLUMNS PARENT command. The selection list prompt overlays the parent table and the columns in the child table are numbered. You can use cursor position to indicate the table name when using the LIST COLUMNS command. Type the LIST COLUMNS command with no operands, position the cursor on the desired table name or list of columns, and press ENTER. The appropriate column selection list is displayed. Expressions One of the most powerful features of PST relationships is the ability to combine columns with concatenation and use partial columns with the substring function. Concatenating Columns

Often the data contained in two or more columns in one table is contained in a single, composite column in another table. To define this type of data structure in a relationship, use the concatenation operator to concatenate multiple columns. The concatenation operator (CONCAT or || ) can be specified in the parent or child Column Name fields. For example, assume that the parent table, CUSTOMERS, contains an ADDRESS1 column for the customer’s street and an ADDRESS2

User Manual

205

4. Definitions column for apartment information. Assume that the child table, ORDERS, contains only one column, ADDRESS, for both the street and apartment information. To relate the two columns to the single column, concatenate ADDRESS1 and ADDRESS2 by entering one of the following 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 the ORDERS table, as shown in the following figure. When you specify a concatenation operator in a Column Name field, the Data Type field for that column reflects the attributes of the expression formed by the concatenation. If the data type for ADDRESS1 is CHAR(25) and ADDRESS2 is CHAR(25), the data type of the concatenated expression is CHAR(50).

--------------------------- Define Relationship --------------------------COMMAND ===> SCROLL ===> CSR Define Relationship CUSTORD Special Commands: LIST COLUMNS, EXPAND, GENERIC, MODEL Parent: PSTDEMO.CUSTOMERS Cmd --*** ___ ***

Child: PSTDEMO.ORDERS

1 OF 1 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 can use the EXPAND command to display the specified column in the expanded editor window (refer to page 208 for details on EXPAND). Concatenation Rules

Substringing Columns

206

Observe the following rules when defining a concatenated expression: •

Only CHAR or VARCHAR columns, string literals, and substring functions can be specified.



Special Registers are not supported.



A zero-length string literal, usually indicated as ' ', is not valid in a concatenated expression.

When one column in a table contains the data that is contained in two or more columns in another table, you may find it useful to use a portion of this composite column in a relationship. To do so, use the SUBSTR function to retrieve a substring of the contents of a character column.

Move for DB2

4.2 Relationships The MOVE SUBSTR function is identical to the DB2 SUBSTR function in format and operation: SUBSTR(column-name,start,length) where: column-name

Specifies the name of a CHAR or VARCHAR column.

start

Specifies the starting position of the substring as an integer (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, the substring consists of the data beginning at the start position through the last character.

The combined value of start and length cannot exceed the length attribute of the column. To demonstrate, suppose a table contains a PHONE_NUMBER column with a CHAR(10) data type, but you want to use only the first three positions of the column (the area code) in a relationship. Enter the following SUBSTR function in the Column Name field of the Define Relationship panel: SUBSTR(PHONE_NUMBER,1,3) When you specify a substring function in a Column Name field, the Data 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 Cmd --*** ___ ***

Child: PSTDEMO.ORDERS 1 OF 1 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 the EXPAND command to display the specified column in the expanded editor window (refer to page 208 for details on EXPAND). Concatenate or Substring

User Manual

When a relationship is based on a composite column, it can be defined as a concatenation, as shown below:

207

4. Definitions

Parent: PSTDEMO.TABLE1 Cmd --*** ___ ***

Child: PSTDEMO.TABLE2

1 OF 1 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 Cmd Column 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 will retrieve the same set of related rows, the concatenation is more efficient than the series of substrings. In general, concatenation results in better performance because it directs DB2 to use an index if one 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-order portion of a column, therefore, DB2 will not use an index on the ADDRESS column, even if one exists. As a result, DB2 must scan all rows in the table. Editing Long Column Name Field Values Often the amount of space available on the Define Relationship panel is insufficient for long Column Name field values—especially when expressions containing concatenation and substrings have been specified. If the length of a column name or expression exceeds the space available on the panel, the data display for that column is truncated, protected and cannot be edited directly. Use the EXPAND command to display the Expanded Relationship Editor prompt. This prompt enables you to modify both the parent and child columns by providing a 75-character field for each column.

208

Move for DB2

4.2 Relationships Type the EXPAND command in the command area, position the cursor 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 Cmd

Column Name

Child: PSTDEMO.ORDERS Data Type

Column Name

1 OF 3 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 scroll to the previous or next column pair using the UP, DOWN, TOP, or BOTTOM commands. The LIST COLUMNS command (described on page 204) is available while the expanded window is displayed. However, in this context, the command provides a selection list from which one column may be selected using the S line command. The selected column is added to the end of the column specification, preceded by the concatenation operator, . 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 and return to the Define Relationship panel. Changes made to a column pair prior to scrolling cannot be abandoned with the CANCEL command. Use END to return to the Define Relationship panel. If the length of the column name exceeds the space available, the data is truncated and protected. You can use the EXPAND command again to respecify the data. Editing with Line Commands The facilities described in the previous sections are used to populate a relationship with column names and expressions, but you can also manipulate individual lines or parts of lines in a relationship.

User Manual

209

4. Definitions Line Commands

The following line commands are available on the Define Relationship and Modify Relationship panels. Line commands are entered in the Cmd field. D[n]

Deletes one or more lines. n is the number of lines to be deleted. If n is omitted, one line is deleted. Use the block form (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 and press EOF or overtype the field with blank.

210

I[n]

Inserts one or more blank lines. n is the number of lines to be inserted. If n is omitted, one line is inserted.

R[n]

Repeats a line one or more times. n is the number of times the line is to be repeated. If n is omitted, the line is repeated once. 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 be copied. If n is omitted, one line is copied. Use the block form (CC) to copy a block of lines.

M[n]

Moves one or more lines. n is the number of lines to be moved. If n is omitted, one line is moved. Use the block form (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 moved lines.

EXP

Column names and values are protected if they exceed the space available in the Column Name field. Use the EXP line command to display the Expanded Relationship Editor prompt for editing long column names or values.

Move for DB2

4.2 Relationships Merging Lines with Overlay

The O (Overlay) line command enables you to merge copied or moved lines with a target line. Consider the following example in which a move operation is performed. Cmd Column Name Data Type Column Name Data Type --- ------------------------- --------- ------------------------ --------*** ********************************* TOP ********************************* m__ CUST_ID CH(5) REQUIRED o__ REQUIRED CUST_ID CH(5) *** ******************************** BOTTOM ******************************

When ENTER is pressed, the CUST_ID column name and data type are 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) REQUIRED o__ 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 that would overlay data on the target line, the Move request is changed to a Copy request to prevent the loss of data. MOVE displays a message in the upper right corner of the panel indicating that the line was not deleted. You can then use the original data as a guide to assist in further editing. Other Primary Commands for Editing Several primary commands are available on the Define Relationship and Modify Relationship panel. •

User Manual

Use the RESET primary command to remove any pending line commands or line commands in error.

211

4. Definitions •

Use the CLEAR command to remove all column specifications from the Define Relationship or Modify Relationship panels. This is useful when you want to completely redefine the relationship.



Use the DELETE command to delete the currently displayed relationship and return to the previous panel. Note that the currently displayed relationship will also be deleted if all of the entries 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 the relationship. Therefore, a concatenated entry in the Column Name field cannot include more than 64 columns. If an entry does include 64 columns, there can be no other entries in the Column Name field. Also, the total length of all of the values specified in the Column Name field cannot exceed 254 characters. If the specification in a single Column Name field contains 254 characters, no other Column Name 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 you press ENTER on the Define Relationship or Modify Relationship panel. If they are not, an error message indicating the cause of the error is displayed and the cursor is positioned on the first column entry in error. Use HELP (usually assigned to PF1) to display a fullscreen of information about the error. You must correct any incompatibility before saving the relationship. Use the SAVE command to save a relationship but continue defining that relationship. Use END (usually assigned to PF3) to save the relationship and return to the Choose a Relationship panel. In both cases, the relationship must be valid as described above. Use CANCEL to abandon the changes and return to the Choose a Relationship panel.

212

Move for DB2

4.2 Relationships Impact of Database Changes

A relationship defined in the Directory can be affected by changes made to the underlying tables. If a table specified in a relationship is dropped, the relationship is considered invalid and is not available to satisfy a JOIN request or an extract request. This relationship cannot be updated, however it can be deleted using the D line command from the selection list of relationships on the Select a Relationship panel. If a column specified in a relationship is dropped or is altered so that it is incompatible with its corresponding column, the relationship is considered invalid and is not available to satisfy a JOIN request or an extract request. If you attempt to update such a relationship, it is displayed in the relationship editor with an error message indicating that invalid entries have been specified. You can then correct the column specifications. Relationships are not affected if new columns are added to a table specified in a relationship, or when columns not included in the relationship are dropped or altered.

4.2.6 Modeling Relationships Once a relationship is defined in the DB2 Catalog or Directory, you can use it as a model for a new, similar relationship. On the Define Relationship or Modify Relationship panel, enter the MODEL command to display the following prompt.

--------------------------- Modify Relationship ---------------------------COMMAND ===> SCROLL ===> CSR Modify PST Relationship CUSTORD Special Commands: LIST COLUMNS, EXPAND, GENERIC, MODEL Par Cmd --*** ___ ***

--*** CUS ***

+------------------Model New Relationship------------------+ | | | Modify Child Table or Relationship Name to Create a new | | relationship with the current column specifications | | | | Parent Table: PSTDEMO.CUSTOMERS | | | | Child Table: | | Creator ID ===> PSTDEMO | | Table Name ===> ORDERS | | | | Relationship Name ===> newrel | +----------------------------------------------------------+

1 OF 1 a Type ------******* 5) *******

Figure 118. Model New Relationship Prompt The displayed information reflects the values for the currently displayed relationship. The name of the parent table is protected.

User Manual

213

4. Definitions You may overtype the Creator ID and Table Name of the child table and the Relationship Name. Since a unique relationship name is based on concatenating the Creator ID and Table Name of the child table with a Relationship Name, only these values may be changed when modeling a relationship. If Relationship Exists

If you specify a relationship that already exists, the following prompt is displayed when the existing relationship is defined in the Directory. (An error message is displayed if the existing relationship is defined in the DB2 Catalog.)

---------------------------- Modify Relationship ------------------------COMMAND ===> SCROLL ===> CSR

Pa Cmd --*** ___ ***

-** CU **

+--------------------Verify MODEL Command--------------------+ | | | The relationship name formed by the new child table name | | and relationship name will conflict with an existing |1 OF 1 | relationship. Indicate the action that should be taken. | Type | | ----| Press ENTER to Replace Existing Relationship and Proceed | ***** | 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 the Define Relationship panel for the new relationship. Use END to redisplay the prompt to enable you to alter the table name or the relationship name. Use CANCEL to cancel the MODEL command and 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 only by their Creator ID. With generic relationships, you specify the relationships once and use them for all of these sets of tables. In addition, when another set of these tables is created, they can also use these generic relationships. You can create a generic relationship in the same manner as any explicit relationship or by converting an existing, explicit relationship to a generic relationship. A generic relationship is identified by an

214

Move for DB2

4.2 Relationships asterisk, *, for the Creator ID. The tables used to define a generic relationship must have the same Creator ID. Creating a Generic Relationship

To create a generic relationship, specify Option 1 CREATE and an asterisk for the Creator ID, a table name, and a relationship name on the 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 2 3

CREATE MODIFY LIST

- Create a Relationship for Specified Parent or Child Table - Modify a Relationship for Specified Child Table - 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

User Manual

215

4. Definitions When you press ENTER, MOVE prompts for a Creator ID to determine which tables to use as the base tables.

--------------------------- Choose a Relationship --------------------------OPTION ===> 1 2 3

CREATE MODIFY LIST

- Create a Relationship for Specified Parent or Child Table - Modify a Relationship for Specified Child Table - 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 New Relationship panel is displayed.

--------------------------- Choose a Relationship --------------------------OPTION ===> 1 2 3

CREATE - Create a Relationship for Specified Parent or Child Table M 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 panel is displayed as the Specified Table. MOVE places an asterisk in the Other Table Creator ID field and protects the field. Provide the

216

Move for DB2

4.2 Relationships name of the Other Table in the relationship. When the panel is displayed for the first time, the Specified Table is assumed to be the child and the Other Table the parent. If you decide that the Specified Table should be the parent table, you can change the Table Type to P as shown in Figure 122. Create New Generic Relationship. MOVE then assumes the Other Table is the child. The value you specify for Table Type is profiled. When you have provided the name for the Other Table, press ENTER to display the Define Relationship panel (see Figure 111). Converting to a Generic Relationship

The GENERIC command can be entered on the Modify Relationship or Define Relationship panel to convert the currently displayed explicit relationship into a generic relationship. (A generic relationship cannot be transformed into an explicit relationship.) The following prompt is displayed. You can specify whether the explicit relationship 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 Cmd --*** ___ ***

-** CU **

Child: PSTDEMO.ORDERS

+-----------------Confirm GENERIC Processing-----------------+ | | | Press ENTER to Delete Existing Explicit Relationship | | Enter END Command to Retain Existing Explicit Relationship | | Enter CANCEL Command to Return to Relationship Editor | +------------------------------------------------------------+

1 OF 1 Type -----****** ) ******

Figure 123. Confirm GENERIC Processing Prompt If the name duplicates an existing generic relationship, a prompt is displayed. You can decide whether or not to replace the existing generic 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 User Manual

217

4. Definitions The GENERIC command only converts relationships in which both tables have the same Creator ID. If the tables do not have the same Creator ID, a message is displayed. Modifying a Generic Relationship

You can modify a generic relationship by specifying the relationship on the Choose a Relationship panel or selecting the relationship on the Select Relationships panel. Once a relationship is selected, the Modify Relationship panel is displayed. You are prompted for a Creator ID to identify the base tables. You are not required to specify the same Creator ID that was used to create the generic relationship. If you specify a different Creator ID, all of the columns referenced in the relationship must be included in the tables. If the columns are not contained in the tables indicated by the specified Creator ID, you are prompted to respecify a Creator ID or override the existing generic relationship. If you elect to override, the existing generic relationship is deleted and you can redefine the generic relationship. Assume you have specified a generic relationship named *.ORDERS.CUSTORD consisting of the CUSTOMERS table as the parent and the ORDERS table as the child. The prompt for a Creator ID is displayed.

-------------------------- Choose a Relationship -----------------------OPTION ===> 1 2 3

CREATE MODIFY LIST

- Create a Relationship for Specified Parent or Child Table - Modify a Relationship for Specified Child Table - 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

218

Move for DB2

4.2 Relationships Once a Creator ID is specified, the Modify Relationship panel is displayed, 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 Cmd --*** ___ ***

Child: *.ORDERS

1 OF 1 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 explicit relationship. Using Generic Relationships

There is no difference in function or appearance between generic relationships and explicit relationships. The same Creator ID is required for both tables when defining or modifying the generic relationship. When the generic relationship is used to join tables or extract data, the tables are not required to have the same Creator ID. Explicit relationships take precedence over generic relationships. If there are any explicit DB2 or PST relationships, they will be used. Generic relationships are only used when no explicit relationship exists between two tables.

User Manual

219

4. Definitions

4.3 Column Maps This section discusses how to define Column Maps. A Column Map is a set of instructions used by MOVE to transform source data into the 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:



Using Column Maps

-

Masking sensitive data.

-

Inserting literals, default values or DB2 special registers into columns.

-

Specifying an expression.

-

Adjusting date values in numeric, DATE, and TIMESTAMP columns.

-

Propagating changes to values in the primary key to the related foreign keys.

-

Deriving a value by executing a routine that converts the source 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 joined view.

-

Exclude columns from being copied to the destination table.

Column Maps are used by the following processes: Insert Process

220

When the source and destination do not match or when you want to control the data inserted at the destination, use Column Maps. Not required.

Move for DB2

4.3 Column Maps Convert Process

Usually specified to transform the source data since the transformation is the express purpose of the Convert Process. This process creates an Extract File to contain the converted data but does not insert that data into the destination database.

DB2 Load Process

As with the Insert Process, enables you to control the data inserted at the destination. Not required.

For the Insert Process and the Load Process, the Column Maps must be present in the destination DB2 subsystem where the process is performed. In most cases, Column Maps are defined while you are in a MOVE session and connected to the destination DB2 subsystem. MOVE automatically performs certain data conversions as part of these processes. For full details on the conversions, see page 235. Using Column Maps provides great control and flexibility. For example, specific source columns can be bypassed for one Insert or Convert Process and incorporated in another by using different maps for a single Extract File with the same or different destinations. You can define Column Maps by:

Naming Conventions

User Manual



Selecting Option 3 COLUMN MAPS on the Choose a Definition Option submenu displayed when Option 6 DEFINITIONS is selected 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 Process Table Map panels. This is discussed in Section 5.4 Insert Process.

It is helpful to follow some logical set of naming conventions when creating Column Maps to organize the maps and identify their use. For example, all maps created by a specific user could share a common Map ID and the map name could reflect specific programming projects. Thus COHEND.INVCUST, COHEND.ACCTCUST, and COHEND.TSTCUST could be names for Column Maps created by the user COHEND. These Column Maps could all apply to the same destination CUSTOMERS table where the source mapping varies based on the application to be tested. If another programmer needs to test different processes of these same applications against different data in the same table, his Column Maps might be named SMITH.INVCUST, SMITH.ACCTCUST, and SMITH.TSTCUST.

221

4. Definitions

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 prompts for 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 Panel Fields

222

The fields on this panel are: Map ID

1- to 8-character Map ID. DB2 LIKE syntax can be used to display a selection list. If the field is blank or '%' is specified, a list of maps, as specified in the Map Name field, for all Map IDs is displayed.

Map Name

1- to 12-character name of the map being defined or modified. DB2 LIKE syntax can be used to display a selection list. If the field is blank or '%' is specified, a list of all maps for the specified Map ID is displayed.

Use '_' for DB2 LIKE character

Specifies whether or not the underscore, '_', is to be used as a DB2 LIKE character or used literally 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 threecharacter name that begins with 'A', ends with 'B', and has any valid character in the middle. The default is No which means that '_' is not handled as a DB2 LIKE character.

Move for DB2

4.3 Column Maps Rules Used to Validate Column Map

Specifies whether the Column Map should comply with the rules for MOVE or for Compare for DB2. MOVE provides more extensive facilities for mapping columns including literals, constants, expressions, exit routines, and special registers. Compare for DB2 enables users to only map columns with compatible attributes and eliminate columns from processing. This prompt is only displayed when both MOVE and Compare for DB2 are installed and only applies when creating a new Column Map.

Specify the Map ID and Map Name to proceed. You can specify the Map ID and Map Name explicitly or enter a blank field or DB2 LIKE syntax to display a selection list. Explicit Names

Selection List

User Manual

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 the Modify Column Map panel.



If the named Column Map does not exist, MOVE prompts for the additional information needed to create a new map on the Specify Column Map Tables panel.

A selection list is requested by using DB2 LIKE syntax or leaving a field blank: •

MOVE displays a list of Column Maps on the Select Column Maps panel. Use the S line command or the SELECT primary command to select a Column Map. If an existing Column Map is selected, the Modify Column Map panel is displayed. If a new Column Map is named on the SELECT command, the Specify Column 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.

223

4. Definitions

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

Cmd --___ ___ ___ ___

-------- Map -------- -------- Source --------- ------ Destination -----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 Panel Fields

The fields on this panel are: Cmd

224

Line command entry field. The possible line commands are: S

Select a Column Map.

D

Delete a Column Map. After deleting, the message “*DELETED” is displayed in the Creator field under the Source heading.

C

Copy a Column Map. The Copy Column Map panel prompts for the name of the new Column Map. After copying, the message “*COPIED” is displayed in the Creator field under the Source heading. (See page 226 for details.)

R

Rename a Column Map. The Rename Column Map panel prompts for the new name of the selected Column Map. After renaming, the message “*RENAMED” is displayed in the Creator field under the Source heading. (See page 227 for details.)

AT

Modify attributes of a Column Map. The Object Attributes panel allows you to edit the description and security status of the Column Map. (See page 226 for details.).

I

Display information about a Column Map.

Move for DB2

4.3 Column Maps 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 as identified by the field heading.

Table

1- to 18-character name of the source or destination table as identified by the field heading.

Description

A user option controls whether or not the description of each Column Map is displayed on this panel. See Section 6.1 User Options for information about the Selection List Format option.

Column Map Attributes

To display the attributes of a Column Map, type I in the Cmd field next to the name of the Column Map. The following figure shows the Column Map Attributes panel.

----------------------------- Column Map Attributes -------------------COMMAND ===> ID Name

: FEINP : PSTCUST

Description Security Status Last Modified By Modified On

: : : :

Number of Columns Destination Table

: 9 : PSTDEMO.CUSTOMERS

Source Type

: TABLE

Extract File Name Source Table Validations

: : PSTDEMO.CUSTOMER : YES

Sample Column Map PUBLIC MCGARRM 2000-01-18-02-17 14.10.17

Figure 129. Column Map Attributes This is a read-only display. MOVE generates and maintains all of the information on this panel based on your specifications for the Column Map. Note that Extract File Name is blank if the specified Source Table is not from an Extract File. Also, the Security Status is displayed if it is enabled by site management.

User Manual

225

4. Definitions Object Attributes

To modify the description attribute of a Column Map, type AT in the Cmd field next to the name of the Column Map to display the Object Attributes 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 display and edit the description. An 8-character area is available to specify one of the following security statuses: PUBLIC PRIVATE READONLY

Anyone can edit and use. Only owner can edit and use. Anyone can use, only owner can edit.

Based on installation options, site management can establish that users may not specify security status on this panel. In that case, the prompt for security status is replaced with “Not Active” on the panel. Any attempt to change the security status will result in an error message. For additional information about the Object Attributes panel see Specify Description and Security Status in Section 6.1 User Options. Copy a Column Map

To copy a Column Map, type C in the Cmd field next to the name of the source Column Map. The following figure shows the Copy Column 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 original Column Map and prompts for a new two-part name.

226

Move for DB2

4.3 Column Maps Rename a Column Map

To rename a Column Map, type R in the Cmd field next to the name of the Column Map. The following figure shows the Rename Column 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 the Column Map and prompts for a new two-part name. SELECT Primary Command

The SELECT primary command can be used to select a specific Column Map. The selected Column Map does not have to be included on this list. For example, to select the Column Map named COHEND.TESTORDS, enter: SELECT COHEND.TESTORDS

Map Display

User Manual

If the Column Map exists, the source and destination are displayed on the Modify Column Map panel. If the Column Map does not exist, MOVE prompts for the source and destination tables on the Specify Column Map Tables panel. After the table names are specified, the Define Column Map panel is displayed.

227

4. Definitions

4.3.3 Specifying Column Map Tables The Specify Column Map Tables panel prompts for the source and destination table names. This panel is displayed when the Column Map option has been selected from the Choose a Definitions Option menu 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 Panel Fields

For a DB2 table

228

The prompts on this panel include: Creator ID

1- to 8-character Creator ID of the destination table. By default, the current user's SQL ID is supplied.

Table Name

1- to 18-character name of the destination table. A destination table must be specified.

DSN of Extract File

Name of the data set containing the Extract File to be used as the source. This value is mutually exclusive with the prompts for a source DB2 table.

Extract Table

Fully qualified name of the table in the Extract File that is to be used as the source. The name must include the Creator ID (e.g., PSTDEMO.ORDERS). Use either of the wild card characters, * or %, as the only character or leave the field blank to obtain a selection list of tables.

Source Creator ID

1- to 8-character Creator ID of the source table.

Move for DB2

4.3 Column Maps Source Table Name

1- to 18-character name of the source table. These two values are mutually exclusive with the Extract File prompt.

Except for the destination Creator ID, the fields are blank when the panel is displayed initially.

Source Table The purpose of the source table in the Column Map is to provide the names of the columns from which the data is to be copied so that you can match the source column names with the destination column names. 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 scenario as described below. Same DB2 Subsystem

Copying within the same DB2 subsystem

Different DB2 Subsystem

Copying across different DB2 subsystems

When you are copying data within the same DB2 subsystem, it might be easiest to just point to the actual source table from which the data is being extracted.

If you are copying across DB2 subsystems, you cannot access both the source and the destination table at the same time. In this case, you can use the source table definition that is contained in the Extract File. No Source Table

Creating a Column Map without the source table or the Extract File Although it may not be a common occurrence, you may need to create a Column Map without having access to either the actual source table or to the Extract File. You can specify that no source table is to be used to create the Column Map. Then, you can manually enter the names of the source columns that map to the destination columns. Since there are no definitions of the source columns for MOVE to reference, there is no validation to ensure compatible data types. (The validation would be performed during the actual insert.)

User Manual

229

4. Definitions If entries are not made in the prompts for Use Source Columns From: on the Specify Column Map Tables panel, MOVE assumes you want to create a map without specifying a source table. A confirmation prompt is displayed. Press ENTER in response to this prompt to proceed with the Column Map definition. Use END to indicate that you want to specify a source table; the Specify Column Map Tables panel is redisplayed. Multiple Source Tables

Creating a Column Map using other tables When you are creating a map manually because you do not have access to the actual source table or the Extract File, you can use other tables that contain some of the source column names. You can use several tables to collect the source column names to avoid typing each source column name. For example, assume the source and destination tables contain 100 columns. You can type all 100 source column names. However, if another table contains 50 of the column names, you can specify it as the source table for the Column Map. Then, you can use those names instead of typing them. Also, if a different table contains another 25 of the needed names, you can switch to that table to include those additional names. In fact, the destination table may already contain many of the source column names, so you could specify it as the source table name and use those names in the Column Map. This is a convenient way to avoid typing in all of the source column names when they exist in other tables.

Validation

Validation of column types By default, MOVE validates the data types of the source and destination columns during the definition of a Column Map to ensure that they are compatible. This validation can be turned off as noted on page 236. When you use the actual source table or the Extract File in a Column Map, you would want this validation to occur to ensure that 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 turn off validation. For example, you can turn off validation when the data types of the actual source columns do not match the data types of the columns that you are using. The validation detects this discrepancy. Also, you should turn off validation if you choose some columns from one table, then switch to another table to select columns and the second table does not contain the columns from the

230

Move for DB2

4.3 Column Maps first table. MOVE issues a warning (the status field contains *ERROR*) to indicate that there are no matches for the columns selected from the first table. Note that the validation discussed here refers only to the validation done when creating and editing Column Maps. During the actual Insert, DB2 Load, or Convert Process, MOVE always validates that the source and destination columns are compatible. Selection Lists

When you are certain you want to use a DB2 table but are unsure of the name, you can request a selection list of DB2 table names by using DB2 LIKE syntax in either or both of the DB2 Table prompt fields. 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 File field. If you do not use apostrophes, MOVE automatically prefixes the entry, as specified by the user option, Data Set Prefix, and uses this value to qualify the selection list. Use the Select line command, S, to select an entry from any of the selection lists.

4.3.4 Defining Column Maps After the source and the destination table are identified, the destination columns are displayed on the Define Column Map panel. (This panel is also displayed when you use the MAPS command on the INSERT Process Table Map, LOAD Table Map or CONVERT Process Table Map panel.) Matching Source and Destination

MOVE automatically matches every column in the source that has the same name and compatible data type as the destination. These matches are displayed with the status EQUAL or MAPPED. (The difference is discussed on page 233.) Any destination column that does not match a source column is assigned the NOTUSED or the REQUIRD status. Columns with the NOTUSED status are defined to DB2 with a default column value. Therefore, when the destination is not mapped to a source, the column is populated with DB2-defined default for an INSERT and the column is ignored for an UPDATE. REQUIRD columns are defined to DB2 as NOT NULL. (That is they are defined without a default column value). These columns must be mapped for an INSERT because DB2 cannot assign a default value. In contrast, REQUIRD columns do not have to be mapped for an UPDATE. Unmapped REQUIRD columns are unchanged by an UPDATE. However, the Update/Insert process will cause any

User Manual

231

4. Definitions attempts to insert new rows containing unmapped REQUIRD columns to fail. When you attempt to save a Column Map with columns in REQUIRD status, the Confirm REQUIRD Columns pop-up reminds you that the Column Map is only valid when used for an Update/Insert Process. You can press ENTER to save the Column Map or use END 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 Types Use LIST UNUSED Command for List of Unused Source Columns Use LIST ALL Command for List of All Source Columns

Cmd --*** ___ ___ ___ ___ ___ ___ ___ ___ ***

VAL ON MOVE 1 OF 8 -----PSTDEMO.ORDERS-------------------SOFTECH.ORDERS----------------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 Panel Fields

The fields on this panel include: Cmd

232

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 unknown if the destination table name is changed.

EXP

Display the Source Column field as a 75-character field for specifying the column value.

I

Display specific information about a column in error status.

SRC

Replace source column value with column name.

Move for DB2

4.3 Column Maps Source

The name of the source is provided as a heading. Source Column

The name of the source column to be mapped to the destination column specified on the same line. You can specify a different column name, a literal, an expression, a function, an exit routine, a special register, NULL, or leave this field blank.

Data Type

The data type of the source. This value is automatically supplied and cannot be modified. Although the data type of the source and destination do not have to match exactly, they must be compatible. See page 235 for detailed information. Note that when the Source Column contains an AGE function specification the Data Type is either blank or “PROP”. “PROP” indicates that the aged value is to be propagated.

Destination

The name of the destination is provided as a heading. Num

A number assigned by MOVE to each destination column. The numbers are assigned sequentially in ascending order. They are intended to be used with the LIST commands and the EXPAND command.

Destination Column

The name of the destination column. The columns are listed in the order in which they were defined within the table. This cannot be modified.

Data Type

The data type of the destination column.

Status

Current status of the destination column. This cannot be modified. The status is one of the following: EQUAL

The destination column and the source column have the same data type and length.

MAPPED

The destination column and the source column do not have identical data type or length, but are compatible.

NOTUSED

No source is specified. For Insert and Load, the DB2 default value defined for the destination column is inserted. For Update, the existing value in the destination column is not updated.

User Manual

233

4. Definitions REQUIRD

No source is specified and the column is defined as NOT NULL. There is no DB2 default defined for the column. When inserting rows, a value must be specified for the destination column. DB2 cannot supply a default value. When updating rows, the column is not updated. If you attempt to insert a row using a map with columns in REQUIRD status, the row is discarded.

LITERAL

A literal value is supplied as the source for the destination column.

EXIT

The value is to be determined by a site-specific exit routine.

EXPR

The value is an expression or a function.

NULL

The keyword NULL is specified indicating that the NULL value is to be inserted in the column.

SPC_REG

One of the special registers is specified as the value for the destination column.

*ERROR*

The requested mapping is invalid. This status is possible only if a source table has been specified and validation is performed. The Column Map cannot be saved with columns in this status.

UNKNOWN

The named destination column does not exist. This occurs if the column has been dropped from the destination table since the map was created or if a different destination table was specified. You can delete these unknown columns using the Delete line command, D, or the DELETE UNKNOWN primary command. The line is deleted and the destination

234

Move for DB2

4.3 Column Maps column count is adjusted. NOT_INS

Data cannot be inserted into the column. For example, the column may be an expression in a view.

Description

At any time during the session you can specify a description for the Column Map you are editing. Use the ATTRIBUTES command to display the Object Attributes panel. This panel provides a 40character area to display and edit the description. (Site management determines whether this panel also displays a prompt for Security Status.) For additional information about the Object Attributes panel see Specify Description and Security Status in Section 6.1 User Options.

Available Commands

The following primary commands are available: ATTRIBUTE BOTTOM CANCEL CAPS CHANGE TABLES CLEAR

Changing Table Names

DELETE UNKNOWN DOWN END EXPAND LIST RESET

SAVE SHOW TOP UP VALIDATION

Use the CHANGE TABLES command to redisplay the Specify Column Map Tables panel. You can change the source and destination table names on this panel. However, you can not change the table names when the Column Map editor is invoked from the INSERT Process Table Map, LOAD Process Table Map or CONVERT Process Table Map panels. The names of the source and destination tables are specified in the Table Map.

4.3.5 Validation By default, when a source table is specified or you enter a source value for a destination column, MOVE validates the source column data to ensure that it can be stored in the destination column. These validations include: Compatible Data Types

Character Data Character data can be converted to any character data type. It can also be converted to numeric data provided the source value is a valid numeric value and fits the destination column. The character data is padded or truncated on the right as needed to fit the destination column.

User Manual

235

4. Definitions Numeric Data Numeric data can be converted to another numeric data type and to any character data type. Decimal positions for numeric data are truncated if necessary. If significant positions for numeric data would be truncated by the transformation, the transformation is not performed and a conversion error 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, CURRENT TIMESTAMP or CURRENT_TIMESTAMP, CURRENT SQLID or CURRENT_SQLID, and USER are supported. (CURRENT_TIME, CURRENT_DATE, CURRENT_TIMESTAMP are supported only when DB2 release 4.1 or greater is used.) The MOVE-specific special register, CURRENT TSOID, is also available. This special register contains the TSO ID of the current user. All date, time, and timestamp data types cannot be converted to any character or numeric data types. Conversely, character and numeric data types cannot be converted to date, time, and timestamp data types. A timestamp data type can be converted to time or date and the extraneous portion of the timestamp is dropped. A date data type can be converted to a timestamp. The appropriate portion of the timestamp is filled in with the date; the remaining portion is filled in with zeros. A time data type can be converted to a timestamp. The appropriate portion of the timestamp is filled in with the time. The date portion is filled in at execution with the current date. Disabling Validation

As noted previously, you can define the destination columns by using one or more source tables as prototypes. When you do this, it may be undesirable to have validation enabled. You can toggle between validating and not validating using the VALIDATIONS command. To disable automatic validation, enter: VAL OFF

236

Move for DB2

4.3 Column Maps If validation is performed, the exact match columns are identified by the EQUAL status. If validation is not performed, the MAPPED status is assigned. The validation status is displayed on the right-hand side of the panel above the column count.

4.3.6 Managing the Column Display Facilities are available to help you manage the list of columns while specifying source values. SHOW Command

When the list of destination columns is extensive, you can focus on those columns that have not been mapped using the SHOW command. By default, all destination columns are displayed. You can request that all destination columns having a specific status are to be displayed. For example, to display all destination columns that have the NOTUSED status, enter: SHOW NOTUSED The following panel is displayed.

-- Define Column Map: COHEND.TESTORDS -------------------------------------COMMAND ===> SCROLL ===> CSR Corresponding Columns MUST Have Compatible Data Types Use LIST UNUSED Command for List of Unused Source Columns Use LIST ALL Command for List of All Source Columns

Cmd --*** ___ ___ ___ ___ ***

VAL ON MOVE 1 OF 4 -----PSTDEMO.ORDERS--------- -------------SOFTECH.ORDERS--------------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 or SHOW ALL. LIST Command

User Manual

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 been matched to a destination column. With either display, you specify the

237

4. Definitions assigned destination column number in the Num field to match the source to the destination. Example of LIST UNUSED

For example, assume the Define Column Map panel is displayed and you want to map the unmapped destination columns. The SHOW NOTUSED command is used to display the destination columns with the NOTUSED status and then the LIST UNUSED command is entered. A list of source columns that have not been mapped is displayed. The data type of the source columns is also displayed to assist in selecting compatible columns for matching.

-- Define Column Map: COHEND.TESTORDS ------------------------------------COMMAND ===> SCROLL ===> CSR Corresponding Columns MUST Have Compatible Data Types Use LIST UNUSED Command for List of Unused Source Columns Use LIST ALL Command for List of All Source Columns +------- Unused Columns -------+ | | |Select Items by Matching 'Num'| | | |Cmd Column Name Data Type| |--- ---------------- ---------| |*** *********** TOP **********| |2__ CUSTOMER_ID CH(6) | |___ TOTAL_ORD DEC(7,2) | |7__ LAST_ORD_DATE DATE | |___ FREIGHT DEC(4,2) | |___ CUST_ORD_ZIP CH(5) | +------------------------------+

VAL ON MOVE 1 OF 4 ------------SOFTECH.ORDERS--------------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 136. Matching Unused Source Columns As shown in Figure 136. Matching Unused Source Columns, columns are mapped to a destination column by typing the number from the Num field assigned to the destination column in the Cmd field 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 the destination column, 7 ORDER_POSTED_DATE; the second source column, TOTAL_ORD, and the last two source columns are not mapped. The list of source columns can be scrolled using the commands UP, DOWN, TOP, and BOTTOM or the PF keys assigned these functions. END List

238

When you have completed using the selection list to match the columns, use END to remove the Unused Column List and return to the Define Column Map panel. MOVE checks the mapping you have selected. If validation is performed, EQUAL is displayed for all mappings of matching data types, MAPPED for all other mappings, and *ERROR* for any invalid mapping. If validation is not performed, the status MAPPED is displayed for all valid mappings.

Move for DB2

4.3 Column Maps In the following figure, assume that SHOW ALL has also been entered after the LIST UNUSED command to redisplay all of the destination columns and the specified source columns.

-- Define Column Map: COHEND.TESTORDS --------------------------------------COMMAND ===> SCROLL ===> CSR Corresponding Columns MUST Have Compatible Data Types Use LIST UNUSED Command for List of Unused Source Columns Use LIST ALL Command for List of All Source Columns

Cmd --*** ___ ___ ___ ___ ___ ___ ___ ___ ***

VAL ON MOVE 1 OF 8 -----PSTDEMO.ORDERS-------------------SOFTECH.ORDERS----------------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 to destination, you can explicitly specify the source value in the Source Column field for each destination column using one of the following methods: •

Leave the field blank.



Type a value such as a column name, literal, constant, or expression.



Specify a site-defined exit routine to establish the value.

Type the Value You can type any of the following: •

User Manual

The column name. Column names that you supply need not have the same name or data type. A value bound by the escape character specified with the DB2 installation options is assumed to be a column name. The mapped columns are identified with the status MAPPED. MOVE automatically supplies the source column data type and the appropriate status for the destination column.

239

4. Definitions •

A literal value. Literals, except numerics, must be bound by the character designated as the SQL string delimiter in the DB2 installation options. The data type for literals is blank and the status is LITERAL.



NULL or one of the special registers. The special registers are: CURRENT TIME or CURRENT_TIME, CURRENT DATE or CURRENT_DATE, CURRENT TIMESTAMP or CURRENT_TIMESTAMP, CURRENT SQLID or CURRENT_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 the data from the source prior to inserting it into the destination. These functions 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_YEAR is supported so that Column Maps written using MOVE release 2.5 are available for release 3.0. If a Column Map is edited using release 3.0, it is no longer available for use with release 2.5. It is recommended that you take advantage of the functionality provided with AGE rather than FUTURE_YEAR when defining new Column Maps. FUTURE_YEAR is limited to aging the year portion of DATE and TIMESTAMP columns; whereas AGE:

240



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 a combination of these units. Also, you can specify aging by a number of business units (e.g., payday, quarters, etc.).



Includes parameters to automatically adjust aged data to comply with business rules.

Move for DB2

4.3 Column Maps When the Column Map is used by an Insert, Update/Insert, Load or Convert Process, you are given the opportunity to specify:

AGE



Default values to be used for source columns defined with AGE for which you have not specified all required values. For example, you can use one Column Map for multiple processes and specify unique aging amounts or business rules for each without modifying the AGE function parameters on the Column Map.



Aging values for all DATE and TIMESTAMP columns not explicitly defined.



Aging values for all source columns defined with FUTURE_YEAR(DEF).



Whether aging is performed for an individual process.

Ages dates based on a variety of parameters. To specify aging parameters to age dates prior to inserting them at the destination, use the AGE line command. This invokes the Aging Specifications prompts. The values you specify for these prompts are evaluated by MOVE 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 are included 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 is included to determine the century. An output data format is not specified in the figure, but you could specify a different format such as “MMDDYYYY” to adjust the input to a four-digit year output.

User Manual

241

4. Definitions The other values, such as aging values and rules, are not specified. These values are to be supplied for each process when the Column Map is used. Panel Fields

The following fields are provided on this prompt: Source Column

Name of the source column to age.

Destination Column

Name of the destination column. This cannot be modified.

Input Date Format

Date format. This value can be specified using one of the distributed date formats or one of the formats that have been defined by the site. The format must be valid for the column length and type. Use an asterisk to display a selection list of formats valid for the column. Use the S line command to select a format from the list. This is required. (For more information about specifying the format, see Appendix H. Date Formats.)

Output Date Format

Date format for the aged data. This value can be specified using one of the distributed date formats or one of the formats that have been defined by the site. The format length must match the input format length. Use an asterisk to display a selection list of formats valid for the column. Use the S line command to select 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 aging rule is required only when aging by business units or if a rule table is specified. Use an asterisk to display a selection list of rules in the current rule table. Use the S line command to select a rule from the list. If an aging rule is not specified for the field, the aging rule specified for the process is used. Specify NONE to perform linear aging on the field. An aging rule is not applied.

242

Move for DB2

4.3 Column Maps

Aging Amount

Rule Table

Name of the rule table containing the specified aging rule. If not specified, the default rule table is used.

Pivot Year

Year used to determine whether a two-digit year value is handled as occurring in the 20th century (1900) or the 21st century (2000). If the year is greater than or equal to the pivot year, 1900 is used. If not specified, the pivot year defined for the process is used.

Explicit Date

Specify an explicit date that is to be used. The specified aging rule is applied to this date. The date must be in the form YYYY/MM/DD or YYYY/DDD (a Julian date).

Years

Specify the number of years to increment or decrement the date as a value in the range -2500 to +1581.

Months

Specify the number of months to increment or decrement the date as a value in the range -30000 to +30000.

Days

Specify the number of days to increment or decrement the date as a value in the range -99999 to +99999.

Weeks

Specify the number of weeks to increment or decrement the date as a value in the range -30000 to +30000.

Business Rules

Specify the number of occurrences of a business rule to adjust the date as a value in the range 0 to 30000. 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 by that number of paydays. Therefore, 4 in the field, adjusts the date to the fourth payday after the column’s current date value. (The date to be adjusted is NOT included in the calculation.) You can specify either a value for Business Rules or values for calendar units (years, months, weeks, or days), but not both.

User Manual

243

4. Definitions Propagate Aging

Specify whether the resulting age value is propagated. If you elect to propagate the value, “PROP” is displayed in the Data Type field of the source column. (For information about propagation, see the information on page 246 about the PROP function.)

Note that the combined values for Years, Months, Days, and Weeks cannot result in an aging amount for Years greater than 1581. An error will result when the aging is attempted. DATE and TIMESTAMP columns

You can direct MOVE to age values in DATE and TIMESTAMP columns using the global specifications for the processor. However, if you want to age specific DATE and TIMESTAMP columns exclusively, age the columns to unique values, or use an exit, specify the AGE function for the column. These DB2-defined data types must 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 are included in the reported count of skipped columns. These skipped columns are handled the same as the other skipped values according to the process specifications.

AGE Specifications Complete

After you define values for the AGE function on the Aging Specifications panel, use END to return to the Column Map editor. The AGE function is identified by the string “AGE(column)” where column is the name of the source column to be aged. You can modify these values using the AGE line command again to redisplay the Aging Specifications panel. However, you must use the CLR line command to delete the entire AGE function specification or the SRC line command to replace the AGE function with the source column. The specifications in the Column Map are combined with the specifications for an individual request on the Aging Parameters panel. For more information about specifying values for an individual process see Age Date Values on page 340.

FUTURE_YEAR

Increments or decrements the year portion of the date in a DATE or TIMESTAMP column. FUTURE_YEAR(value,column-name) Returns an explicit date value or the result of incrementing or decrementing a date value. The data type of both the source and destination columns must be DATE or TIMESTAMP.

244

Move for DB2

4.3 Column Maps value is specified as one of the following: ⇒ A four digit year ⇒ A one to three digit value preceded by a plus or minus sign to increment or decrement the year value. Since incrementing is the default, the plus sign is optional. ⇒ The keyword DEFAULT (abbreviated to DEF). In this case, the date is modified when the process is executed only if values are specified on the Aging Parameters panel before an Insert, Convert or Load Process. column-name specifies the source column containing the value that is the subject of the function. The resulting date value is inserted into the year portion of the data prior to inserting the data into the destination column. The column-name parameter is required only if there is no source column that matches the destination 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 at the destination. FUTURE_YEAR(+10,ORD_DATE) Increment the date in the source column, ORD_DATE, by 10 years before inserting the data at the destination. FUTURE_YEAR(DEF) Modify the date in the source column by the values specified on the Aging Parameters panel before inserting the data at the destination. The DEFAULT parameter is most frequently used when there are several date columns you want to modify in the same way or to modify a set of date columns differently for different processes. For example, using the same Extract File you can add 10 years to the dates for one process and not modify the

User Manual

245

4. Definitions date for others. To provide this function, specify FUTURE_YEAR(DEF) for all of the date columns involved and specify the desired modification on the Specify Aging Parameters panel available for Insert and Load Processes. The values on the Specify Aging Parameters panel can be changed for every execution of an Insert, Load Process, and Convert Process. If you specify an explicit year for the aging value on the Specify Aging Parameters panel, only the year portion is applied. If you specify values to age incrementally or semantically, the column is ignored. For additional information about the individual processes, see Section 5.4 Insert Process, Section 5.5 DB2 Load Process and Section 5.8 Convert Process. Propagating Primary Key Values The PROP function is used to propagate values in the primary key or the foreign key to all related tables. This is especially useful for generating multiple sets of related data. You specify the value for the source column in the Column Map and MOVE automatically propagates 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 function concatenated with a literal, etc. ⇒ A special register. ⇒ An exit routine. column-name specifies the source column containing the value that is the subject of the function. The resulting value is inserted into the destination column of the mapped table and the appropriate destination column in the participating related tables. The column-name parameter is required if there is no source column that matches the destination column in both name and data type. It is also required when value is a

246

Move for DB2

4.3 Column Maps 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 related tables. PROP(SEQ(10000,99999)) Generate a sequential number between 10000 and 99999 and propagate that number in the mapped destination column and the destination columns of the related tables. PROP(SEQ(10000,99999),CUST_NUMBER) Generate a sequential number between 10000 and 99999 in the named destination column and propagate that number in the destination columns of the related tables. PROP(EXIT CHEKCUST) Call an exit routine to establish the value for the destination column and propagate that number in the destination columns of the related tables. When using PROP note the following:

User Manual



PROP can be specified only for a primary key or foreign key column.



If PROP is specified, there must be at least one related table included in the process.



You can specify PROP for either the primary key or the foreign key column. However, you cannot specify PROP for both. Also, if you specify PROP for one, you must specify the source column name as the source for the other. You cannot specify some other value.



When PROP is specified on the foreign key column and the value you specify includes a column name, that name must participate in the 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 be specified for the column in the table for which the exit routine is written. MOVE does not call the exit routine prior to propagating the related column in another table.



PROP is available only to relationships defined by a primary key and foreign key pairing. Extended relationships are not supported. 247

4. Definitions •

Since it is impossible to evaluate the impact of the specifications for PROP until they are applied, conflicting specifications are not identified until the process is executed. (The Control File contains the messages when errors are encountered.)



A Column Map that contains the PROP function can only be used with release 3.0 or greater of MOVE.



For the Insert and Load Processes, if the propagated primary key value duplicates an existing value, the row is discarded. MOVE then discards the rows from related tables whose foreign key contains the propagated value. (The grandchildren, greatgrandchildren, and so on are also discarded.) This feature ensures that “foster” child rows are not inadvertently inserted. For the Update Process, the row is updated. MOVE then inserts or updates appropriately the rows from related tables whose foreign key contains the propagated value.



You can apply the PROP function to a source column defined with an AGE function. A prompt on the Aging Specifications panel determines whether the value is propagated. If you elect to propagate an aged column, the Data Type of the source column is listed as PROP.

Before executing an Insert, Load, or Convert Process, you can display the various sets of propagation specifications that are mapped in the Column Maps used in the process. You can use the OUTPUT command when that panel is displayed to print a report on the specifications. For details on the prompt and the panel that displays this information, see the text pertaining to performing the specific process. 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 length determines the number of characters that are extracted. column-name must refer to a non-numeric column. (Valid non-numeric columns include character, date, time, and timestamp data type columns.) start and length must be integers with a value greater than or equal to 1. The start must point to a position within the 248

Move for DB2

4.3 Column Maps string. The combined start and length values cannot exceed the 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 the start and the substring consists of the data beginning with the 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 automatically reset to the starting value. Values for Parameters

The range of valid values for low, high, start and step varies based on the data type: Character Integer Small integer Floating point Decimal

-2147483648 2147483647 -2147483648 2147483647 -32768 32767 -2147483648 2147483647 maximum number of significant digits to the left of the decimal

To clarify decimal data types, assume a column is defined as DEC(6.2), the maximum number of significant digits to the left of the decimal is 4 because two digits are specified to the right. Therefore, the range for low and high or start and step for this column is -9999 through 9999 inclusive. The special registers CURRENT DATE or CURRENT_DATE, CURRENT TIME or CURRENT_TIME, and CURRENT TIMESTAMP or CURRENT_TIMESTAMP cannot be expressed by functions. •

User Manual

An expression. Any of these values can be concatenated to specify an expression except for the special registers CURRENT DATE or CURRENT_DATE, CURRENT TIME or CURRENT_TIME, and CURRENT TIMESTAMP or CURRENT_TIMESTAMP. Use the CONCAT keyword or two vertical bars, ||, to indicate concatenation.

249

4. Definitions For example, you can concatenate a literal value, ‘PST’, with a function, 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 type is blank and the status is EXPR. If an expression is invalid and cannot be evaluated, any affected row is discarded and marked as a conversion error. When RAND or SEQ are in a concatenated expression, a VARCHAR string is returned. Arithmetic Calculations Arithmetic calculations can be specified for any numeric column. This includes decimal, integer, small integer, and float data types. To specify 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 is inserted in the destination column.

operand can be one of the following: + * /

Addition subtraction multiplication division

A Column Map that contains arithmetic calculations can only be used with release 3.0 or greater of MOVE. The following are examples of arithmetic calculations that can be specified as the source value in a Column Map: FREIGHT_CHARGES + 2.00 ON_HAND_INVENTORY - 15 UNIT_PRICE * 1.1 TOTAL_COST / UNIT_PRICE

250

Move for DB2

4.3 Column Maps When specifying arithmetic calculations, the following error conditions 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 any individual destination column. This is useful to handle special processing, data manipulation, and literals that exceed the length of the Source Column field. Specify the keyword EXIT followed by a space and the 1- to 8character name of the exit routine in the Source Column field. After ENTER is pressed, the status EXIT is displayed for the destination column. The existence of the exit routine is not verified at this time. Verification occurs when a MOVE Insert Process, Load Process, or Convert Process is performed. For example, to specify the exit routine CHEKFRGT as the source, type the following in the Source Column field of the desired destination column: EXIT CHEKFRGT See Figure 137. Define a Column Map - Return from LIST on page 239 for an example of this. For information on defining exit routines, see Appendix C. Exit Routines for Column Maps. EXPAND Command

User Manual

If the length of the value you want to specify exceeds the space available, use the EXPAND command to display a 75-character field. Type EXPAND in the command area, position the cursor in the desired Source Column field, and press ENTER. Alternatively, you can specify the destination column name or number with the EXPAND command. A comparable line command, EXP, is also available.

251

4. Definitions In the following figure, an expression is specified in the expanded display for the column ORDER_SALESMAN. A value is created by concatenating a random number greater than or equal to 100 and less than or equal to 999 with ‘PST’.

-- Define Column Map: COHEND.TESTORDS --------------------------------------COMMAND ===> SCROLL ===> CSR Corresponding Columns MUST Have Compatible Data Types Use LIST UNUSED Command for List of Unused Source Columns Use LIST ALL Command for List of All Source Columns

Cmd

-----PSTDEMO.ORDERS-------Source Column Data Type

VAL ON MOVE 1 OF 7 ------------SOFTECH.ORDERS----------------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 the previous or next column using UP, DOWN, TOP, and BOTTOM. Use END to return to the Define Column Map panel. If the length of the source specification exceeds 21 characters, the data is truncated and protected. You can expand the source column again to respecify the value as needed. CLEAR Command

While editing the Column Map, you may want to remove one or more of the Source Column specifications. You can use the CLEAR primary command to remove all of the source column specifications or the CLR line command to remove the specifications for a single source column. The CLR line command is especially useful for clearing the values that have been specified on the expanded source column display or the Aging Specifications panel. You can remove these specifications without invoking a pop-up. (For aging specifications, CLR or CLEAR is the only way to remove the AGE function.)

252

Move for DB2

4.3 Column Maps

4.3.8 Completed Column Map When you have completed defining the Column Map, use END. The panel from which the Define Column Map panel was invoked is redisplayed. Use the SAVE command to save the modified Column Map under a new name. This enables you to model a new Column Map on an existing one. A confirmation prompt is displayed. Using a Column Map

Column Maps are used for the Insert Process and the Load Process to direct the data from a source table to a destination table. They are used by the Convert Process to convert the source data in an Extract File. You can specify the names of Column Maps when you specify the source and destination tables for the process on the INSERT Process Table Maps, the LOAD Process Table Maps, and the Convert Process Table Maps panels. Information on specifying Column Map names for the Insert Process is provided in Section 5.4 Insert Process. Information for the DB2 Load Process and BMC LOADPLUS is provided in Section 5.5 DB2 Load Process. Information for the Convert Process is provided in Section 5.8 Convert Process. A Column Map can be used to map any pair of tables regardless of the Creator ID and table name. For example, a Column Map defined to map a table named PSTDEMO.CUSTOMERS to a table named TEST.CUSTOMERS can also be used to map PROD.CUSTOMERS to QA.CUSTOMERS.

User Manual

253

4. Definitions

4.4 Table Maps A Table Map specifies the correlation of the source and destination tables for the Insert, Insert/Update, Convert, Load processes. This offers the opportunity to match unlike-named tables and to exclude one or more tables from the process. From a Table Map, you can specify a Column Map for tables on the Table Map. (Column Maps enable you to map unlike named columns, compatible columns, generate column data, and eliminate individual columns from the process, as discussed in Section 4.3 Column Maps.) You can define Table Maps from a menu option or as a part of a migration process. For the most part, the steps for defining a Table Map are the same. However, a Table Map defined through the menu option is always stored in the PST Directory and a Table Map defined for a specific process may be defined for that process only or stored in the PST Directory. This section focuses on defining through a menu option. It mentions, where pertinent, the difference when defining a Table Map for MOVE or for Compare for DB2. Additional information about Table Maps defined within a process is provided in the discussion of each process.

4.4.1 Choosing a Table Map To create or edit a Table Map through the Definitions option on the Main Menu select Option 4 TABLE MAPS on the Choose a Definition Option submenu. The Choose a Table Map panel is displayed 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

Rules used to validate Table Map ===> M

(Y-Yes, N-No) (M-Move, C-Compare)

Figure 140. Choose a Table Map

254

Move for DB2

4.4 Table Maps Panel Fields

The fields on this panel are: Map ID

1- to 8-character Map ID. DB2 LIKE syntax can be used to display a selection list. If the field is blank or '%' is specified, a list of maps, as specified in the Map Name field, for all Map IDs is displayed.

Map Name

1- to 12-character name of the Table Map being defined or modified. DB2 LIKE syntax can be used to display a selection list. If the field is blank or '%' is specified, a list of all maps for the specified Map ID is displayed.

Use '_' for DB2 LIKE character

Specifies whether or not the underscore, '_', is to be used as a DB2 LIKE character or used literally 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 threecharacter name that begins with 'A', ends with 'B', and has any valid character in the middle. The default is No which means that '_' is not handled as a DB2 LIKE character.

Rules used to validate Table Map

Specifies the rules for defining a Table Map. Specify: M

Rules for MOVE.

C

Rules for Compare for DB2.

This prompt is only displayed when Compare for DB2 is also installed. Rules for Table Maps

Although Table Maps can be created and edited using MOVE or Compare for DB2, differences in the way each product uses Table Maps require a separate set of rules. MOVE rules:

User Manual



Source Tables - Can be contained in an Extract File or specified in an Access Definition.



Destination Tables – Must exist in DB2 or will be created before process can proceed.

255

4. Definitions •

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 or specified in an Access Definition.



Source 2 Tables - Can be contained in an Extract File, specified in an Access Definition, or must exist in DB2.



Column Maps - Functionality is restricted to mapping unlike column names, columns with compatible attributes, and excluding columns.

In spite of these differences, a Table Map can be used by either product if the definition adheres to the product rules. The source table in a Table Map defined using MOVE corresponds to the Source 1 Table in a Table Map defined using Compare for DB2. Similarly, the destination table corresponds to the Source 2 Table. Specify Names

Specify the Map ID and Map Name to proceed. You can specify the Map ID and Map Name explicitly or choose from a selection list. To display a selection list, leave one or both fields blank or use DB2 LIKE syntax in one or both fields.

Explicit Names

If explicit values are specified for the Map ID and Map Name fields:

Selection List

256



And the named Table Map exists, MOVE displays the Table Map on the Modify Table Map panel.



And the named Table Map does not exist, MOVE displays the Specify Table Map Sources panel.

Use DB2 LIKE syntax or leave a field blank to request a selection list. MOVE displays a list of Table Maps on the Select Table Maps panel. If there are no Table Maps that satisfy the selection list criteria, a message is displayed on the Choose a Table Map panel. Respecify the DB2 LIKE syntax.

Move for DB2

4.4 Table Maps

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 Panel Fields

The fields on this panel are: Cmd

User Manual

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 under the Last Modified heading.

C

Copy a Table Map to create a new one. The Copy Table Map panel prompts for the name of the new Table Map. After copying, the message “*COPIED” is displayed in the Date field under the Last Modified heading. (See page 259 for details.)

R

Rename a Table Map. The Rename Table Map panel prompts for the new name of the selected Table Map. After renaming, the message “*RENAMED” is displayed in the Date field under the Last Modified heading. (See page 259 for details.)

AT

Modify attributes of a Table Map. The Object Attributes panel allows you to edit the description and security status of the Table Map. (See page 258 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.

257

4. Definitions By

TSO ID of the user that last modified the Table Map.

Date

Date the Table Map was last modified.

Description

A user option controls whether or not the description of each Table Map is displayed on this panel. (See Section 6.1 User Options for information about the Selection List Format option.)

Table Map Attributes

To help in selecting a Table Map, use the I line command to display information about a specific Table Map. The figure shows the Table Map Attributes panel.

----------------------- Table Map Attributes ----------------------Command ===> Map ID Map Name

: COHEND : TMAP1

Description Security Status

: Sample Table Map : PUBLIC

Last Modified By Modified On

: COHEND : 2000-01-18 21.32.06

Source Creator ID Destination Creator ID

: PSTCOMP : PSTDEMO

Source Type Extract File DSN Destination Type

: Access Definition : SOFTECH.COHEND.AD1 : DB2 Tables

Figure 142. Table Map Attributes This is a read-only display. MOVE generates and maintains all of the information on this panel based on your specifications for the Table Map. When you are finished viewing the Table Map information, use END to return to the selection list. Object Attributes

To modify the description and security status attributes of a Table Map, type AT in the Cmd field next to the name of the Table Map to display the Object Attributes panel. The description and security status 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

258

Move for DB2

4.4 Table Maps The Object Attributes panel provides a 40-character area to display and edit the description. A User Option specifies whether description and security status are displayed on Selection List. An 8-character area is available to specify one of the following security statuses: PUBLIC PRIVATE READONLY

Anyone can edit and use. Only owner can edit and use. Anyone can use, only owner can edit.

Based on installation options, site management can establish that users may not specify security status on this panel. In that case, the prompt for security status is replaced with “Not Active” on the panel. Any attempt to change the security status will result in an error message. For additional information about the Object Attributes panel see Specify Description and Security Status in Section 6.1 User Options. Copy a Table Map

To copy a Table Map, type C in the Cmd field next to the name of the source Table Map. The following figure shows the Copy Table Map panel.

+----------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 Table Map and prompts for a new two-part name. Rename a Table Map

To rename a Table Map, type R in the Cmd field next to the name of the Table Map. The following figure shows the Rename Table Map panel.

+---------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 the Table Map and prompts for a new two-part name.

User Manual

259

4. Definitions Delete a Table Map

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 is protected. The entry is retained until the selection list is requested again or the REFRESH DIRECTORY primary command is used to update the Table Map selection list.

Select a Table Map

On the selection list, use the S line command or the SELECT primary command to select a Table Map to modify. If an existing Table Map is selected, the Modify Table Map panel is displayed. The SELECT primary command can be used to specify a Table Map that is not included on the selection list. For example, to select the Table Map named PSTDEMO.TESTMAP, enter: SELECT PSTDEMO.TESTMAP If the Table Map named on the SELECT primary command does not exist, MOVE assumes a new Table Map is to be created and the Specify Table Map Source panel is displayed. After specifying the sources, the Define Table Map panel is displayed.

4.4.3 Specifying Table Map Sources The Specify Table Map Source panel prompts you to specify the source for the Table Map.

------------------------ Specify Table Map Source -------------------COMMAND ===> Specify where Source Table List will come from. Tables can be any DB2 Tables.

Destination

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:

260

Extract File

Specify the data set name of the Extract File containing the list of source tables. You can display a selection list of existing Extract Files by typing * as the last character in the DSN name.

Access Definition

Specify the full name of the Access Definition containing the list of source tables. The three-

Move for DB2

4.4 Table Maps part name can be specified explicitly or DB2 LIKE syntax can be used to obtain a selection list. After you have specified the source, use END or ENTER to proceed. The Define Table Map panel is displayed.

User Manual

261

4. Definitions

4.4.4 Defining Table Maps The Define Table Map panel lists the corresponding tables from the source and destination under the appropriate headings. Each source table is mapped to the destination table that is displayed on the same line. Initial Display

When this panel is displayed initially: Source

The CID field is contains the default Creator ID from the named source object (Extract File or Access Definition). The Table Name field is populated with the table names from the source object. All fields are protected.

Destination

The CID field is blank and the Table Name fields are populated with the same names as the source. All fields can be modified.

Assuming an Extract File is named for the source, the following panel is 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 Panel Fields

262

The fields on this panel include: Src CID

The default Creator ID for the source tables as defined in the Extract File or Access Definition designated as the source. This value cannot be modified.

Dest CID

The default Creator ID for the destination tables. A valid value must be specified.

Column Map ID

The default Creator ID for Column Maps. This field is only required when an unqualified Column Map name is specified.

Move for DB2

4.4 Table Maps Extract Tables

The list of source tables in the Extract File or Access Definition designated as the source. These values cannot be modified. The fully qualified name is displayed only when the Creator ID differs from the Src CID.

Destination Table Name

The list of destination tables. These values can be modified. If a destination Table Name field is blank, the corresponding source table is not included in the process.

Type

The type of the object named in the Destination Table Name field. This value is not modifiable and automatically supplied as one of the following: TABLE VIEW UNKNOWN UNUSED A-TABLE A-VIEW S-TABLE S-VIEW NOT INS

Column Map

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.

The name of the Column Map used for mapping the columns from source to destination for a specific pair of tables. Specify the Column Map names manually or request a selection list using the LIST MAPS command. If you leave the field blank, a Column Map is not used. You can use the POPULATE command to insert the name of the Column Map in this field. Section 4.4.5 Including Column Maps discusses how to request the Column Map editor to create a new Column Map or modify an existing one.

Description

User Manual

At any time during the session you can specify a description for the Table Map you are editing. Use the ATTRIBUTES command to display the Object Attributes panel. This panel provides a 40character area to display and edit the description. (Site management determines whether this panel also displays a prompt for Security

263

4. Definitions Status.) For additional information about the Object Attributes panel see Specify Description and Security Status in Section 6.1 User Options. Modify Destination Table Names

The destination Creator ID and table names can be modified. You can overtype the name directly or select a table name from a selection list.

LIST Command

Use the LIST TABLES command to request a selection list of tables that have the current Destination CID. You can override the Creator ID by specifying one as an operand, as in LIST TABLES SMITH.%. The LIST command can also be used to display a selection list of views, aliases, and synonyms. The list will include the tables that satisfy the selection list criteria but are not already included as destination tables on the Table Map. The LIST command presents a list of the available tables, and assigns a number and a type to each source table on the Table Map. You map the tables by matching the assigned table numbers from the Num field. The source Type field identifies UNUSED tables.

LIST TABLES

For example, if the destination Creator ID is 'SMITH', a selection list of tables with that Creator ID is displayed when LIST TABLES with no 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 | | --- ---------------- ------- | 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 ************ | +------------------------------------------+

CAL" --***

***

Figure 148. Listing Available Destination Tables As shown in Figure 148. Listing Available Destination Tables, you map the destination tables to their source counterparts by typing the assigned number from the Num field of the source table, into the Num field of the appropriate destination table on the DB2 Tables list.

264

Move for DB2

4.4 Table Maps The list of destination tables can be scrolled using the UP, DOWN, TOP, and BOTTOM commands, or the PF keys assigned these functions. 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 Table Map panel. As shown in the following figure, MOVE automatically populates the Destination Table Name fields with the selected table names. 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 APPLY Command

The APPLY command overlays all or part of the displayed Table Map with the specifications from another Table Map. When the source table names in the Table Map being applied match the source table names in the currently displayed Table Map, the corresponding destination 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 existing Table Maps or to create a new Table Map modeled on an existing Table Map. For example, assume a site has a common pool of tables that are processed and they create a “master” Table Map establishing default table mapping for these tables. Then, users can apply this master Table Map for any process. Thus, even though one process involves one set of tables and another involves a set that includes only some of the first set, the same master Table Map can be applied to both to obtain consistent mapping with a minimum of effort. After “applying” a Table Map, the current Table Map can be edited as desired.

User Manual

265

4. Definitions By default, the destination Creator ID and table name fields are cleared prior to applying the named Table Map. Operands on the APPLY command are provided to: •

Add information from the applied Table Map only to the blank fields 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 Map named SMITH.TMAP enter: APPLY ADD COLMAPS SMITH.TMAP A Column Map name from the Table Map SMITH.TMAP is inserted in blank Column Map fields when the source table from both Table Maps match. Non-relevant Column Maps defined in SMITH.TMAP are ignored. The Column Maps already named on the currently displayed Table Map are retained. Selection List for APPLY

You can display a selection list of Table Maps using DB2 LIKE syntax with the APPLY command. For example, APPLY SMITH.% generates a selection list of all Table Maps that have the Map ID SMITH; APPLY %.TMAPS generates a selection list of Table Maps named TMAPS for all Map IDs; and APPLY with no operands generates a selection list of all available Table Maps.

Destination Table Type

MOVE automatically revises the Type each time you modify a destination table name. If you modify the Dest CID, any tables that are specified without an explicit Creator ID automatically use the new Dest CID. This may change the Type value and require review. For example, assume the Dest CID is SOFTECH and the Destination Table Name is CUSTOMERS. The fully qualified table name is SOFTECH.CUSTOMERS. However, when the Dest CID is changed to COHEND, the table name is COHEND.CUSTOMERS and may be unknown. You can supply the Creator ID with the Destination Table Name. Then, changing the Dest CID does not affect the table name.

Saving the Map

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: •

266

Use the END command to exit the Table Map editor. The modifications to the Table Map are automatically saved.

Move for DB2

4.4 Table Maps •

Use the SAVE command. If a name is not specified, the current Table Map is updated. Specify a new name to save a new Table Map. By saving the current Table Map definition under a new name, you can use an existing Table Map as a prototype and retain the original version.

When defining a Table Map as part of a process, you can save the Table Map by specifying a fully qualified name. If you do not explicitly save the Table Map, it is not stored in the Directory and is only available for the current process. Available Commands

The following commands are available on this panel: ATTRIBUTES APPLY BOTTOM CANCEL DOWN

END LIST MAP OPTIONS

POPULATE SAVE TOP UP

4.4.5 Including Column Maps Column Maps are used to define how the source columns correspond to the destination when the default processing is inadequate. (By default, columns with the same name and matching attributes are mapped.) Using Column Maps you can manipulate the data at the destination as well as map unlike-named columns, columns with compatible but not exactly matching data types, or eliminate columns from the process. To specify the name of the Column Map in the Column Map name field on the Define Table Map panel, you can:

User Manual



Type the Column Map name directly. You can specify the name of an existing Column Map or specify a new Column Map name to create a new one. You can also specify LOCAL to create a Column Map to be used only with the current Table Map.



Use the LIST MAPS command to display a selection list of existing Column Maps.



Use the POPULATE command to automatically insert Column Map names for Column Maps that exist for every pair of source tables.

267

4. Definitions Column Map ID

The Column Map ID field qualifies the Column Map name specified. When a fully qualified Column Map name is entered in the Column Map name field, the Column Map ID field is ignored.

LIST MAPS Command

The LIST MAPS command displays a selection list of Column Maps. Use DB2 LIKE syntax to specify the selection list criteria. If no value is specified, the default is %.% indicating all Column Maps. To use the LIST MAPS command, type the command, position the cursor on the line where you want to specify a Column Map name, and press ENTER. If only one Column Map exists, it is automatically placed in the Column Map name field. If multiple Column Maps are available, a selection list is displayed.

Column Map Selection List

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 ----------*********** CUSTOMERS DETAILS ITEMS ORDERS SHIP_TO ***********

+------------------Select One Column Map-------------------+ | Cmd MapID.MapName Source Destination 1 OF 4 | | --- --------------------------------------------| | ********************* TOP *********************** | | ___ PSTDEMO.SUEN FULL MATCH FULL MATCH | | ___ PSTDEMO.SUEN1 NO MATCH TABLE MATCH | | ___ PSTDEMO.SUEN2 NO MATCH TABLE MATCH | | ___ PSTDEMO.SUPER10 NO MATCH NO MATCH | | ******************** BOTTOM ********************* | +----------------------------------------------------------+

OCAL" ----*****

*****

Figure 150. Select One Column Map The complete Column Map name is provided along with notation that specifies how the tables used to create the Column Map match the tables listed on the Define Table Map panel. This is specified for the source and destination tables separately as:

268

FULL MATCH

The Creator ID and the table name from the table list on the Define Table Map panel match those in the Column Map. In Figure 150. Select One Column Map, both the source and the destination tables of the first Column Map match the source and destination tables on the Define Table Map panel.

TABLE MATCH

The Creator ID from the Define Table Map panel does not match the Creator ID in the Column Map, but the table names do match. In Figure 129 the destination table of the second and third Column Maps match the destination table on the Define Table Map panel, but the

Move for DB2

4.4 Table Maps Creator ID is different. NO MATCH

The Creator ID and table name on the Define Table Map panel do not match those used to create the map. In Figure 129 the Creator ID and the table name of the second and third Column Maps do not match those specified 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 or ENTER to return to the Define Table Map panel. The name of the selected Column Map is inserted in the Column Map name field on the line where the cursor had been positioned. POPULATE Command

Use the POPULATE command to automatically insert Column Map names for each pair of source and destination tables specified on the Define Table Map panel. The command begins with the first pair of tables 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. (Those Column Maps are comprised of a pair of tables where the fully qualified names exactly match the Creator ID and the table names of the source and destination.) If only one is identified, that name is inserted in the Column Map name field on the Define Table Map panel and processing continues with the next pair. If there is more than one full match, a selection list of those Column Maps is displayed. (The selection list of Column Maps is similar to the one shown in Figure 150. Select One Column Map. The source and destination column of every Column Map is 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 the names exactly match the table names of the source tables but do not match the Creator ID of either or both tables.) If only one is identified, that name is inserted in the Column Map Name field on the Define Table Map panel and processing continues with the next 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 in Figure 150. Select One Column Map. Either or both the source or the destination of every Column Map is listed as TABLE MATCH.) 3. If there are no Column Maps for a pair of source and destination tables, processing continues with the next pair.

User Manual

269

4. Definitions Regardless of whether a Column Map name is inserted, when POPULATE processing for a specific pair is complete, the display scrolls to the next pair of source and destination tables on the Define Table Map list and processing begins for that pair. This is repeated until all are processed. When processing is complete, the list of tables is redisplayed with the appropriate Column Map name fields populated. Selection Lists for POPULATE

When a selection list is displayed by the POPULATE command, select the desired Column Map using the S line command and press ENTER or END. The name of the selected Column Map is inserted for the current pair and processing continues with the next pair. Use CANCEL to terminate POPULATE processing and return to the Define Table Map panel. Any Column Map names that have been inserted are retained.

Using DB2 LIKE Syntax with POPULATE

You can limit the search for Column Maps performed by POPULATE using DB2 LIKE syntax. For example, to populate the Table Map with Column Map names having the Map ID COHEND, type: POPULATE COHEND.% To populate the Table Map with Column Map names that begin with INV and have the Map ID COHEND, type: POPULATE COHEND.INV%

POPULATE Operands

Operands are available on the POPULATE command to enable you to specify whether or not existing Column Map names are replaced on the panel and whether or not existing Column Map names are cleared prior to beginning the POPULATE command processing. You can also specify that the POPULATE processing should only insert those Column Maps whose fully qualified table names match those on the Define Table Map panel. (See the Relational Tools Command Reference Manual for details.)

Consideration for Naming Conventions

Naming conventions can be used to identify logical groups of Column Maps and to make best use of the POPULATE command. For example, Column Maps created to test data for the inventory system could all be prefixed with INV and the Map ID could identify individual programmers. Then, the POPULATE command, with a name operand using DB2 LIKE syntax, can automatically identify and insert the desired set of uniquely named Column Maps for all of the listed table pairs. For example, assume five Column Maps have been defined for a pair of source and destination tables: COHEND.CHGCUST COHEND.INVCUST

270

Move for DB2

4.4 Table Maps COHEND.TSTCUST KEBLERD.INVCUST NADELSS.INVCUST Further, assume that the names of the tables defined in each of these maps are a FULL MATCH. By specifying the POPULATE command with no operand, a selection list containing these five tables is displayed. However, by specifying POPULATE COHEND.INV% only the Column Map named COHEND.INVCUST is identified and automatically inserted. This feature is especially useful when there is an extensive list of source tables on the Define Table Map panel and all of the desired Column Maps have been named following a specific convention. MOVE automatically proceeds through the pairs of tables and populates the Column Map name field. Table Map with Column Maps

The following figure shows a Table Map with Column Maps specified 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 New Column Map

To create a new Column Map, specify a new name in the Column Map field and press ENTER. (If the name is not fully qualified, you must enter a Map ID in the Column Map ID field.) A confirmation prompt is displayed. Use END to terminate the request or ENTER to create the Column Map. If you create the Column Map, the Define Column Map panel is displayed. If you specify LOCAL as the Column Map name and one has not been previously defined for that pair of tables, MOVE assumes you are creating a new Column Map. (A Map ID is not required for a 'local' Column Map.)

MAP Command

User Manual

Use the MAP command to edit an existing Column Map. You can specify the Column Map name with the command or position the cursor to the Column Map field. (It may be desirable to assign the MAP command to a function key.)

271

4. Definitions MOVE compares the Column Map table names with the names on the Define Table Map panel. If the table names and the column names match, the selected Column Map is displayed on the Modify Column Map panel. If there is a discrepancy, a confirmation prompt is displayed. For example assume that one or both tables in a selected Column Map named PSTDEMO.TEST1 do not match the pair of tables on the Table 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 changes the table names in the Column Map to those names on the Define Table Map panel and displays the Modify Column Map panel. SAVE Command

If you are using an existing Column Map as a prototype, you can retain the original version of the Column Map. Use the SAVE command and specify a new Column Map name or LOCAL prior to returning to the Define Table Map panel. MOVE inserts the new Column Map name appropriately.

Additional Information

See Section 4.3 Column Maps for detailed information on defining Column Maps. See the Relational Tools Command Reference Manual for details on the LIST MAPS, POPULATE, MAP, and SAVE commands.

Column Map Complete

When you have completed modifying the Column Map, use END to return to the Define Table Map panel.

Table Map Complete When you have completed specifying the Table Map, use END to redisplay Choose a Definition Options panel.

272

Move for DB2

4.5 Export and Import Processes

4.5 Export and Import Processes The Export and Import Processes are provided to transport the Relational Tools object definitions from one DB2 subsystem to another. The Relational Tools object definitions are stored in the PST 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 different subsystems. (For example, sites may have similar but separate databases on different subsystems to support production and testing environments or to support multiple clients.) Using the Export and Import Processes, the PST Directory object definitions such as Access Definitions, Table Maps, Column Maps, primary keys, relationships, and Compare Definitions (Compare for DB2 only) can be transported to other subsystems without the need to recreate them on each. This saves time and, more importantly, promotes consistent, reliable data handling. Although the Extract Process combined with the Create Process is available to migrate table definitions and related object definitions (primary keys and relationships regardless of whether defined in the DB2 Catalog or the PST Directory), these processes cannot be used to migrate the objects unique to Relational Tools. The Export and Import Processes must be used to migrate Access Definitions, Table Maps, Column Maps, and Compare Definitions. The PST Directory object definitions are migrated in two steps: 1. Export Process Copy the object definitions to a data set. This data set may be used repeatedly by the Import Process to copy the object definitions to any number of PST Directories making these definitions available to several subsystems. To execute the Export Process, select option E on the Choose a Definition Option panel. Note that a single execution of this process copies object definitions from the PST Directory for the current subsystem only. 2. Import Process Copy the object definitions in the specified data set to the current subsystem. To execute the Import Process, select option I on the Choose a Definition Option panel.

User Manual

273

4. Definitions Note that this process adds the exported object definitions to the PST Directory for the current subsystem only. Normally, you perform the Export Process to copy the object definitions from the current subsystem to a data set. Then, you return to the Relational Tools Main Menu to switch to the receiving subsystem by respecifying the DB2 subsystem at the SUBSYS prompt. Once you have switched the subsystem, you perform the Import Process to load the object definitions from the data set. About Object Security

When you export an object, the security status is included. However, security is only relevant within the database. For example, an Access Definition stored as PRIVATE can only be exported by the owner. The status is exported as PRIVATE, but any user can attempt to import the object stored in the Export File. A user cannot import any PRIVATE object to a subsystem in which it already resides, but can import it to a different subsystem. Then, the object is assigned the PRIVATE 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, the following panel is displayed: ----------------------------- EXPORT Process --------------------------Command ===> Definition Type ===>

(ALL PK R CM TM AD CD

Subordinate Definitions ===> Output DSN Disposition

NO

-

All Types, Primary Keys, Relationships, Column Maps, Table Maps, Access Definitions, Compare Definitions)

(Y-Yes, N-No)

===> ===>

(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 Panel Fields

The fields on the panel are: Definition Type

Indicate the type of definition to process. Specify: ALL PK R CM

274

All types Primary Keys Relationships Column Maps

Move for DB2

4.5 Export and Import Processes TM AD CD

Table Maps Access Definitions Compare Definitions (Only available when Compare for DB2 is installed.)

Specify ALL to select all or specific objects from each type. The definition type you specify may have subordinate object definitions associated with it. The subordinate object definitions are included based on your response to the following prompt. Subordinate Definitions

Specify whether the subordinate definitions are to be exported. The subordinate object definitions for each are as follows: Object

Subordinate Object

Primary Keys

none

Relationships

none

Column Maps

none

Table Maps

Column Maps

Access Definitions

Relationships

Compare Definitions

Access Definitions Relationships

For example, if you specify AD as the type and YES to this prompt, the Access Definitions are copied and any relationships referenced in the Access Definition are copied. If you specify CD, the Compare Definitions are copied and the subordinate Access Definitions and relationships are copied. Any additional relationships subordinate to the Access Definitions are also copied. Output DSN

Specify the name of a sequential or partitioned data set to contain the object definitions that are to be exported. You can specify the name of an existing data set or request a selection list by specifying an asterisk as the last character of the name. You can specify the name of a new data set. You will be prompted for allocation information and the data set will be allocated for you.

User Manual

275

4. Definitions Disposition

Specify whether the definitions in the current execution are to replace or be appended to the current contents of the output data set. APPEND is valid only when the Output DSN is a sequential file.

Report DSN

Specify the name of a sequential data set to contain the report resulting from the current Export Process. You can specify the name of an existing data set or request a selection list by specifying an asterisk as the last character of the name. You can specify the name of a new data set. You will be prompted for allocation information and the data set will be allocated for you. If you do not specify a name, the report is written to a temporary file. Therefore, if you want to view the report, you must use the REPORT command when the EXPORT Process Report panel is displayed.

Prompt To Delete Exported Objects

Specify whether the objects selected for the Export Process are to be deleted from the source PST Directory. Specify: Y N

Delete objects Do not delete objects

The delete request is processed after the objects are exported. A panel prompts you to indicate which objects are to be deleted from the source PST Directory. You select the individual objects using the S line command. Select the Objects for Export After you have completed the EXPORT Process panel, you are prompted to select which definitions you want to export for each designated type. If you specify a type such as AD or TM, an appropriate Choose panel is displayed. However, if you specify ALL, a prompt to choose specific object definitions is displayed for each object type.

276

Move for DB2

4.5 Export and Import Processes In the following figure, the prompt for Access Definitions is displayed.

------------------ 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 ADS is selected on the Main Menu and you are prompted for the name of an Access Definition to edit. You can specify the name of an Access Definition by specifying the three-part name in the provided fields. Alternatively, you can request a selection list by leaving one or more fields blank or using DB2 LIKE syntax in one or more of the fields. You are also prompted to specify whether the underscore character is used for DB2 LIKE syntax. Use ENTER to indicate that you are ready to continue. If an object is not explicitly specified in the provided fields, a selection list is displayed. If a name is specified, the next panel is dependent on which Definition Type is specified on the EXPORT Process panel. If a specific type is specified, the Export Process is performed and the EXPORT Summary panel is displayed next. If ALL is specified, the Choose panel for the next object type is displayed. When ALL is specified, you can bypass any of the object types by using END to proceed to the next object type. When a specific type is specified and END is used, the Export Process is not performed and the EXPORT Process panel is redisplayed.

User Manual

277

4. Definitions Selection List

Assume a selection list is requested by specifying the GROUP as COHEND and the USER as COHEND on the Choose an Access Definition to EXPORT panel. The following selection list is displayed:

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

Cmd --*** ___ ___ ___ ___ ___ ___ ***

----- Access Definition ----- ------ Last Modified -------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 are displayed in alphabetical order. The user that last modified the Access Definition and the date on which it was modified is also displayed. The list can be scrolled. Status field

The Status field to the left of the Access Definition indicates whether an Access Definition has been selected. On initial display, the field is blankno Access Definitions are selected. You can select individual Access Definitions using the Select line command, S. Conversely, you can unselect individual Access Definitions using the Unselect line command, U. When many Access Definitions are listed and you want to select or unselect the majority of them, use the primary commands SELECT and UNSELECT. For example, assume 100 Access Definitions are listed, use SELECT ALL to select all of them. Then, use the U line command to unselect specific definitions. Conversely, if all of the Access Definitions have the SELECT status, use UNSELECT ALL to unselect all of the Access Definitions and the S line command to select the few you want. Use END to signal that your selections are complete. The resulting action depends on the Definition Type specified on the EXPORT Process panel: •

278

If you specified ALL and selected at least one object on the selection list, the Choose prompt for the next object type is displayed. (The order in which the panels for each type are

Move for DB2

4.5 Export and Import Processes displayed is the same as the list of types on the EXPORT Process panel.) If you have not selected any objects for the current type, the Choose prompt for the current type is redisplayed. You can respecify criteria for the selection list, specify the name of an object, or use END again to indicate that none of the current definition type are to be exported. If you specify END, the Choose prompt for the next object definition type is displayed. If the Choose panel for the last definition type is displayed, the Export Process is invoked. •

If you specified a single Definition Type and selected at least one object from the list, the Export Process is invoked. If you have not selected at least one object from the list, the choose prompt is redisplayed. You can respecify criteria for the selection list, specify the name of an object, or use END without specifying any objects. If you use END with no entries, the Choose a Definition Option menu is redisplayed and the Export Process is not executed.

Available Commands

The following primary commands are available when the selection list is displayed: BOTTOM CANCEL DOWN END

FIND LOCATE OPTIONS RESET

RFIND SELECT SHOW SORT

TOP UNSELECT UP

Build the Output File It may be desirable to export object definitions in several steps or from several subsystems to import to another subsystem. For example, you may want to copy one Compare Definition and all of the subordinate objects and another Compare Definition and none of the subordinate objects. As another example, you may want to use the Access Definitions in one subsystem and supplement that with the relationships in a second and the Table Maps in a third. For either example, you can export these objects to separate output files and then execute the Import Process multiple times on each target subsystem. You could also export to a single output file by specifying APPEND to the Disposition prompt with each Export Process request. When the definitions are in a single output file, the Import Process can be executed once. The Export Process copies the object definitions from the PST Directory for the current subsystem only. To build an output file

User Manual

279

4. Definitions containing object definitions from several subsystems, you must switch the current subsystem before each execution of the Export Process. (You can change the subsystem on the Definitions Menu.) Export Summary When the Export Process has completed, the Export Summary is displayed. The following is a sample Export Summary:

--------------------- EXPORT Summary -----------------------------Command ===> Output File DSN:

PSTDEMO.TEST2

Summary of Results Primary Keys Processed : Relationships Processed : Column Maps Processed : Table Maps Processed : Access Definitions Processed : Compare Definitions Processed: Report File DSN:

0 1 1 1 6 1

TEMPORARY

No error conditions were found Enter REPORT Command to View the Report File Press ENTER Key to Continue Processing Enter END Command to Exit

Figure 156. Export Summary This report provides the following: Output File DSN

Name of the sequential or partitioned data set containing the exported object definitions.

Summary of Results

A list of the object definitions and the total number of each copied to the output file.

Report File DSN

Name of the sequential data set containing the results of the Export Process. This field contains “Temporary” if a data set name was not specified for the report.

This is followed by a message indicating whether any error conditions have been encountered. If errors have been encountered, explanatory text for each is provided in the report file. When the EXPORT Summary panel is displayed, use ENTER to redisplay the EXPORT Process panel or END to return to the Choose a Definition Option menu.

280

Move for DB2

4.5 Export and Import Processes REPORT Command

You can display the contents of the report file using the REPORT command. This command automatically invokes the ISPF browse facility and displays the contents of the report. The report lists the exported object definitions by category and the names of each exported object. Any error messages are also included in 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.CUSTOMERS RELATIONSHIP EXPORTED : PSTDEMO.ORDERS.CUSORD COLUMN MAP EXPORTED : PSTDEMO.DEMOMAP TABLE MAP EXPORTED : PSTDEMO.TESTMAP ACCESS DEFINITION EXPORTED : PSTDEMO.PSTSP.TEST1 ******************************** Bottom of Data******************

Figure 157. EXPORT Process Report Use END to terminate the ISPF browse session and return to the Relational Tools session.

4.5.2 Using the Import Process When you select I on the Choose a Definition Option menu, the following panel is displayed: --------------------------------- IMPORT Process ------------------------Command ===> Definition Type ===>

Input DSN ===> Overwrite Existing Defs Continue Import on Error

(ALL PK R CM TM AD CD

===> ===>

– -

Import All Definitions, Primary Keys, Relationships, Column Maps, Table Maps, Access Definitions, Compare Definitions)

(Y-Yes, N-No) (Y-Yes, N-No)

Enter Report File Name or Leave Blank for a Temporary File: Report DSN ===>

Figure 158. Import Process Panel

User Manual

281

4. Definitions Panel Fields

The fields on the panel are: Definition Type

Specify the type of definition to process. The available types are: ALL

All types

PK

Primary Keys

R

Relationships

CM

Column Maps

TM

Table Maps

AD

Access Definitions

CD

Compare Definitions (Only displayed if Compare for DB2 is installed.)

If you specify ALL, all object definitions in the input data set are imported. Input DSN

Specify the name of the sequential or partitioned data set containing the object definitions that are to be imported. You can specify the name of an existing data set or request a selection list by specifying an asterisk as the last character of the name.

Overwrite Existing Defs

Specify what action should be taken if an imported object definition has the same name as an object definition already in the current PST Directory. Specify YES to overwrite existing definitions in the Directory; NO to ignore the conflicting imported object definition and proceed with the next. Definitions in the DB2 catalog are never overwritten. If a primary key or relationship name conflicts with a name in the DB2 Catalog, an error message is written to the report file. Processing continues based on the specification for Continue Import on Error.

Continue Import on Error

282

Specify whether the Import Process should continue if an error is encountered when importing an object definition. If you specify YES, the object definition in error is bypassed, and the Import Process continues with the next definition. The error messages are written to the report file.

Move for DB2

4.5 Export and Import Processes Specify the name of the sequential data set to contain the report resulting from the current Import Process. You can specify the name of an existing data set or request a selection list by specifying an asterisk as the last character of the name.

Report DSN

You can specify the name of a new data set. You will be prompted for allocation information and the data set will be allocated for you. If you do not specify a name, the report is written to a temporary file. If the report is written to a temporary file, you must use the REPORT command when the IMPORT Summary panel is displayed. Use ENTER to perform the Import Process. Use END or CANCEL to abandon the process. If you use END, your specifications are profiled. Import Summary When the Import Process has completed, the IMPORT Summary panel is displayed. -------------------- IMPORT Summary --------------------------Command ===> Input File DSN:

PSTDEMO.TEST2

Summary of Results Primary Keys Processed Relationships Processed Table Maps Processed Column Maps Processed Access Definitions Processed Compare Definitions Processed Report File DSN:

: : : : : :

0 1 1 1 6 1

PSTDEMO.TEST3

No error conditions were found Enter REPORT Command to View the Report File Press ENTER Key to Continue Processing Enter END Command to Exit

Figure 159. Import Summary Panel fields

User Manual

This panel provides the following: Input File DSN

Name of the sequential or partitioned data set containing the exported object definitions.

Summary of Results

A list of the object definitions and the total

283

4. Definitions number of each added to the Directory. Report File DSN

Name of the sequential data set containing the results of the Import Process.

This is followed by a message indicating whether any error conditions have been encountered. If errors have been encountered, explanatory text for each is provided in the report file. When the IMPORT Summary panel is displayed, use ENTER to redisplay the IMPORT Process panel or END to return to the Choose a Definition Option menu. REPORT Command

You can display the contents of the report file using the REPORT command. This command automatically invokes the ISPF browse facility and displays the contents of the report. The report lists the imported object definitions by category and the names of each imported object. Any error messages are also included in 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.CUSTOMERS RELATIONSHIP IMPORTED : PSTDEMO.ORDERS.CUSORD COLUMN MAP IMPORTED : PSTDEMO.DEMOMAP TABLE MAP IMPORTED : PSTDEMO.TESTMAP ACCESS DEFINITION IMPORTED : PSTDEMO.PSTSP.TEST1 ******************************** Bottom of Data *******************

Figure 160. IMPORT Process Report Use END to terminate the ISPF browse session and return to the Relational Tools session.

4.5.3 File Format The Export Process copies each selected object definition from the PST Directory and generates a set of SQL-like statements for these objects. These statements are stored in the output file and used as the input to the Import Process. This section documents the format of these statements. You can use the ISPF facilities to browse and edit this file. Use caution when editing. The Import Process requires specific formats for these statements. Any deviations will cause errors.

284

Move for DB2

4.5 Export and Import Processes The general format rules are: •

Each statement begins in the first position of a line with the keyword CREATE.



Each statement is terminated with a semicolon. The Export Process inserts a blank line after the semicolon but this is not required.



At least one space is inserted between parameters.



The qualifiers for individual objects in sets of specifications, such as the table list entries for an Access Definition, are enclosed in parentheses.



If the length of the statement exceeds the length of the line, a break occurs before or after a parameter and its qualifiers. The remaining text is continued on the next line. The Export Process indents the continued text, but this is not required. (Continuation characters are not used except as noted for the SQL WHERE Clause.) As many lines as are needed are used.



If the first two non-blank characters on the line are dashes (-), the entire line is treated as a comment and ignored. Comments can be placed within an object definition or between definitions.

The format of the statements for each object type is documented in the following pages. The syntax used for these statements is: KEYWORD

Statement keywords are shown in uppercase and must be supplied as shown.

Text

Variable text is shown in lowercase italics.

()

Required statement delimiter to group a series of qualifiers for a parameter.

[]

Indicates an optional parameter.

{}

Indicates a choice of two or more settings from which one must be selected.

Primary Keys The following statement is generated for each primary key: CREATE PK table [DESCRIPTION //description//] COLS (column [,column])

User Manual

285

4. Definitions The fully qualified table name is specified followed by: DESCRIPTION

The description of the primary key. The text may be from 1 through 40 characters long and must be enclosed in double slashes.

COLS

The list of columns participating in the primary key enclosed in parentheses. The column names must be separated by commas.

The standard DDL CREATE TABLE and ALTER TABLE statements 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:

Relationship expressions

286

DESCRIPTION

The description of the relationship. The text may be from 1 through 40 characters long and must be enclosed in double slashes.

SECURITY

The security assigned to the object. Specified as one 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

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 the relationship 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 the child table expression is on the right.

Move for DB2

4.5 Export and Import Processes •

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 sign or after a comma or any space within the expression. (Continuation characters are not used.)

The standard DDL CREATE TABLE and ALTER TABLE statements 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 ] Parameters

Every parameter corresponds to a value that can be specified for a Column Map. DESCRIPTION The description of the Column Map. The text may be from 1 through 40 characters long and must be enclosed in double slashes. SECURITY

User Manual

The security assigned to the object. Specified as one 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.

EXTDSN

Name of the Extract File from which the column definitions are taken. If the file was uploaded from OS/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 was performed when the map was created, or OFF, validation was not performed.

287

4. Definitions SRCTYPE

Each source and destination mapping. value is an internal code based on the content of the mapped columns and can be one of the following: A B C D E F H I J K L M N U T X

numeric literal string literal valid column name current time register current date register current timestamp register current user register current SQLID register a default Exit routine bad error Column Map column source is the same as the destination column will receive NULL column is unusable current TSOID register valid 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) ] ] ) Parameters

Every parameter corresponds to a value that can be specified for a Table Map. DESCRIPTION

288

The description of the Table Map. The text may be from 1 through 40 characters long and must be enclosed in double slashes.

Move for DB2

4.5 Export and Import Processes SECURITY

The security assigned to the object. Specified as one 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.

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.

Table Mapping

User Manual

SRCEXT

Name of the data set containing an Extract File used as the source. If the file was uploaded from OS/2, check the file name.

SRCAD

Fully qualified name of the Access Definition used as the source in the Table Map.

DESTEXT

Name of the data set containing an Extract File used as the destination in the Table Map.

DESTAD

Fully qualified name of the Access Definition used as the destination in the Table Map. If the file was uploaded from OS/2, check the file name.

VALRULES

Indicates whether the Table Map was created to conform to MOVE or Compare for DB2 rules. The value is M for MOVE or C for Compare for DB2.

SRCTYPE

Source type as Extract File (X), Access Definition (A), or table (T).

DESTTYPE

Destination type as Extract File (X), Access Definition (A), or table (T).

The following source table to destination table mapping information is provided for every pair of tables on the Table Map. At least one pair of tables must be specified. sourcetable

Source table name. The Creator ID is included only if it differs from the default specified for SRCCID.

desttable

Destination table name. The Creator ID is included only if it differs from the default specified for DESTCID. The words "NOT-SPECIFIED" are inserted when the destination table is omitted in a

289

4. Definitions table pair. One of the following is included only when a Column Map has been specified for a pair of tables. CM

Name of the Column Map for the pair of tables. The Map ID is included only if it differs from the COLMAPID value.

LOCALCM

Column Map definition enclosed in parentheses. Only the column mapping (source-expr = destcolumn) is included here. For details on the contents of the Column Map specification see the explanation for 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 ) Parameters

290

Every parameter corresponds to a value that can be specified for an Access Definition.

Move for DB2

4.5 Export and Import Processes

DESCRIPTION

The description of the Access Definition. The text may be from 1 through 40 characters long and must be enclosed in double slashes.

SECURITY

The security assigned to the object. Specified as one 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 it differs from the default Creator ID.

The following parameters correspond to those specified on the Access Definition Parameters panel:

User Manual

ADDTBLS

Dynamically add tables. This is specified as Y to enable users to dynamically add tables during an edit or browse session; otherwise it is N.

MODCRIT

Modify selection criteria. This is specified as T to enable users to modify criteria during an edit or browse session; otherwise it is P.

BEGINDISP

Initial display when Access Definition used to edit or browse. This is specified as: D for data, S for the selection criteria prompt for the Start Table only, or A for the selection criteria prompt for each accessed table including the Start Table.

ADCHGS

Changes to Access Definition during edit. This is specified as T to enable users to save modifications to an Access Definition during an edit or browse session; otherwise it is P.

USENEW

Use NEW relationships. This is specified as T to always select new relationships for traversal during an Extract Process; otherwise it is P to not select new relationships.

291

4. Definitions The following parameters indicate whether a row list or group selection processing has been defined for the Start Table. ROWLIST

Name of the data set containing the row list from a Point-and-Shoot session. This is included only when a row list is defined.

GRPCOL

Name of the column specified for group selection processing.

GRPROWS

Maximum number of rows to be selected for each unique column value for group selection processing.

GRPVALS

Maximum number of unique column values for group selection processing.

The following parameters are specified once for each of these object included in the Access Definition: TABLE REL Tables

292

Table in Access Definition. (See below) 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. Every keyword corresponds to a value that can be specified in the Access Definition 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 or ORed.

COLFLAG

Indicates whether or not specifications on the Define Columns panel were modified.

SQL

Text of the SQL WHERE Clause. This is included only when an SQL WHERE Clause is defined.

CORRELNAME

Correlation name specified on the SQL WHERE Clause panel.

COLUMN

Specifications for the columns in a table.

Move for DB2

4.5 Export and Import Processes

Columns

ARCIXTAB

This is specified as Y if the table contains at least 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-archive option has been specified for this table; otherwise it is N. (Archive for DB2 use only.)

ARCOP

This is the operator between date specifications for archiving; A is AND, O is OR. (Archive for DB2 use only.)

A COLUMN entry is provided for every column in a table only when the defaults have been modified for the Access Definition. The set of keywords is enclosed in parentheses. Every keyword corresponds to a value 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.

User Manual

PRED

Text of the selection criteria. This is included when selection criteria is specified.

ARCIXOL

This is specified as Y if the column is an index column; otherwise it is N. (Archive for DB2 use only.)

ARCFMT

Format parameter for archiving. Must be enclosed in single quotes. (Archive for DB2 use only.)

ARCDATE

Explicit date for archiving. Must be enclosed in single quotes. (Archive for DB2 use only.)

ARCPIVOT

Value specifies Pivot Year for archiving. (Archive for DB2 use only.)

293

4. Definitions

ARCYRS

Value specifies Years for archiving. for DB2 use only.)

(Archive

ARCMOS

Value specifies Months for archiving. (Archive for DB2 use only.)

ARCWKS

Value specifies Weeks for archiving. for DB2 use only.)

(Archive

ARCDAYS

Value specifies Days for archiving. for DB2 use only.)

(Archive

Continuation

The SQL WHERE Clause and the selection criteria text must be delimited by slashes “//”. If the text exceeds the length of one line, continuation is indicated by slashes at the end of the line to be continued and at the beginning of the continuation line. The text can be broken anywhere because when imported, these continuation lines are appended without inserting blanks.

Relationships

A REL entry is provided for each relationship that can be used by the Access Definition as listed on the Specify Relationship Usage panel. The set of keywords is enclosed in parentheses. Every keyword corresponds to a value that can be specified to determine the use of a relationship 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 children extracted for a relationship. Specify: N NOCHILDREN UNLIMITED

294

Explicit number of rows. No child rows. All related child rows.

TYPE

Indicates whether the relationship is defined to PST or DB2.

DUPRELS

Indicates whether there is at least one other relationship with the same parent and child table.

PAR

Parent table.

CHI

Child table.

Move for DB2

4.5 Export and Import Processes 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] Parameters

Sources

Every parameter corresponds to a value that can be specified for an Compare Definition. DESCRIPTION

The description of the Compare Definition. The text may be from 1 through 40 characters long and must be enclosed in double slashes.

SECURITY

The security assigned to the object. Specified as one of the following:

SRC1TYPE

SRC2TYPE

User Manual

PUBLIC

All can use and modify. Default.

READONLY

All can use but only owner can modify.

PRIVATE

Only owner can use and modify.

Specifies the type of source and name for Source 1 as one of the following: EXTR

Name of the Extract File.

AD

Fully qualified name of the Access Definition.

LOCALAD

Entire Access Definition specification.

Specifies the type of source and name for Source 2 as one of the following: EXTR

Name of the Extract File.

AD

Fully qualified name of the Access Definition.

295

4. Definitions LOCALAD

Entire Access Definition specification.

ALL

All tables in the database. The tables are listed in the Table Map specifications.

For details on the contents of the Access Definition specification see the explanation for Access Definitions in this section. Table Map

The complete definition of a Table Map, TM, is always included. The qualifiers are specified within parentheses. For details on the contents of the Table Map specification see the explanation of Table Maps in this section.

Compare Process Data Set

When a data set name has been specified for the results of the Compare Process, that name is included as the parameter CMPDSN. Otherwise, the parameter CMPDSN is not included in the Compare Definition statement.

Relationships

Each relationship in the Compare Definition is specified by a REL parameter. The keyword qualifiers correspond to the relationship specifications for the Compare Definition:

296

STATUS

Indicates whether the relationship is selected, unselected, or for a reference table.

SOURCE

Indicates whether the relationship is taken from Source1 or Source 2.

TYPE

Designates whether the relationship is defined in the DB2 catalog or the PST Directory.

PAR

Fully qualified name of the parent table.

CHI

Fully qualified name of the child table.

Move for DB2

5. Data Migration MOVE provides a set of flexible processes for migrating related data and object definitions from multiple tables. To migrate a related set of data and object definitions, you specify the:

Specify Source



Source



Destination

To specify the source you use an existing Access Definition or create a new Access Definition. The created Access Definition can be temporary, for a single use, or permanent, saved for repeated use. The Access Definition is used as input to the Extract Process. (See Section 3. Specify Access Definitions for a detailed discussion of creating 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 File is saved and can be reused as needed.

Specify Destination

The Insert Process copies the source data and object definitions to a destination. MOVE offers flexibility for changing the destination specification or automatically inserting the data and object definitions in a logical manner. For example, if the destination tables do not exist, MOVE provides the option of creating tables to match the source followed by inserting the data. If the named destination tables do exist but do not match the source tables, you can use Column Maps to specify exactly what data is placed in each column. This includes the source data, literal values, special registers, expressions, exit routines and DB2 defaults. (See Section 4.3 Column Maps for a detailed discussion of Column Maps. See Section 4.4 Table Maps for a detailed discussion of Table Maps.)

User Manual

297

5. Data Migration

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 Load 4 DELETE - Delete Data from DB2 Tables 5 CREATE - Create Tables and Related Object Definitions 6 CONVERT - Convert Extract File Using Table and Column Maps R B

RETRY/RESTART BROWSE

- Retry/Restart an Insert or Delete Process - Browse Content of Extract File or Control File

Figure 161. Data Migration Menu Panel Options

The available options are: 1 EXTRACT

Specify the set of data to be extracted. After the set of source data is specified, MOVE extracts the data and stores it in an Extract File. The extracted data can include the rows from the specified set of source tables and the object definitions for those tables. You can request the object definitions for tables, primary keys and relationships, indexes, views, synonyms, and aliases. The specifications for the extracted data can be defined in an Access Definition and stored for repeated use or defined as temporary for one-time use. The Extract File is used as the input for the other options. If Compare for DB2 is installed, the Extract File can be used as input for the Compare Process. The contents of the Extract File can only be modified using the EXTRACT Option. The other options do not modify it. If BMC’s UNLOAD PLUS is available, it can be used to extract the data from the Image Copy files or directly from the DB2

298

Move for DB2

5.1 Migration Menu VSAM files. Extract Files created using Relational Tools for OS/2 may be used as input to the other MOVE migration processes. However, DB2 Common Server supports the ON UPDATE clause and user-defined data types for columns 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 using this option can be used by Relational Tools for Servers. See Section 7. in the Move for Servers User Manual. 2 INSERT

Specify the DB2 destination for the source data in an Extract File. This option inserts the source data into the destination. When tables involved in the insert do not exist at the destination, you may direct MOVE to create them. In addition, any other object definitions in the Extract File for objects that do not exist at the destination may also be selected. By default, the objects that are created are identical to the source objects. A Table Map is used to specify the destination table names that correspond to source table names. Additionally, a Column Map can be used for any source and destination table pair when the column names or attributes do not match, or when the data values are to be altered. The destination tables do not have to be in the same subsystem as the source tables.

3 DB2 LOAD

User Manual

Create DB2 load files from the Extract File. These files can then be used for input to IBM's DB2 Load Utility or any other third party load facility. (If BMC’s LOADPLUS has been specified by site or user option as the load utility to be used, the DB2 LOAD option is replaced with LOADPLUS. See the information on user options for information on specifying the load utility.)

299

5. Data Migration 4 DELETE

Delete the data from the DB2 tables as defined in the Extract File. The Extract File is retained. Only rows of data can be deleted. Object definitions are not deleted.

5 CREATE

Create DB2 tables and related objects for which definitions are contained in the Extract File.

6 CONVERT

Convert the source data defined in the Extract File. The original source data is converted by applying the Table Map and Column Map specifications to obtain a new or revised Extract File. This new Extract File contains the converted data to migrate. This is useful for masking sensitive data and for migrating DB2 data from MVS to another platform, such as DB2 for OS2 and XDB, where the database design may be different.

R RETRY/RESTART

Complete an Insert or Delete that has not successfully processed the entire Extract File as specified. RETRY allows you to process any rows that may have been discarded (e.g., due to RI constraints). RESTART allows you to "restart" a process that terminated abnormally because of time or space limitations or by user request.

B BROWSE

Display an Extract File to view the contents of that file or a Control File to examine extracted data or identify rows in error.

The remainder of this section discusses each of these options. Panel Fields

The following three fields are available: SQLID

300

Current SQLID. If you modify this value, MOVE will attempt to connect using the modified SQLID. Since you can be connected with only one SQLID, the connection with the original SQLID is not maintained. However, if MOVE cannot connect with the specified SQLID, a rollback is performed and you are reconnected with the original SQLID.

Move for DB2

5.1 Migration Menu SUBSYS

Current subsystem. If you modify this value, MOVE will attempt to connect to that subsystem. Since you can be connected to only one subsystem at any time, the original subsystem is disconnected. However, if MOVE cannot connect to the specified subsystem, a rollback is performed and you are reconnect to the original subsystem.

LOCATION

Current location. This field is only displayed if remote access is available. If you modify this value, MOVE will attempt to connect to the remote location. Since you can be connected to only one subsystem at any time, the original subsystem is disconnected. However, if the connection fails, the Relational Tools session is restarted and the Main Menu is redisplayed.

User Manual

301

5. Data Migration

5.2 Extract Data The Extract Process is used to create an Extract File. An Extract File contains the selected set of related rows from one or more tables and, if requested, the object definitions for those tables. The Extract File is used as input to the MOVE processes Insert, Update/Insert, Delete, DB2 Load, Create, and Convert. The Extract File can be used repeatedly and simultaneously by many users. To perform the Extract Process you must specify the set of data to be extracted. You can use specifications from an existing Access Definition, create a new Access Definition, or specify temporary definitions. Extract File

An Extract File is created by traversing a set of tables. The tables and the relationships to use to traverse those tables are specified in an Access Definition. In addition, the set of extracted rows is determined by other specifications such as: •

Manual selection of specific rows in the Start Table. This selection 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. For example, select every twentieth row.

The definitions for tables and columns are always extracted. Additionally, you can request the following object definitions to be included in the extract: Primary Keys and Relationships Indexes Aliases Views Synonyms Column Field Procedure Names

302

Move for DB2

5.2 Extract Data

5.2.1 Extract Process Menu When you select Option 1 EXTRACT on the Data Migration menu to perform the Extract Process, the following menu is displayed.

----------------------------- EXTRACT Process ---------------------------OPTION ===> 1 2 3 4

TABLES PATHS OBJECTS PERFORM

-

Specify Specify Specify Specify

Set of Tables and Selection Criteria Traversal Paths via Relationship List Object Definitions to EXTRACT 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===> These S I D AT

N

(Y-Yes, N-No)

commands are available when the AD Selection List is displayed: - Select a Definition - Display Information about a Definition - Delete a Definition - Modify Attributes of a Definition

Figure 162. Extract Process Menu Menu Options

Select one of the options: 1 TABLES

Define or modify specifications for the set of tables subject to the Extract Process. This option displays the Select Tables/Views for AD panel, which is used to specify the names of the tables to be included in the extract in the Table List. This panel also displays the type of selection criteria, if any, that has been defined for each table. You can specify a random factor and row limits for each table on this panel. You can use commands to display additional panels for defining selection criteria or an SQL WHERE Clause. This panel also enables you to invoke the Point-and-Shoot facility to select rows from the Start Table. For detailed information on how to specify the names of the tables, see Section 3.3 Table/View Selection. For information on specifying selection criteria and SQL WHERE Clauses, see Section 3.4 Specifying Criteria. For information on the Point-and-Shoot facility see Section 3.5 Using the Point-and-Shoot Facility.

User Manual

303

5. Data Migration 2 PATHS

Display and modify the relationship list. The Specify Relationship Usage panel is used to select the relationships to be traversed when extracting the data. For detailed information on how to specify the relationships and accompanying parameters, see Section 3.7 Selecting Relationships.

3 OBJECTS

Display the Specify Object Definitions to EXTRACT panel from which the objects to be extracted are selected. The selections are profiled and used by default every time an Extract Process includes object definitions.

4 PERFORM

Display the Specify EXTRACT Parameters and Execute panel to specify the parameters and invoke the Extract Process. The parameters include the specification for whether object definitions are to be extracted. If BMC’s UNLOAD PLUS is available, a prompt is included to specify whether it is to be used for the current extract.

Temporary or Permanent

Indicates whether the specifications defined for the extract are temporary, discarded after the extract, or permanent, saved in the Access Definition. If they are to be temporary, specify T for TEMP in response to the prompt, Type of Access Definition to Use for EXTRACT. If they are to be permanent, specify P. You must specify the name of an Access Definition when the specifications are to be stored permanently.

Access Definition Name

If you decide that the specifications are permanent, specify the name of the Access Definition to be used for the process. The fields on the panel correspond to the three parts of the Access Definition name: GROUP USER NAME

Create a New Access Definition

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 Access Definition.

Selection List

You can leave the fields blank or use DB2 LIKE syntax to display a selection list of available Access Definitions. Use the Select line command, S, to select an Access Definition from the list.

304

Move for DB2

5.2 Extract Data After you have selected the Access Definition and used ENTER, the EXTRACT Process menu is redisplayed. The name of the selected Access Definition is displayed in the Access Definition Name field. Specify Options

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 other sections of this manual. Once the source data has been specified, use Option 3 to specify which object definitions are to be extracted if object definitions are requested with the Extract Process. Use Option 4 to perform the extract.

Available Commands

The following primary commands are available when the EXTRACT Process menu is displayed: CANCEL

END

OPTIONS

5.2.2 Select the Object Definitions When you select Option 3 from the EXTRACT Process menu to select the types of object definitions, the Specify Object Definitions to EXTRACT panel is displayed. By default primary keys, relationships, and indexes are extracted. (These are shown as SELECT status in Figure 163. Specify Object Definitions to EXTRACT.) Table and column definitions are always extracted, even when object definitions are not requested because MOVE always enables users to create non-existent destination tables. You can select and unselect the object definitions to be extracted. The selected object definitions are extracted for every table included in the Extract Process. The values you specify are profiled and will be used automatically for every subsequent request to extract object definitions.

User Manual

305

5. Data Migration

--------------------Specify Object Definitions to EXTRACT ---------------Command ===> Use S Line Command to Select ALL Associated Objects of Specified Type Use U Line Command to Unselect Associated Objects of Specified Type Cmd --_ _ _ _ _ _

Status -------SELECT SELECT UNSELECT UNSELECT UNSELECT UNSELECT

Object Type ----------------------------Primary Keys and Relationshipss Indexes Views Aliases Synonyms 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 Panel Fields

The fields on this panel include: Cmd

Status

Object Type

Line command field. The available line commands are: S

Select object definition.

U

Unselect object definition.

Indicate whether an object definition is to be extracted. Displayed as: SELECT

Object definition is to be extracted.

UNSELECT

Object definition is not to be extracted.

List of the types of object definitions that can be extracted. The default selected types, Primary Keys and Relationships and Indexes, are shown with the SELECT status in the Figure 163. Specify Object Definitions to EXTRACT. The index for the primary key is always extracted when Primary Keys and Relationships are selected regardless of whether Indexes is selected. If Column Field Procedure Names is selected, then the names of the edit and validation exit routines for the table are also extracted.

Only for Tables

306

The object types that are selected are extracted only for table objects listed on the Select Tables/Views for AD panel. These selected object definitions are not extracted when the object on the Select

Move for DB2

5.2 Extract Data Tables/Views for AD panel is not a table. Therefore, when an alias, synonym, or view is specified on the Select Tables/Views for AD panel, that object definition is extracted but none of the related object definitions 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 to create Temporary Tables at the destination. However, there are no keys, relationships, etc., associated with Temporary Tables and no data stored in these tables. You should consider what is to be created at the destination. If you do not need the related objects (primary keys, relationships, and indexes, etc.) for object definitions other than tables, you can specify the alias, synonym, or view on the Select Tables/Views for AD panel. However, if you need the related objects, you can specify the base table on the Select Tables/Views for AD and then specify the object type on the Specify Object Definitions to Extract panel. By this means, the desired object and the related objects are extracted. Generic primary keys and relationships are extracted as generic objects. Therefore, they are created as generic unless you modify the Creator ID on the Create Object Definitions panel or modify the SQL statements generated to create the objects. Joined views are only extracted if all tables involved in the view are included on the Select Tables/Views for AD panel. For Primary Keys and Relationships, the pertinent object definitions for all tables on the Select Tables/Views for AD panel are extracted including those for reference tables. For more information about creating object definitions, see Section 5.7 Create Process. Available Commands

The following commands are available on this panel: CANCEL

END

OPTIONS

RESET

END returns to the EXTRACT Process menu. CANCEL abandons your changes and returns to the EXTRACT Process menu.

User Manual

307

5. Data Migration

5.2.3 Perform the Extract Process When you select Option 4 from the EXTRACT Process menu to perform 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 Extract Data using

===> _______ ===>

(1-10000, Blank-Site Limit) (D-DB2, B-BMC'S Unload Plus)

Perform Convert with Extract

===>

(Y-Yes, N-No)

Run Process in Batch or Online ===> O If Batch, Review or Save JCL ===>

(B-Batch, O-Online) (N-No, R-Review, S-Save)

Figure 164. Specify EXTRACT Parameters and Execute Panel Fields

The fields on this panel include: Extract File DSN

Name of the Extract File that is to contain the extracted data. This file must be a sequential data set. The Extract File name can be specified explicitly by enclosing it in quotes; otherwise, the default prefix as specified on the User Options panel is automatically prepended to the name. When the Extract Process begins, MOVE searches for the named data set. •

If the data set exists, MOVE checks to determine whether it is suitable for an Extract File.

If it is, the current Extract Process overlays the data. If it is not an Extract File, MOVE does not perform the extract and prompts you to respecify the data set name. •

If the data set does not exist, MOVE prompts for the necessary information to allocate the file. See Appendix B. Allocating External Files for a description of the allocation prompts.

You can obtain a selection list of data sets using

308

Move for DB2

5.2 Extract Data either of the wild card characters, % or *, in the last position of the name in this field. Use the Select line command, S, on the selection list to select the file. Extract

Extract is to include data and/or object definitions. Specify: D O B

Select Start Table Rows by

Only data rows are extracted. Only object definitions are extracted. Both data and object definitions extracted.

Values to be used to determine which data rows are to be extracted from the Start Table. Specify: R B

Use only the Row List values. Use both the Row List and the selection criteria. That is, extract the rows identified in the Row List and then any additional rows that satisfy the selection criteria.

This prompt is displayed only if both selection criteria and a Row List have been defined for the Start Table. If only one of these has been defined, it is automatically used for the Extract Process and the prompt is omitted. Limit Number of Extract Rows

Maximum number of rows of data that can be extracted. This applies to data rows only and not to object definitions. The Extract is terminated if the number of extracted rows exceeds this limit. Specify: value blank

0 - 99999999 Site-defined limit

The figure shows the distributed default maximum of 10,000. The site-defined limit is set on the Site Options panel. Extract Data using

Specify whether DB2 or BMC's UNLOAD PLUS is to be used to extract the data. Specify: D B

User Manual

DB2 is used. BMC's UNLOAD PLUS is used.

309

5. Data Migration Perform Convert with Extract

Run Process in Batch or Online

Specifies whether the Convert Process is performed before the data is written to the Extract File. The Convert Process can mask sensitive data or alter data values. Y

Convert Process is performed. (After ENTER is pressed, the Specify Convert Parameters panel is displayed.)

N

Convert Process is not performed.

Specify whether execution of the Extract Process is performed in batch or online. Specify: B O

Batch Online

If site management has established a maximum number of rows for online processing and this request exceeds that limit, this option is forced to Batch and cannot be changed. Site management may have guidelines. If Batch, Review or Save JCL

Available Commands

N

Submit job, do not display or save the JCL.

R

Display the JCL for review prior to job submission.

S

Save the JCL. Prompts are provided for you to specify the name of a file in which to store JCL.

The following commands are available on this panel: CANCEL

310

For batch execution, indicate whether JCL should be submitted, reviewed prior to job submission or saved for submission at a later time. Since the JCL is displayed in the ISPF editor, you can modify it for the current request and save it to submit later. Specify:

END

OPTIONS

Move for DB2

5.2 Extract Data

Extract File Selection List

The following figure shows the selection list panel that is displayed when you request a list of Extract File data set names. This figure shows a full-screen display.

------------------------- Select Extract Data Set ----------------------Command ===> Scroll ===> CSR Cmd ---------------- Data Set Name --------------******************** TOP ********************* ___ PSTDEMO.COHEND.XFILE ___ PSTDEMO.CUST.XCUST ___ PSTDEMO.NAD.XFILE ___ PSTDEMO.SENTNER.XFILE ___ PSTDEMO.SHIP_TO.TEST ******************* BOTTOM *******************

1 OF 5

Figure 165. Select Extract Data Set Use the Select line command to select a data set. Use END to return to the Specify EXTRACT Parameters and Execute panel. 5.2.3.1 UNLOAD PLUS Users can indicate whether the data is to be extracted from DB2 directly or from BMC’s UNLOAD PLUS utility only when the utility is 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 for Extract

User Manual

311

5. Data Migration Panel fields

The panel prompts for the following: Source for Extract Data

Image Copy DSNs

312

Specify which files are to be used as the data source. Specify: I

Image Copy files are the source.

D

Database VSAM files are the source.

Specify which Image Copy datasets are to be used. You indicate whether the most recent Image Copy is used or an Image Copy is selected by date and time. A

First Image Copy files on or after the date and time specified on the panel.

B

First Image Copy files on or before the date and time specified on the panel.

L

Latest Image Copy files. The date and time specified on the panel are ignored.

S

Image Copy files named in Image Copy DSN.

Date

Specify the date in the format defined for your site.

Time

Specify the time in the format defined for your site.

Use Subset

Specify whether or not the Extract Process extracts from all partitions or a specific set of partitions when the Start Table is in a partitioned tablespace. Specify: Y

A selection list of partitions is displayed from which you select specific partitions to be included in the process.

N

All partitions are used.

Move for DB2

5.2 Extract Data Selecting a Subset

If you specify Y for Use Subset, a list of partitions is displayed. The following 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 field to select or unselect partitions. Use S to select and U to unselect a partition. You can select any number of partitions, however, if you do not select at least one, the Use Subset option on the Specify BMC UNLOAD PLUS Parameters panel is automatically changed to N and all partitions are used. The partitions are numbered on the panel as aid when selecting specific partitions. The selected partitions are identified by the S to the right of the number. The Partition Values field displays 55 characters. Although DB2 limits the useable portion of the partition value to the first 40 characters, when the value is converted to external value it may be longer. This field displays only the first 55 characters. You can scroll the list.

User Manual

313

5. Data Migration 5.2.3.2 Perform Convert with Extract When you specify YES for the Perform Convert with Extract prompt, 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 the original extracted data in this file, specify a Second Extract File to store the converted data. 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 Panel fields

314

The panel prompts for the following: Extract File DSN

Name of the Extract File that contains the source data to be converted.

Second Extract File DSN

Name of second Extract File that is to contain the converted data. If not specified, converted data replaces the original extracted data. Specify if you need to retain original extracted data.

Control File DSN

Name of Control File that is to contain the processing information about the Convert Process.

Display Table Map and Column Maps

Displays Table Map panel. Specify the names of the destination tables for each table in the Extract File. A Table Map must be specified to perform the Convert Process, therefore if you do not select this option first, MOVE automatically displays the Table Map panel before proceeding with the selected option. When the Table Map is displayed, you must specify the destination Creator ID, Dest CID. By default, MOVE assumes the base destination table names are the same as the names defined in the Extract File.

Move for DB2

5.2 Extract Data There is no default destination Creator ID. Only destination tables listed on the Table Map are included in the Extract File. You may specify Column Maps for one or more destination tables. These maps enable you to specify the destination data column-by-column. For more information about specifying Table Maps and Column Maps, see Section 4.4 Table Maps and Section 4.3 Column Maps. Age Date Values

Specify whether date values are to be aged as part of this process. Specify: Y

Date values are to be aged. The Specify Aging Parameters panel is displayed. On this panel, specify aging values to be used. These values supplement the specifications for columns mapped with AGE and FUTURE_YEAR functions and are used, if requested, to age DATE and TIMESTAMP columns not explicit targets of an AGE or FUTURE_YEAR function.

N

User Manual

Date values are not to be aged. The specifications for aging on the Column Maps included in the process are ignored.

Limit Number of Discarded Rows

Specify a maximum number of rows that can be discarded. When this value is reached, the Convert Process is terminated.

Sort Extract File Rows

Specify whether the data for destination tables with a cluster index are to be sorted. Specify: Y

Sort rows.

N

Do not sort rows.

315

5. Data Migration

5.2.4 Extract Processing After you have completed the Specify EXTRACT Parameters and Execute panel, press ENTER. MOVE evaluates the Access Definition to be used and your entries on the Specify EXTRACT Parameters and Execute panel. The Extract proceeds as follows: Online Processing •

The Access Definition is evaluated. If the Access Definition contains an invalid entry, an appropriate error or warning is displayed. (Details are discussed later in this section.)



The Extract File is located and the contents evaluated to ensure that the named file is an Extract File. If it is not an Extract File, an error message is displayed and you are reprompted to specify the file name. If the Extract File does not exist, you are prompted for allocation information and the file is allocated by MOVE.



The Extract Process is executed online. A status report is displayed and updated periodically during the processing.



An Extract Process Report is generated and displayed for browsing.

Batch Processing (including BMC’s Unload Plus) •

The Access Definition is evaluated. If the Access Definition contains an invalid entry, an appropriate error or warning is displayed. (Details are discussed later in this section.)



The Extract File is located and its attributes are evaluated to ensure that the named file is suitable as an Extract File. If it is not suitable, a message is displayed and you are reprompted to specify the file name. If the Extract File does not exist, you are prompted for allocation information and the file is allocated by MOVE.



The JCL is built. If you have responded Review to If Batch, Review or Save JCL, the JCL is displayed. (You can modify this JCL or save it and execute the job later. Details are discussed later in this section.) If you have responded Save to If Batch, Review or Save JCL, you are prompted for the name of the file in which to save the JCL and

316

Move for DB2

5.2 Extract Data whether the job should be submitted after saving the JCL. (Details are discussed later in this section.) •

The Extract Process is executed as a batch job. Note the Extract File must be located again when the process is executed.



An Extract Process Report is generated and stored in the default output file specified in the JCL.

Access Definition Evaluated

There are a few conditions that can be detected in the Access Definition that prevent the Extract Process from proceeding and some conditions that present warning messages.

Error Conditions

Error conditions can result when an existing Access Definition is used without review. Changes may have been made to the database that are only detected when the Access Definition is edited or used. The following error conditions also prevent you from saving an Access Definition that you are editing. The error conditions include: •

Duplicate entries are encountered for a single table. A table can be included on the list only once. You can not specify a table and one or more views, synonyms or aliases of that table, or specify more than one view, synonym or alias of a table. To perform the extract, delete the duplicate entries. Note, if the Access Definition was created for Access for DB2, duplicate entries are valid for editing.

User Manual



No valid table is specified. The list of tables in the Access Definition does not contain any valid tables. This can occur if the tables have been dropped from the database. Also, any tables not fully qualified when named are affected when the default Creator ID is changed. To perform the extract, re-specify the tables in the Access Definition.



A WHERE clause is invalid. Selection criteria, for one or more tables, regardless of how it is specified, are invalid. This can occur if changes have been made to the tables since the Access Definition was created. (For example, a column used in an SQL WHERE Clause has been dropped.) To perform the extract, respecify the selection criteria.



The Start Table is invalid. This can occur if the table is dropped from the database or the default Creator ID was changed and the Start Table name was not fully qualified. The table is then marked as UNKNOWN and can not be used as a Start Table.



The primary key is missing in a child table that has multiple parents. The primary key is required to ensure that multiple

317

5. Data Migration copies of the same row are not extracted when the child table is related to multiple parents. • Warnings

318

The user requesting the extract does not have authorization to select data from a table that is to be included.

A warning message is issued for every condition that may require your attention, but these conditions do not prevent the extract from proceeding. When warning messages are issued, you are given the option of proceeding or aborting the Extract Process. Warning messages are issued for the following conditions: •

A relationship is in NEW status. This indicates that a relationship has been added to the list and you have not explicitly selected or unselected it. You can use the Specify Relationship Usage panel to view the relationship list and specifically select or unselect individual relationships. You can use the prompt Use NEW Relationships on the Access Definitions Parameters panel to specify whether NEW relationships are selected or unselected as the desired default behavior. In general, you will probably want to review these relationships before using them.



A relationship is in the UNKNOWN status. This occurs when the Default Creator ID of the Access Definition has been changed, and a relationship, defined for tables named with the original Creator ID, does not have a comparable relationship when named with the new Creator ID.



A table is in UNKNOWN status. This occurs when the Default Creator ID has changed causing the name of the table to change and a table does not exist with this changed name. UNKNOWN also occurs when the table has been dropped from the database.



A table specified in the Access Definition is not traversed for the Extract Process. This indicates that a relationship is not selected to provide a path from the Start Table to this table.



A relationship specified in the Access Definition is not traversed for the Extract Process. This indicates that a relationship is not used during the extract.



A table specified in the Access Definition has not had RUNSTATS run against it. If the table is large, this could have performance consequences when the extract is performed.



A view, synonym, or alias is to be extracted, but object definitions for objects other than primary keys and relationships have been requested. These other object definitions will not be extracted for views, synonyms, or aliases.

Move for DB2

5.2 Extract Data Error and Warning Reporting

If one or more errors or warnings are encountered, the EXTRACT Errors & Warnings panel is displayed. Any error prevents the Extract Process from proceeding. The Extract Process can continue despite warnings. You may use the SHOW STEPS command to display additional information about how the Extract Process will proceed. In the following figure, the EXTRACT Errors & Warnings panel is displayed. 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 Point-and-Shoot Validation

If specified, the data set containing the primary key values for selected rows using Point-and-Shoot is checked as part of the validation of the Access 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 that cannot be found.

If any of these problems are encountered, you are prompted to specify how to proceed. You can continue processing without using the Point-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 card information is taken from the JCL specified on the Job Card and Print Options panel. If you specified YES to the prompt, Prompt for Changes Before Job Submission on the Job Card and Print Options panel, the default job card as specified on that panel is displayed prior to job

User Manual

319

5. Data Migration submission. You may edit the job card and specify whether changes are 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 to perform the Extract Process. If you specify Review to the prompt If Batch, Review or Save JCL on the Specify EXTRACT Parameters and Execute panel, the complete jobstream is displayed in 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 submitted when END is used, the job is submitted. Otherwise, you will have to explicitly SUBMIT the job from the ISPF editor. (See Section 6.1 User Options, for information on establishing whether jobs are automatically submitted when END is used.) If you do not want to submit the job, use CANCEL to return to the Specify EXTRACT Parameters and Execute panel. You can modify the specifications or cancel the extract request from this panel. If an error is encountered in the job card, a message is displayed. You can review the job card and correct the error or terminate the Extract Process. Batch Overrides

If you save the JCL generated by MOVE to a data set, you can SUBMIT the job directly from the ISPF editor instead of from within a MOVE session. When you do so, you can override the default Creator ID, selection criteria, and SQL WHERE Clause defined in the Access Definition used for the Extract Process. This is especially useful when several extracts are to be performed for a set of tables that vary only by Creator ID or by some set of selection criteria. You can override these values for batch execution by inserting the DD name PSDFOVRD to point to the desired overrides. The possible overrides are DEFCID, SEL, SQL, GROUP, and UNKNOWN. (Examples are presented after the discussion of the overrides.)

BMC_IMAGECOPY _DSN

To override the Image Copy DSN parameter for BMC UNLOAD PLUS, specify: BMC_IMAGECOPY_DSN

BMC_IMAGECOPY _DATE

To override the Image Copy Date parameter for BMC UNLOAD PLUS, specify: BMC_IMAGECOPY_DATE

320

image.file.dsn

yyy-mm-dd

Move for DB2

5.2 Extract Data BMC_IMAGECOPY _TIME

To override the Image Copy Time parameter for BMC UNLOAD PLUS, specify: BMC_IMAGECOPY_TIME

BMC_IMAGECOPY _SELECT

To override the Image Copy Date Criteria parameter for BMC UNLOAD PLUS, specify: BMC_IMAGECOPY_SELECT

DEFCID

hh.mm.ss

[ 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 to tables that are not explicitly qualified in the Access Definition.

This override also affects the names of the tables in the relationships on the Relationship Usage list. If a relationship is not found for the updated table name, an error occurs when the extract is performed. Only one DEFCID parameter may be specified for an Extract Process. SEL

To override the selection criteria in the Access Definition for a table or to specify selection criteria for a table that does not have selection criteria in the Access Definition, specify: SEL

[cid.]table column [ selcriteria ]

cid.table

The table name must be specified. If you do not specify the Creator ID (cid.), the default Creator ID defined in the Access Definition is assumed.

column

The column name must be specified.

selcriteria The selection criteria. This usually begins with an SQL operator and must conform to the format required on the Specify Selection Criteria panel (see page 70). The specification here is limited to a maximum of 53 characters. If you do not specify selection criteria, any selection criteria specified in the Access Definition is ignored for the current Extract Process. Selection criteria can be specified for one or more columns in the table, but when specifying multiple criteria, each must apply to a different column.

User Manual

321

5. Data Migration You can specify only one SEL parameter for each column in a table. You can specify selection criteria overrides for as many of the columns in as many of the tables as you want as long as a separate SEL parameter is provided for each column. SQL

To override the SQL WHERE Clause in the Access Definition for a table or to specify an SQL WHERE Clause for a table that does not have one in the Access Definition, specify: SQL

[cid.]table [ where ]

cid.table

The table name must be specified. If you do not specify the Creator ID (cid.), the default Creator ID defined in the Access Definition is assumed.

where

The SQL WHERE Clause. This must conform to the requirements specified for the Specify SQL WHERE Clause panel. However, the keyword WHERE is not required and the specification here is limited to a maximum of 425 characters. If you do not specify an SQL WHERE Clause, any SQL WHERE Clause specified in the Access Definition is ignored for the current Extract Process.

You can specify the WHERE Clause override for more than one of the tables as long as a separate SQL parameter is provided for each. You can specify only one SQL parameter for a table. GROUP

To override the Group Selection Processing in the Access Definition for the Start Table or to specify Group Selection Processing when it has not been defined, specify: GROUP

[column VALUES=values ROWS=rows]

column

The name of the column in the Start Table for which Group Selection Processing is requested. The column must exist in the Start Table.

values

The number of distinct values to select for the specified columns. The value must be in the range 1 and 99999999. Specify an asterisk to obtain a specific number of rows from all distinct values of the column. (For additional information see Section 3.6 Group Selection Processing.)

rows

The number of rows to select for each value of the specified column. The value must be in the range 1 and 99999999. Specify

322

Move for DB2

5.2 Extract Data an asterisk to obtain all rows for each distinct value of the selected column. Only one asterisk may be specified, therefore an asterisk cannot be specified 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 Selection specifications in the Access Definition for the current Extract Process. UNKNOWN

To ignore any objects referred to in the Access Definition that do not exist when performing the Extract Process, specify: UNKNOWN

{ FAIL | ALLOW }

FAIL

Terminate the extract if any tables or relationships named in the Access Definition are unknown. The report will contain a message noting the first unknown object. This is the default.

ALLOW

Bypass the unknown tables and relationships and continue with the Extract Process. The report will contain a message listing the unknown objects.

Since the Extract Process uses existing tables and the existing relationships between those tables to traverse the database, be aware that if an unknown table or relationship is bypassed, “related” tables in the Access Definition may not be included even when these tables exist. UNKNOWN ALLOW is most frequently used when you override the default Creator ID with DEFCID. Changing the default Creator ID may result in naming tables that do not exist. The UNKNOWN ALLOW parameter enables you to direct the Extract Process to skip these “unknown” tables. Rules for Parameters

User Manual

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.

323

5. Data Migration •

If multiple selection criteria are specified, they are ANDed or ORed based on your response on the Specify Selection Criteria panel.



If both an SQL WHERE Clause and selection criteria are specified for an individual table, the clauses are ANDed.



You can store the parameters in a sequential file or a partitioned data set. The record length should be 80. If it exceeds 80, only the first 80 characters are processed. Sequence numbers are not allowed. The parameters should conform to the same syntax required when specified directly in the jobstream.

Override Examples

To override the default Creator ID and specify selection criteria for two 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.00 SEL CUSTOMERS STATE ='NJ' SEL ORDERS FREIGHT_CHARGES >50.00 SEL requires at least one space between the column name and the selection 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 JERSEY SQL PSTDEMO2.CUSTOMERS WHERE CITY= 'PRINCETON' AND STATE='NJ' 2. To specify a sequential file named PST.SAMPLE.PARMS as the source 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 an Archive Process utilizing BMC Unload Plus, insert in the JCL: //PSDFOVRD DD * * CHANGE IMAGE COPY SPECIFICATION TO * A PARTICULAR DATASET BMC_IMAGECOPY_SELECT S BMC_IMAGECOPY_DSN PST.IMAGE.COPY Save JCL

324

Move for DB2

5.2 Extract Data Save JCL You can save the JCL, modify it and execute the process without reinvoking MOVE. Specify S to the prompt, If Batch, Review or Save JCL 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 Panel Fields

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 partitioned data set. If you specify a partitioned data set, specify the member in the field provided for the Member prompt.

Member (if PDS)

Name of the member in the partitioned data set specified for the DSN prompt. If a sequential file is specified and you specify a member name, an error message displays.

Submit JCL or Review?

Specify whether the JCL is saved, saved and submitted, or displayed for review. If you select Submit, the JCL is saved and the job is submitted. If you select to review the JCL, use ISPF facilities to save or submit. If you select Neither, the JCL is saved, but not submitted or displayed for review.

Replace Existing Data?

Specify whether the generated JCL replaces existing 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

User Manual

325

5. Data Migration report. You should review the Extract Process Report to determine whether the job executed successfully. For example, the Extract Process uses UNLOAD PLUS only to read the data; the data is not written to DDNAME SYSREC. (The Extract Process uses its own facilities to write the data to the Extract File.) Therefore, UNLOAD PLUS sets a return code of 4 to indicate no records were written to SYSREC although the Extract Process has performed successfully. As another example, UNLOAD PLUS sets a return code of 12 when the Extract Process was successful but terminated prematurely because of a user limit for the number of rows from an individual table or for 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 message may be generated when termination is due to UNLOAD PLUS processing. 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 end of the UNLOAD PLUS Message File. Before invoking UNLOAD PLUS, MOVE checks for errors to ensure that the selection criteria adhere to the UNLOAD PLUS restrictions. If an error is encountered, MOVE displays a message. These restrictions 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 of the following terms: NULL, CURRENT DATE, or CURRENT TIMESTAMP. 4. The EXISTS predicate is not allowed.

326

Move for DB2

5.2 Extract Data 5.2.4.3 Online Execution Status When an Extract Process is performed online, MOVE provides a status notification pop-up window. The content of the window varies depending on whether data and/or object definitions are being extracted. 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 have been extracted from that table are displayed. This is revised: After every 1000 rows are extracted for each table to display the current total number of processed rows. When the extract for one table is complete and the extract for the next table begins. When object definitions are extracted, the status panel includes a list of the object definitions (primary keys and relationships, indexes, etc.), and the status of each as one of the following:

User Manual

COMPLETED

The object definition has been extracted.

IN PROGRESS

The object definition has been selected and is in the process of being extracted.

SELECTED

The object definition has been selected but has not been extracted yet.

UNSELECTED

The object definitions have not been selected.

327

5. Data Migration

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 the process. Display the Report

The contents of the EXTRACT Process Report can be browsed. When the process is executed online, the EXTRACT Process Report is automatically displayed. In batch, the report is placed in the default output file as specified in the JCL. You can then display the report as you would the output from any job.

Report Contents

The content of the EXTRACT Process Report reflects what has been extracteddata, object definitions, or both. The report in the following figure indicates that both data and object definitions have been extracted.

--------------------------- EXTRACT Process Report ----------------------Command ===> Scroll ===> PAGE ROW 0 OF 27 ******************************** TOP OF DATA ***************************** EXTRACT Process Report Extract File Access Definition Created by Time Started Time Finished

: : : : :

PSTDEMO.SAMPLE.EXTRACT.FILE.DSN PSTDEMO.SAMPLE.CUSTOMERS COHEND 01-15-98 09.52.33 01-15-98 09.52.45

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

1 2 3 4

Extracted Object Types ---------------------Table List Tables Related Primary Keys Related Relationships Related Indexes

1 2 3 4

Extracted Extract Tables Rows ------------------------ --------PSTDEMO.CUSTOMERS 132 PSTDEMO.ORDERS 792 PSTDEMO.DETAILS 2176 PSTDEMO.ITEMS 872

4 3972 132

Number -----4 4 3 4

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

Figure 172. Extract Process Report Format Report Format

328

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 and time the process was executed. This is followed by the statistics for the extracted object definitions and data.

Move for DB2

5.2 Extract Data Object Definitions Information

If object definitions are extracted, the report includes the list of types of object definitions and the number of each type that have been extracted. However, if object definitions were not explicitly requested, the table definitions are always documented in the EXTRACT Process Report.

Data Information

If data is extracted, the report includes the total number of tables in the extract and the combined total number of rows extracted from these tables. The Total Number of First Pass Start Table Rows displays the number of rows extracted from the Start Table in the initial pass. This value does not include the number of additional rows that may have been extracted in subsequent passes. Subsequent passes of the Start Table may be performed as a result of specifications for prompts Q1 and Q2 on the Specify Relationship Usage panel or RI cycles. The names of the tables from which data was extracted are listed in the order in which these tables were listed in the Access Definition. The number of rows extracted from each table is also provided.

Unmatched Pointand-Shoot Keys

If you used the Point-and-Shoot facility or otherwise created a row list to select rows in the Start Table for archiving, some rows may have been deleted before the Archive Process was executed. If so, the ARCHIVE Process Report lists the primary key values for which rows were not found. The list of unmatched primary keys follows the list of Archive Tables and is formatted like the following example: 3 Rows From Start Table Row List not Found PSTDEMO.CUSTOMERS 07053 07101 07103

Print Report

While browsing the EXTRACT Process Report online, you can use the OUTPUT command to direct the contents of the report to an output file or the printer. A panel is displayed prompting for the necessary information based on the specified output destination. (For details on the OUTPUT command, see the Relational Tools Command Reference Manual.) The report can be scrolled using the ISPF scrolling facilities. You can use the FIND command to locate a specific table.

User Manual

329

5. Data Migration

5.3 Control File Overview Once the Extract File has been created, you can insert and delete data and create object definitions using the Extract File as input. Extract File

The Extract File can be used by any of the processes listed on the Data Migration menu: Insert, DB2 Load, Delete, Create, and Convert. Also, since the Extract File is not modified by these processes, it can be used to perform processes by any number of users simultaneously. The Extract File ensures a consistent set of data.

Control File

To distinguish the execution of multiple MOVE processes by several users for the same Extract File, a Control File is generated for each execution of an Insert, DB2 Load, Delete and Convert Process. The Control File is a sequential file that contains information about the process parameters. This file also documents the success or failure of the processing of each row in the Extract File and whether the process completed.

Retry

The Control File identifies rows that are not successfully processed. An identifier indicates the reason for the failure. For example, rows may not be successfully processed when a request conflicts with RI rules (e.g., a row in a parent table cannot be deleted if children exist for that row and there is a DELETE RESTRICT rule). Based on the information in the Control File, you can correct the problem and execute the process again. For Insert and Delete processing you can "retry" the process such that only the rows that were unsuccessful or discarded in the original attempt are processed.

Restart

The Control File also notes whether an Insert or Delete process completed. When the process does not complete, you can “restart” the process at the point at which it was abnormally terminated. An Insert or Delete Process can be terminated abnormally when the time or space resources allocated for the process are insufficient. Abnormal termination can also occur when the process exceeds the user-specified limits. For example, the INSERT Process Parameters and Execute panel prompts for a limit to the number of rows that are discarded because they cannot be processed. When the number of discarded rows reaches the limit set by the parameter, Limit Number of Discarded Inserts, the process terminates.

330

Move for DB2

5.3 Control File Overview DB2 LOAD Process and Convert Process

User Manual

A Control File is also generated by the DB2 LOAD Process and the Convert Process. The file documents the success of the process. This file can then be browsed. However, the MOVE DB2 LOAD Process and the Convert Process can not be retried or restarted.

331

5. Data Migration

5.4 Insert Process The Insert Process is used to insert source data and object definitions from an Extract File into a destination database. To perform this process you specify the destination for the source data stored in the Extract File. If you want to create the object definitions at the destination without inserting data, use the Create Process, Option 5 on the Data Migration menu.

5.4.1 INSERT Process Menu When you select Option 2 on the Data Migration menu, the INSERT Process menu is displayed.

---------------------------- INSERT Process -------------------------OPTION ===> 1 2 3

TABLE MAP PERFORM INSERT PERFORM UPDATE

- Specify Table Map and Column Maps - Specify INSERT Parameters and Perform INSERT - 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 Panel Options

The available options are: 1 TABLE MAP

332

Specify the destination tables for each source table in the Insert Process. A Table Map must be specified for Options 2 and 3, therefore if you do not select this option first, MOVE automatically displays the Table Map panel before proceeding with the selected option. When the Table Map is displayed, you must specify, at least, the destination Creator ID, Dest CID, for the destination tables. By default, MOVE assumes the base destination table names are the same as the source table names defined in the Extract File. There is no default destination Creator ID.

Move for DB2

5.4 Insert Process You may specify Column Maps for one or more destination tables. These Column Maps enable you to specify, on a column-bycolumn basis, the source data for each destination column. 2 INSERT

Specify the Insert Parameters for the process and perform the Insert. Using this option, only those source rows that do not match an existing row in the destination table are inserted. If the primary key value of any source row matches an existing row in the destination table, the source row is marked as discarded in the Control File.

3 UPDATE

Specify the Update/Insert Parameters for the process and perform the Update/Insert. Using this option, rows that do not match an existing row in the destination table are inserted. Any matching source rows are used to update the existing destination rows.

In addition to selecting an option, specify: Extract File DSN

The name of the Extract File containing the source data to be inserted. This file must exist. By default, the name of the Extract File created by the last Extract Process is supplied. You can specify an explicit name by using quotes to delimit the desired name; otherwise, the default prefix as specified on the User Options panel is added to the name you specify.

Control File DSN

Name of a sequential file that is to be used to accumulate information and statistics about the Insert Process. To specify an explicit name, use quotes to delimit the desired name; otherwise, the default prefix as specified on the User Options panel is added to the name you specify. If the named file exists, the Insert Process will overlay the contents. If the named file does not exist, you are prompted for allocation information and the file is created by MOVE. (See Appendix B. Allocating External Files for details on allocating the file.)

User Manual

333

5. Data Migration The Extract File DSN and the Control File DSN values are profiled. Selection List

You can obtain a selection list for either the Extract File or the Control File by specifying the wild cards, * or %, as the last character in the name. When the list is displayed, use the Select line command, S, to select an entry. A sample of the selection list displayed for Extract File or Control File data set names is provided in Figure 165. Select Extract Data Set on page 311.

Available Commands

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, the INSERT Process Table Map panel is displayed. Use this panel to specify the destination tables and views. --------------------------- INSERT Process Table Map ----------------------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 ===> SOFTECH Map ID ===> Extract Tables Destination Table Name Type Column Map or "LOCAL" ------------------ ---------------------------- ------- ------------------*********************************** TOP *********************************** CUSTOMERS CUSTOMERS TABLE ORDERS ORDERS UNKNOWN DETAILS DETAILS VIEW ********************************** BOTTOM *********************************

Figure 174. Insert Process Table Map Panel Fields

334

The fields on this panel include: Src CID

The default Creator ID for the source tables as specified in the Extract File. This value cannot be modified.

Dest CID

The default Creator ID for the destination tables. Initially, the field is blank. A valid value must be specified. Specify the Src CID as the Dest CID only when you want to reinsert or update the data in the source tables or when inserting into a different subsystem having the same name tables.

Move for DB2

5.4 Insert Process Column Map ID

1- to 8-character Map ID. DB2 LIKE syntax can be used to display a selection list. If the field is blank or ‘%’ is specified, a list of maps for all Map IDs, as specified in the MAP NAME field, is displayed.

Extract Tables

Names of the tables included in the Extract File. The Creator ID is included only when it differs from the Src CID. These values cannot be modified.

Destination Table Name

Names of the destination tables that correspond to the listed source tables. Initially, MOVE supplies names for the destination tables that match the source table names. You can specify other names by overtyping the name in the field or by requesting a selection list from which to choose. You can request a selection list using the LIST TABLES command and placing the cursor on the field to be populated. If you leave a destination table name blank, the data in the Extract File from the corresponding source table is ignored for the current Insert Process.

Type

The type of the object named in the Destination Table Name field. MOVE supplies this value and it is not modifiable. The possible values are: TABLE VIEW UNKNOWN A-TABLE A-VIEW S-TABLE S-VIEW UNUSED TEMPTBL

A table A view Non-existent or initial display An alias of a table An alias of a view A synonym of a table A synonym of a view A destination table is not specified. Temporary table

MOVE automatically creates any destination table that is UNKNOWN. You are prompted for the required information before the process is performed.

User Manual

335

5. Data Migration Column Map or "LOCAL"

Specify the name of a Column Map to be used to insert the data into the destination table. If a Column Map ID is not specified, specify the fully qualified Column Map Name. Specify LOCAL to define a Column Map for the current Insert Process only. Specify the Column Map names manually or request a selection list using the LIST MAPS command. If you leave the field blank, a Column Map is not used. You can use the POPULATE command to insert the name of the Column Map in this field. If you specify a new Column Map name or LOCAL, MOVE assumes you want to define the Column Map and automatically invokes the Column Map editor. To edit an existing Column Map, use the MAP command.

Selection List of Destination Objects

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 the destination table name you want to supply. A selection list of available tables with the destination Creator ID is displayed. You can override the destination Creator ID with the LIST TABLES command as in LIST TABLES SMITH.%. To insert a table name, type the number of the DB2 Table in the Num field next to the destination table name in the selection list. You may select any number of tables from the list at one time. MOVE automatically places the selected name in the Destination Table Name field with same number.

Use Existing Table Map

You can use the APPLY command to populate the Table Map with the specifications from a previously defined Table Map. If the source tables 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 CID regardless of any entry, or populate only the blank fields.

Destination Table Type

MOVE automatically revises the Type each time you modify a destination table name. If you modify the Dest CID, any tables that are specified without an explicit Creator ID automatically use the new Dest CID. This may change the Type value and require review.

336

Move for DB2

5.4 Insert Process For example, assume the Dest CID is SOFTECH and the Destination Table Name is CUSTOMERS. The resultant table name is SOFTECH.CUSTOMERS. However, when the Dest CID is changed to COHEND, the table name becomes COHEND.CUSTOMERS and may be unknown. MOVE prompts for the information to create the table COHEND.CUSTOMERS before performing the Insert Process. (This prompt is displayed prior to entry onto the INSERT Process Parameters and Perform panel.) You can explicitly supply the Creator ID with the Destination Table Name. Then, changing the Dest CID does not affect the table name. Duplicate table names are not allowed. Therefore, the same table name cannot be specified twice as a destination table. Available Commands

The following commands are available on this panel: APPLY BOTTOM CANCEL

DOWN END LIST

MAP OPTIONS POPULATE

SAVE TOP UP

See the Relational Tools Command Reference Manual for details on these commands. More Information

Section 4.4 Table Maps provides detailed information on defining and storing Table Maps. Section 4.3 Column Maps provides detailed information on defining Column Maps.

5.4.3 Perform Insert and Update/Insert Process The distinction between performing an Insert Process or an Update/Insert Process is important. The difference rests on how existing rows in the table are processed when inserting rows that have matching primary key values. When the primary key value of the source row does not already exist in the destination table, there is no conflict and the row is inserted. However, when the primary key value of the source row already exists in the destination table, Insert and Update/Insert perform differently. If you select Insert, the source row is marked as discarded and is not inserted. If you select Update/Insert, the source row replaces or updates the existing row. For example, you may want to avoid blindly updating existing rows with duplicate primary key values. You can specify Insert to identify all of the rows that are not unique, then review the Extract File using the Browse Extract File option to determine which rows were duplicates and take action based on your findings. You can delete

User Manual

337

5. Data Migration specific destination rows in the database to avoid these conflicts and retry the Insert Process. (For details on the Retry Process, see Section 5.9 Retry/Restart Process.) Non-Unique Primary Keys

When the primary key for the source data is defined in the PST Directory and is not unique, more than one row in the Extract File may exist with the same primary key value. If this data is then used to Insert or Update/Insert into a destination table defined with a unique primary key, only the first row with that primary key value in the Extract File is processed. The additional rows are not processed and are identified as such in the Control File. When the primary key for the destination table is also defined in the PST Directory and is not unique, more than one row in the destination table may exist with the same primary key value. For Insert processing, the rows in the Extract File are inserted. For Update/Insert, the processing is performed as follows: •

If the Extract File contains only one row with a particular primary key value, only one destination row is updated. When multiple rows with the same primary key are present in the destination table, it is indeterminate which of the existing rows will be updated.



If the Extract File contains multiple rows with the same primary key, a different destination row is updated with each row in the Extract File. That is, a single destination row is updated once although it is indeterminate which row is updated with a specific row from the Extract File. When the Extract File contains more rows with the non-unique primary key than are present in the destination table, the additional rows are inserted.

When Insert or Update/Insert should be used is determined by the results you want to obtain. Use Insert to insert only new rows and Update/Insert to insert new rows and update existing rows. You can also request that the rows in the destination table are deleted prior to performing an Insert. This enables you to recreate the original set of test data exactly.

338

Move for DB2

5.4 Insert Process Insert Parameters Panel

When you select Option 2 or 3 from the INSERT Process menu, the following panel is displayed to prompt for the parameters needed to perform the Insert Process. (Note, most of the information required for Option 2 and 3 is the same. Only Insert enables you to delete rows at the destination prior to performing the insert and the title on the panel is different to reflect whether an Insert or an Update/Insert process 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 If YES, Commit Frequency ===> T Age Date Values Lock Tables During Process Commit Every Nth Row Limit Number of Discarded Rows Review Propagation Key Sets Run Process in Batch or Online If Batch, Review or Save JCL

===> ===> ===> ===> ===> ===> ===>

(Y-Yes, N-No) (T-After Each Table, E-At End)

N (Y-Yes, N-No) N (Y-Yes, N-No) ____ (1-1000, Blank-Site Limit) _______(1-999999, Blank-No Limit) A (A-Always, E-Errors) O (B-Batch, O-Online) (N-No, R-Review, S-Save)

Figure 175. Specify INSERT Parameters and Execute Panel Fields

User Manual

The fields on this panel include: Extract File DSN

Name of the Extract File that contains the source data as specified on the INSERT Process menu. This value cannot be modified on this panel.

Control File DSN

Name of a sequential file that is to be used to accumulate information and statistics about the Insert Process as specified on the INSERT Process menu. This value cannot be modified on this panel.

Delete All Rows in Target Tables

Specify whether all rows in the destination tables are to be deleted prior to performing the Insert Process. By deleting the rows prior to the Insert, you can obtain a set of data that exactly matches the data in the Extract File. Specify: Y

Delete is performed.

N

Delete is not performed.

339

5. Data Migration If YES, Commit Frequency

Age Date Values

If rows are to be deleted, specify the frequency with which commit is performed during the delete as one of the following: T

Commit after deleting the rows from each table.

E

Commit after deleting the rows from all of the tables.

Specify whether date values are to be aged as part of this process. Specify: Y

Date values are to be aged. The Specify Aging Parameters panel is displayed. On this panel, specify aging values to be used. These values supplement the specifications for columns mapped with AGE and FUTURE_YEAR functions and are used, if requested, to age DATE and TIMESTAMP columns not explicit targets of an AGE or FUTURE_YEAR function. For any column mapped with FUTURE_YEAR(DEF) note that if you specify an explicit year for the aging value on the Specify Aging Parameters panel, only the year portion is applied to the column. If you specify values to age incrementally or semantically, the column is ignored.

N

Date values are not to be aged. The specifications for aging on the Column Maps included in the process are ignored.

Additional information about the Specify Aging Parameters panel is provided on page 342. Lock Tables During Process

340

Specify whether the entire table is to be locked during an Insert Process. Locking the table ensures that other database activity does not interfere with the Insert Process. It will, however, prevent other users from accessing the table.

Move for DB2

5.4 Insert Process If you specify YES, a commit is performed only when MOVE has completed processing a table. This is because a commit causes the table lock to be relinquished.

Commit Every Nth Row

Site management has the option to establish that tables are not to be locked during Insert. If so established, this option is set to NO and cannot be modified. Specify the frequency of commits. The commit points will affect the starting point in case of a RESTART. Frequent commits will keep page locks to a minimum. Specify: 1-999999

Absolute value to determine commit point.

Blank

Site limit.

Note, this option has no effect if the prompt for Lock Tables During Insert is YES. Then the commit is performed when the processing for a table is completed. The figure shows the distributed default value of 1000. The site-defined limit is displayed at your site to indicate the maximum value you may specify. Limit Number of Discarded Rows

Specify a limit to the number of rows that can be marked as discarded. If that limit is met, the process is terminated. You can use RESTART to begin the process at the termination point. Specify: 1-999999

Terminate the process when a maximum number of rows are discarded.

Blank

No limit.

To terminate the process if any rows are discarded, specify 1. Review Propagation Key Sets

User Manual

Specify whether the Propagate Key Set(s) panel is to be displayed before the Insert Process is performed. This option is only displayed when the PROP function has been specified in one or more Column Maps used by the Insert Process. Specify:

341

5. Data Migration

Run Process in Batch or Online

A

To always display the panel prior to performing the process.

E

To display the panel prior to performing the process only when the PROP specifications contain errors. Default.

Specify whether the Insert Process is to be run in batch or online. Specify: B

Batch

O

Online

If site management has established a maximum number of rows for online processing and this Insert Process request exceeds that limit, this option is set to Batch and cannot be modified. If Batch, Review or Save JCL

Available Commands

Specify whether JCL is reviewed prior to job submission. This is specified for batch execution only. Since the JCL is displayed in the ISPF editor, you can modify it for the current request and save it to submit later. Specify: N

Submit job, do not display or save the JCL.

R

Display the JCL for review prior to job submission.

S

Save the JCL. Prompts are provided for you to specify the name of a file in which 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 Specify Aging Parameters panel is displayed. The Specify Aging Parameters panel prompts for the values used to age date values. Date values are identified in Column Maps using the AGE function and the FUTURE_YEAR function. The values specified on the Specify Aging Parameters panel are used when explicit values are not defined with the function in the Column Map. All explicit values override any specifications on this panel. (For details about the AGE

342

Move for DB2

5.4 Insert Process and FUTURE_YEAR functions, see Section 4.3.7 Specifying Source for Destination Columns.) You have the option of applying these values to DB2-defined DATE and TIMESTAMP columns also.

-------------------------- Specify Aging Parameters --------------------------Command ===> Aging Specification Explicit Date Or INCREMENTAL, Years Months Weeks Days Business Rules Or TARGET DATING, Base Date Target Date Default Aging Rule Table Default Aging Rule Century Pivot Year Process Date Columns Report Invalid Dates Report Skipped Dates Output Rows w/ Invalid Dates Output Rows w/ Skipped Dates

===>

YYYY/MM/DD

===> ===> ===> ===> ===>

(-2500 to +1581) (-30000 to +30000) (-30000 to +30000) (-99999 to +99999) (0 to 30000)

===> ===>

YYYY/MM/DD (Default:Today) YYYY/MM/DD

===> ===> ===> ===> ===> ===> ===> ===>

(Default: PSAPRULE) (00 - 99) (A-All, U-User Defined) (Y-Yes, N-No) (Y-Yes, N-No) (Y-Yes, N-No) (Y-Yes, N-No)

Figure 176. Specifying Aging Parameters Panel Fields

The fields on this panel include:

EXPLICIT

Explicit Date

Specify an explicit date for aging. The date must be in the form YYYY/MM/DD or YYYY/DDD (a Julian date). The aging rule is applied to this date.

INCREMENTAL

Years

Adjust the date by a number of years. +nnnn -nnnn

Increment or decrement the value in the column by the year specified as a one to four digit value in the range -2500 to +1581. A plus sign or a minus sign preceding the value indicates whether the date is to be incremented or decremented. Increment is the default.

User Manual

343

5. Data Migration Months

Adjust the date by a number of months. +nnnnn -nnnnn

Increment or decrement the value in the column by the number of months specified as one to four digit number in the range -30000 to +30000. A plus sign or a minus sign preceding the value indicates whether the date is to 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 the column by the number of weeks specified as one to four digit number in the range -30000 to +30000. A plus sign or a minus sign preceding the value indicates whether the date is to 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 the column by a number of days specified as a one to four digit number in the range -99999 to +99999. A plus sign or a minus sign preceding the value indicates whether the date is to 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 a number of occurrences of the specified business rule date. This number is specified by a one to four digit value in the range 0 to 30000. Incrementing and decrementing is controlled by the rule.

For example, if the Aging Rule is specified as NEXTPAYDAY, the date is adjusted by the specified number of paydays. Therefore, a 4 in the field, adjusts the date to the fourth payday after the

344

Move for DB2

5.4 Insert Process date value in the column. You can specify either calendar units (years, months, weeks, and days) or business units, not both. TARGET DATING

Base Date

Specify an explicit date as the origination or starting date for calculating the aging amount. The date must be in the form YYYY/MM/DD or YYYY/DDD (a Julian date). If you leave the field blank, the current date, is assumed.

Target Date

Specify an explicit date as the target for calculating the aging amount. The date must be in the form YYYY/MM/DD or YYYY/DDD (a Julian date). The aging amount is determined by the difference between 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. If the value for year does exceed 3999, an error occurs when you attempt to age the data and you receive a message indicating the data cannot be aged. Other Parameters

Default Aging Rule Table

Specify the name of the aging rule table to be used. If blank, the site default aging rule table is used.

Default Aging Rule

Specify the default aging rule to be used for any date column not explicitly assigned an aging rule. This must be one of the values in the aging rule table or blank. To display a selection list of rules in the current table, specify an asterisk as the first or only character in the field. The selection list displays the name of the rule and a brief description. Use S to select a rule. (For details about aging rule tables, see the Relational Tools Installation and Administration Guide.) If this field is blank, an aging rule is not applied to any aged data that is not explicitly assigned a rule.

Century Pivot

User Manual

Indicates the year for determining which century to apply to two-digit year values. For example,

345

5. Data Migration Year

assume the value is 65. All two-digit years that are 65 or over are assumed to be in the 20th century (19xx); all two-digit years that are less than 65 are assumed to be in the 21st century (20xx). This information 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 an individual column, the Century Pivot Year value is ignored for that column.

Process Date Columns

Specify whether all date columns (those identified as dates by function or as a DB2 DATE or TIMESTAMP column) or only those identified by function are to be aged. Specify: A

All DATE and TIMESTAMP columns and the columns mapped to AGE and FUTURE_YEAR are aged.

U

Only columns mapped to AGE or FUTURE_YEAR are aged.

If a Column Map is not defined or FUTURE_YEAR or AGE is not specified on the selected Column Map, these date values apply only to DATE and TIMESTAMP columns, if you respond A to this prompt. Report Invalid Dates

Specifies whether details of the invalid dates encountered during the aging step of the process are listed in the process report.

Report Skipped Dates

Specifies whether details of the skipped dates encountered during the aging step of the process are listed in the process report. (Dates are skipped when they cannot be aged because the value is not a valid date but has special meaning to the application. For example, “000000” or “999999” are not valid dates but may be special indicators for the application. Other examples of skipped dates are those containing only spaces, hex zeroes, or hex ‘FF’. For a comprehensive list of values that are handled as skipped fields, see Appendix G.

Output Rows

346

Specifies whether the rows with invalid dates are

Move for DB2

5.4 Insert Process with Invalid Dates written to the destination database. Output Rows with Skipped Dates

Specifies whether the rows with skipped dates are written to the database. For a comprehensive list of values that are handled as skipped fields, see Appendix G.

When you have completed the aging parameter specifications, use END to proceed with the Insert Process. View PROP Specifications The Propagating Key Set(s) panel is displayed based on your specification to the prompt Review Propagation Key Sets. When you specify A to the prompt or E and errors are encountered, the panel is displayed. This panel groups the tables affected by a single PROP function together and identifies the table for which the PROP function is specified. The specifications for determining the value to propagate are also displayed. (For details on specifying the PROP function on the Column Map, see page 246.) The following figure demonstrates: •

The literal “JONES” defined in the ORDERS table is to be propagated to the SALES and CUSTOMERS tables.



The value for the CUST_ID column in the CUSTOMERS table is to be assigned sequence numbers starting with 1 and incremented by 1. This value is then propagated to the ORDERS table.



The value in the ORDER_ID column of the ORDERS table is to be propagated to the DETAILS table. This ensures that MOVE does not insert child rows inappropriately. Note that if the propagated primary key value duplicates an existing value, that row is discarded. MOVE then discards the rows from related tables whose foreign key columns contain the propagated value. Therefore, if changing the CUST_ID in CUSTOMERS causes a duplicate row, the related ORDERS rows are discarded.

User Manual

347

5. Data Migration However, to ensure that the related DETAILS rows are also discarded, specify propagate for the ORDER_ID column used to related 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 PSTDEMO.CUSTOMERS PSTDEMO.ORDERS

SALESMAN_ID SALESMAN_ID *ORDER_SALESMAN

PSTDEMO.CUSTOMERS PSTDEMO.ORDERS

*CUST_ID CUST_ID

Set:2

'JONES' SEQ(1,1)

Set:3

PSTDEMO.ORDER *ORDER_ID ORDER_ID PSTDEMO.DETAILS ORDER_ID ******************************* Bottom of Data ********************************

Figure 177. Propagating Key Set(s) Panel Fields

The fields on this panel are: Set No

Number of the set of tables included in the propagation specification.

Table Name

Names of the tables affected by the propagation. These tables are listed from parent to child. In the figure, in Set 1, propagate is specified on a child table, ORDERS. In Set 2 and Set 3, it is specified on the parent, 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 is identified by an asterisk (*).

Column Map Specification

Specification in the Column Map of the value to be propagated.

If all the propagate specifications do not fit on the panel, you can scroll the display. Perform Process

Use END to perform the process.

Exit without Perform

To cancel the process request and return to the Specify INSERT Parameters and Execute panel, press PF12. It has been assigned this special use on this panel only. MOVE automatically restores your ISPF values when the Propagating Key Set(s) panel is exited.

348

Move for DB2

5.4 Insert Process Discarded Rows When MOVE is inserting data, rows may be discarded in two ways: Immediate discards During the Insert Process, a row is immediately discarded if a condition exists that cannot be rectified by MOVE. For example, the primary key value for the row already exists in the destination table. Pending discards A pending discard occurs when the row cannot be inserted at the present time, but the condition preventing the insert may not exist later in the Insert Process. These rows fail the Insert but are held in a pending status while processing continues. As the Insert request proceeds, MOVE will attempt to insert these pending rows one or more additional times. This occurs only when there are referential integrity cycles. An RI rule may prevent a row from being added because it references another row that is not present in a related table. For example, you may not be able to add an ORDERS row that contains a customer ID for a CUSTOMERS row that does not exist in the CUSTOMERS table. Later in the processing, the related CUSTOMERS row is added. When MOVE re-tries the insert on the pending ORDERS row, the insert completes successfully. It cannot be determined whether pending discards will be discarded until the end of the Insert Process. Therefore, there could be many more discarded rows than the discard limit. For example, assume the discard limit is 10. There are 5 immediate discards, but during the Insert there are 100 pending discards. If all of those pending discards are inserted sometime during the process, then the 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 limit but this cannot be determined until the process terminates. Commits during cycles

User Manual

Each time MOVE completes the Insert Process for a table, it issues a COMMIT statement. This occurs even when MOVE is processing a cycle and will return to a table later in the Insert Process. That means, table locks are held only during the time MOVE is processing a table. When processing switches to another table, the COMMIT

349

5. Data Migration causes the table lock to be relinquished. If that table is processed again, the lock is re-established. Prompt to Create Table

Before starting the Insert Process, MOVE checks for any UNKNOWN destination tables. If any destination tables are UNKNOWN, MOVE displays the CREATE Object List panel with a message indicating that the unknown tables must be created. All object definitions in the Extract File are included. Those object definitions that do not exist, are identified. Assume three tables and their primary keys, relationships, and indexes are included in the Extract File. Also assume that the ORDERS table is UNKNOWN at the destination and the other two tables exist. The following panel is displayed:

----------------------------- CREATE Object List ------ CREATE MISSING TABLES Command ===> 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 Destination Tables The UNKNOWN table and its subordinate objects are identified by the SELECT status. (For this example, it is the first table listed in the figure.) The tables and other objects that exist at the destination are identified 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 specify values, MOVE will use default values if they have been established. If a default is not specified for the database name and you do not supply a value, MOVE will prompt for a database name. If a default is not specified for the table space name and you do not supply a value, the table space name is automatically generated based on the table name.

350

Move for DB2

5.4 Insert Process Establish Defaults

You can establish default values for the database name and the table space name using Option 5 Create Process on the Data Migration menu or use the DEFAULTS command. Either displays a menu from which you select the defaults you want to establish. See Section 5.7 Create Process for more information on specifying defaults.

Select Objects

You can select and unselect individual objects using the Select line command, S, and the Unselect line command, U. Any unselected object definitions are assigned the status UNSEL and are not included when the SQL to create the objects is generated by MOVE. You can scroll the list using the UP, DOWN, TOP, and BOTTOM commands.

Create Objects

You can use the CREATE ALL command to direct MOVE to generate and execute the SQL DDL statements necessary to create the table and other objects that have the SELECT status. Alternatively, you can use the CR line command to create selected objects individually or the CRA line command to create a table and the objects related to it.

Review SQL

You can display the generated SQL statements prior to execution by specifying Yes to the prompt Review SQL. (This prompt is provided after the last object on the list.) The SQL statements are displayed in the ISPF editor and may be saved or edited as desired. The SQL is executed when you use END. Use CANCEL to abandon executing the SQL.

Details about Creating Objects

For more information on the CREATE Object List panel, see Section 5.7.4 Perform Create Process on page 406. This panel is also displayed when you explicitly request the PERFORM option of the Create Process and the details of this panel are discussed in that section.

Inserting Data

If the missing tables are successfully created, the Insert Process proceeds to load the data after the SQL is executed. (If objects are not created, the Insert Process cannot proceed and a message is displayed. If you do not want to create the missing tables, you can remove their names from the Destination Table Name field on the INSERT Process Table Map panel.)

User Manual

351

5. Data Migration Online Execution

If the Insert Process is executed online, a panel is displayed noting the progress 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 total number of rows to be inserted is displayed. Also, the name of the currently processing table and total rows that have been inserted for that table are displayed. This is revised: Every 1000 rows for each table to display the current total number of processed rows. When the processing for a table is complete and the processing for the next table begins. Batch Execution

If you specify batch execution, MOVE builds the necessary JCL. The JOB card information is taken from the JCL specified on the Job Card and Print Options panel. If you specified YES to the Prompt for Changes Before Job Submission prompt on the Job Card and Print Options panel, the default Job card, as specified on that panel, is displayed prior to job submission. You may edit the Job card and print options and specify whether your changes are to apply only to the current job submission or 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 Insert parameters, to build the JCL required to perform the Insert Process. If you specify Review to If Batch, Review or Save JCL on the Specify INSERT Parameters and Execute panel, the entire JCL is displayed in the ISPF editor. This JCL can be edited and saved. If you have responded Save to If Batch, Review or Save JCL, you are prompted for the name of the file in which to save the JCL and

352

Move for DB2

5.4 Insert Process whether the job should be submitted after saving the JCL. (Details are discussed later in this section.) END is used to return from the ISPF editor to MOVE, however your specification for the prompt, Submit Jobs with END on the User Options panel, determines whether the job is automatically submitted. If you specify NO to the prompt, you must submit the job explicitly from the ISPF editor using the SUBMIT command. If you specify YES, the job is automatically submitted. Use the CANCEL command to return to the Specify INSERT Parameters and Execute panel without submitting the job. You can modify the specifications or cancel the insert request from this panel. (See Section 6.1 User Options, for information on establishing whether jobs are automatically submitted when END is used.) If you submit the job and an error is encountered in the Job Card, a message is displayed. You can review the Job Card and correct the error or terminate the Insert Process. Batch Overrides

If you save the JCL generated by MOVE to a data set, you can SUBMIT the job directly from the ISPF editor instead of from within a MOVE session. When you do so, you can override the default destination Creator ID defined in the Table Map used for the Insert Process. This is especially convenient when you want to apply different Extract Files to a single set of tables or a single Extract File to multiple sets of tables using common Insert Process JCL. Any Extract File can be used in an Insert Process as long as at least one of the table names on the file matches one of the table names on the Table Map. The Creator IDs do not have to match. If any table does not match on the Table Map, it is not included in the process. You include the overrides by inserting the DD name PSDFOVRD in the JCL followed by the overrides.

Creator ID

To override the default destination Creator ID specified on the Table Map specify: DEFCID cid where cid is the default Creator ID to be used. This applies only to destination tables that are not explicitly qualified in the Table Map. Only one DEFCID parameter may be specified for an Insert Process.

Year

To override the year processing criteria defined for the Insert Process specify: YEAR year [A|S ]

User Manual

353

5. Data Migration year

The value to be inserted into the year portion of DATE and TIMESTAMP columns. Specify:

A|S

nnnn

Four-digit absolute numeric value.

+nnn

Value in the range of 1 through 999 to increment the year value.

-nnn

Value in the range of 1 through 999 to decrement the year value.

0

Ignore date processing parameters for the current Insert Process.

Specifies whether all columns or only columns identified in a Column Map are affected. A

All DATE and TIMESTAMP columns not specifically mapped in a Column Map are affected.

S

Columns mapped to the FUTURE_YEAR(DEF) function are affected. (If a value has not been specified, S is the default.)

With release 3.0, the YEAR override is being replaced with a set of powerful data aging overrides. However, it is included to ensure upward compatibility with previous releases. Although YEAR is currently supported for Extract Files created with release 2.5, it is not supported for Extract Files created with release 3.0 and greater. To override the date value, check the overrides provided for date aging. Date Aging

354

To override the date aging specifications for the Insert Process specify one or more of the following: AGE_AMT_YEAR

For incremental aging, the amount to increment by years.

AGE_AMT_MONTH

For incremental aging, the amount to increment by months.

AGE_AMT_WEEK

For incremental aging, the amount to increment by weeks.

AGE_AMT_DAY

For incremental aging, the amount to increment by days.

Move for DB2

5.4 Insert Process About AGE Parameters

The value must be numeric. Specify whether the value increments (+) or decrements (-). Increment is the default. For example, +15 or 15 increments the dates and -15 decrements the dates. The combination of AGE_AMT parameters specifies the aging. •

To specify an explicit date, specify a value for YEAR that is greater than or equal to 1582. Then, values must be specified for MONTH and DAY to define an explicit date. (A value for WEEK is invalid for an explicit date.)



To specify a date other than an explicit date, you can specify values for any or all of the units. The valid ranges for the values are: YEAR MONTH WEEK DAY

-2500 to +1581 -30000 to +30000 -30000 to +30000 -99999 to +99999

AGE_AMT_RULE

For incremental aging, the amount of occurrences of an aging rule to increment. For example, assume the specified rule is NEXTPAYDAY, specify 4 to age to the fourth payday from the current date in the column.

AGE_BASE_DATE

Specify a base date used by MOVE to determine the difference between this value and the AGE_TARGET_DATE. The difference is used as the number of days to age the data. This must be specified in the format: yyyy/mm/dd

or

yyyy/ddd

The current date is the default. AGE_TARGET_DATE

User Manual

Specify the target date used by MOVE to determine the difference between this value and the AGE_BASE_DATE. The difference is used as the number of days to

355

5. Data Migration age the data. This must be specified in the format: yyyy/mm/dd

or

yyyy/ddd

This is required if AGE_BASE_DATE is specified. TABLE

Specifies the name of the aging rule table to be used. Specify the name of a valid partitioned data set member.

AGE_RULE

Specifies the default aging rule to be used for any date field not explicitly assigned an aging rule. Specify any of the values in the aging rule table specified for the TABLE statement. (For more information about the aging rule table, see the Relational Tools Installation and Administration Guide.) If not specified, no aging rule is applied.

PIVOT_YEAR

Indicates which century to apply to twodigit year values. This information is used for aging rules and to provide the century in the output if so formatted. Specify a two-digit value from 00 through 99. This value determines the threshold. If not specified, a pivot year is not used. For example, assume the value is 65. All two-digit years 65 or over are assumed to be in the 20th century (19xx); all two-digit years that are less than 65 are assumed to be in the 21st century (20xx).

LIST_INVALID

Specifies whether details of the invalid dates encountered during the aging are listed at the top of the process report. Specify Y to list the details or N to not list them. The default is Y.

LIST_SKIPPED

356

Specifies whether details of the skipped dates encountered during the aging are listed at the top of the process report. (Dates are skipped when the date cannot be aged because the value is not a valid date

Move for DB2

5.4 Insert Process but has special meaning to the application. For example, “000000” or “999999” are not valid dates but may be special indicators for the application. Other examples of skipped fields are those containing only spaces, hex zeroes, or hex ‘FF’. Specify Y to list the details or N to not list them. The default is Y. PUT_INVALID

Specifies whether the rows with invalid dates are written to the database. Specify Y to write the rows or N to not write them. The default is Y.

PUT_SKIPPED

Specifies whether the rows with skipped dates are written to the database. Specify Y to write the records or N to not write them. The default is Y.

PROCESS_DATE_COLUMNS

UNKNOWN

Specifies whether date columns not explicitly mapped are to be aged.

To ignore any tables referred to in the Table Map that do not exist when performing the Insert Process, specify: UNKNOWN

{ FAIL | ALLOW }

FAIL

Terminate the insert if any tables or relationships named in the Extract Process are unknown. The report will contain a message listing the first unknown object. This is the default.

ALLOW

Bypass the unknown tables and relationships and continue with the Insert Process. The report will contain a message listing the unknown objects.

UNKNOWN ALLOW is most frequently used when you override the default Creator ID with DEFCID. Changing the default Creator ID may result in naming destination tables that do not exist. The UNKNOWN ALLOW parameter enables you to direct the Insert Process to skip these “unknown” tables. Store Overrides

User Manual

You can store these parameters in a sequential file or a partitioned data set rather than specify it directly in the jobstream. However, these parameters must be the only data in the file. (You cannot use the same file used for a batch Extract Process if selection criteria,

357

5. Data Migration SQL WHERE Clause, or Group Selection Processing parameters are also included. Also you cannot use this file for an Extract Process if the YEAR parameter is included.) Save JCL You can save the JCL, modify it and execute the process without reinvoking MOVE. Specify S to the prompt, If Batch, Review or Save JCL 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 Panel Fields

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 partitioned data set. If you specify a partitioned data set, specify the member in the field provided for the Member prompt.

Member (if PDS)

Name of the member in the partitioned data set specified for the DSN prompt. If a sequential file is specified and you specify a member name, an error message displays.

Submit JCL or Review

Specify whether the JCL is saved, saved and submitted, or displayed for review. If you select Submit, the JCL is saved and the job is submitted. If you select to review the JCL, use ISPF facilities to save or submit. If you select Neither, the JCL is saved, but not submitted or displayed for review.

358

Move for DB2

5.4 Insert Process Specify whether the generated JCL replaces existing data in the specified file.

Replace Existing Data

5.4.4 Insert Process Report When the Insert Process completes, it generates a report documenting the activity of the process. The contents of the INSERT Process Report can be browsed. When the process is executed online, the INSERT Process Report is automatically displayed. Standard ISPF scrolling functions are available. In batch, the report is placed in the default output as specified in the JCL. You can then display the report as you would the output from any job. Report Contents

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 Control File User ID Time Started Time Finished

: : : : :

PSTDEMO.SAMPLE.EXTRACT.FILE.DSN PSTDEMO.SAMPLE.CONTROL.FILE.DSN COHEND 01-15-98 09.52.33 01-15-98 09.52.42

Totals: Number of Insert Tables Number of Inserted Rows Number of Failed Rows

1 2 3 4

: 4 : 3972 : 104

Inserted Insert Tables Rows ------------------------- --------PSTDEMO.CUSTOMERS 132 PSTDEMO.ORDERS 792 PSTDEMO.DETAILS 2176 PSTDEMO.ITEMS 872

Failed Rows ------5 23 76 0

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

Figure 181. Insert Process Report Format Report Format

User Manual

The title indicates whether Insert or Update/Insert was performed. The report format includes headings to identify the information. This information includes the Extract File name, the Control File name, the user requesting the insert, the date and time of the insert, the number of tables in the insert, the number of successfully inserted rows, and the number of discarded rows.

359

5. Data Migration The sequence in which the tables are listed is the order in which these tables were found in the Extract File. The number of successful and unsuccessful rows is provided on a table-by-table basis. The UPDATE/INSERT Process Report also includes the total number of updated rows and the number of rows updated in each destination table. Aging Information

If aging parameters have been specified for the process, the report also includes: •

Any exception conditions encountered for each table. (This is included only when you specify Yes to Report Skipped Dates and Report Invalid Dates.) The following is a sample list of exception conditions 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 after the summary information. For example, the following lists specifications for an Insert Process that uses many of the defaults. Processing Parameters: Default Aging Amount: Default Aging Table: Default Aging Rule: Century Pivot Year: Process Date Columns: Report Invalid Dates: Report Skipped Dates: Output Rows With Invalid Dates: Output Rows With Skipped Dates:



=’2000/01/31’ PSAPRULE NEXTWORKDAY 65 Y YES YES YES YES

The aging results for each table include the information as specified on the Specify Aging Parameters panel. The information includes: Destination Column/Source Column names Number of valid dates Number of invalid dates Number of skipped dates Minimum value encountered Maximum value encountered Date format Aging Rule applied to column Rule Table containing Aging Rule applied to column Aging Amount applied to column Pivot year specifications for column (The format for DB2 DATE and TIMESTAMP columns is displayed as DB2 DATE and DB2 TMSTAMP.)

360

Move for DB2

5.4 Insert Process Print Report

User Manual

While browsing, you can use the OUTPUT command to direct the contents of the report to an output file or the printer. A panel is displayed prompting for the necessary information based on the specified output destination. (For details on the OUTPUT command, see the Relational Tools Command Reference Manual.)

361

5. Data Migration

5.5 DB2 Load Process The DB2 Load Process is used to transform the contents of an Extract File to DB2 Load utility format and execute a DB2 Load utility. The Load utility can be from IBM or from another software vendor. Those sites using BMC’s LOADPLUS can be presented with a set of panels specific to LOADPLUS. (These are discussed beginning on page 371.) The Load utility functionally can be used in place of MOVE's Insert Process. This may be desirable when: •

The number of rows to be inserted is so large that the speed of the Load utility offsets the advantages of the Insert Process.



The data contains RI cycles that make it impossible for the Insert Process to successfully insert all of the data.



The site-defined Maximum Insert Rows limit is less than the number of rows in the Extract File.



You want to insert data without DB2 logging. The DB2 Load Process prompts for you to specify whether the logging is performed. (If you disable logging, the loaded tables are put into Copy-Pending status. You may request execution of the DB2 COPY utility or the DB2 REPAIR utility to resolve this.)

The DB2 Load utility and the LOAD phase of LOADPLUS require exclusive control of the database. When using MOVE's Insert Process, the database is available to all users. Many of the facilities of the Insert Process are available when using a Load utility. Table Maps can be used to specify different Creator IDs and table names for the destination. Column Maps can be used to specify different column names and to transform data. The Load utility does not provide for Update/Insert processing. It only performs Insert Processing. Also, it cannot be performed online. Sorting

362

Generally, the rows in the Extract File are loaded into the database in the order in which they are processed. However, when using the DB2 Load utility, if a cluster index has been defined for the table, the rows will be sorted based on that index before being loaded. When using LOADPLUS, sort options are available and you may select the appropriate one when defining the parameters for the load.

Move for DB2

5.5 DB2 Load Process DB2 LOAD Menu

The following panel is displayed when Option 3 is selected from the Data Migration menu and DB2 LOAD is to be used. The text on the panel will reflect whether IBM’s DB2 Load Utility or BMC’s LOADPLUS is to be used. The default load utility is specified as a site option. A user option enables you to override this. (For more information, see Section 6. Specify Options.) As distributed, IBM’s DB2 Load utility is the default and, therefore displayed in the figure.

------------------------------ DB2 LOAD Process -------------------------OPTION ===> 1 2

TABLE MAP PERFORM

- Specify Table Map and Column Maps - 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 source table in the Load Process. By default, MOVE assumes that the destination base table names are the same as the source table names defined in the Extract File. However, you must specify a default destination creator ID using this option. When you specify a Table Map, you may also specify Column Maps for one or more of the destination tables. These maps allow you to specify on a column-by-column basis the source data for each destination column. For more information about specifying Table Maps, see Section 4.4 Table Maps, and for Column Maps see Section 4.3 Column Maps. Note that only table names are valid when specifying Table Maps for the Load Process. Views, synonyms, and aliases are not acceptable. (This is a DB2 restriction.)

2 PERFORM

User Manual

Specify the parameters for the Load Process and perform.

363

5. Data Migration Prior to selecting Option 1 or 2, specify: Extract File DSN

The name of the Extract File containing the source data to be transformed into DB2 load file format. This file must exist, must be a sequential data set, and must contain extract data.

Control File DSN

The name of the Control File that is to be used to accumulate information and statistics about the transformation of the Extract File to the DB2 load file format. The Control File keeps track of the rows that are discarded due to column mapping problems during the transformation process. If the named file exists, the DB2 Load Process will overlay any previous data. If the named file does not exist, you are prompted for allocation information and the file is created by MOVE for you. (See Appendix B. Allocating External Files for details on file allocation.)

Explicit Names

To specify the name of an Extract File or a Control File explicitly, use quotes to delimit the desired name; otherwise, it is prefixed based on the user option chosen.

Selection List

You can obtain a selection list of Extract Files or Control Files using the wild card characters * or % as the last character when specifying the name. A sample of the selection list displayed for Extract File or Control File data set names is provided in Figure 165. Select Extract Data Set on page 311. If only one file matches the selection criteria, it is automatically assumed to be the selected name and a selection list is not provided.

Perform the Load

364

Select Option 2 PERFORM to specify the parameters and perform the process. Either the Specify DB2 LOAD Parameters and Execute panel or the Specify LOADPLUS Parameters and Execute panel is displayed based upon which load utility is being used.

Move for DB2

5.5 DB2 Load Process

5.5.1 DB2 Load Utility Parameters The following panel is displayed when IBM’s DB2 Load Utility is to be used:

----------------- Specify DB2 LOAD Parameters and Execute ----------------Command ==> Extract File DSN: Control File DSN:

Z13600MP.PST.XFILE Z13600MP.PST.CFILE

Delete All Rows in Tablespace (REPLACE) ===> If NO, Can Tablespace have Rows (RESUME ===> Perform Logging During Load ===> If NO, Reset Copy Pending (REPAIR) ===> Enforce RI Constraints During Load ===> Create Full Image Copy after Load ===> If YES, Number of Local Copies (COPYDDN)===> Number of Remote Copies (RECOVERYDDN)===> Invoke RUNSTATS after Load is Completed ===> Age Date Values ===> Sort rows on Cluster Index (if it exists) ===> Allow Restart on (Keep SYS* Work DSNs) ===> Stop if there are 'N' Discards Review Propagation Key Sets Review or Save JCL Before Job Submission

N Y Y Y N N 1 0 N N Y W

===> ===> A ===> N

(Y-Yes, N-No) (Y-Yes, N-No) (Y-Yes, N-No) (Y-Yes, N-No) (Y-Yes, N-No) (Y-Yes, N-No) (0, 1, 2) (0, 1, 2) (Y-Yes, N-No) (Y-Yes, N-No) (Y-Yes, N-No) (W-Warnings, E-Errors, N-Never) (1-2147483647, Blank-No Limit) (A-Always, E-Errors) (N-No, R-Review, S-Save)

Figure 183. Specify DB2 LOAD Parameters and Execute The default values are shown in this figure. Panel Fields

The fields on the panel are provided to enable users to supply several parameters for the LOAD DATA statement generated by MOVE and to specify whether the DB2 REPAIR, COPY, or RUNSTATS utilities are to be executed after the LOAD.

RESUME

The combination of the following two prompts determine the RESUME parameter of the LOAD DATA statement. Delete All Rows in Tablespace

User Manual

Specify whether or not all rows in the table space are to be deleted. Specify: Y

All rows are to be deleted. The REPLACE clause is included on the LOAD DATA statement.

N

All rows are not to be deleted. The RESUME YES or RESUME NO clause is included based on response to the next prompt.

365

5. Data Migration If NO, Can Tablespace have Rows

LOG

REPAIR

Perform Logging During Load

If NO, Reset Copy Pending

Specify whether the table space must be empty for the process to be performed. This is only relevant if the Delete All Rows in Tablespace prompt is NO. Y

Table space can have rows. The RESUME YES clause is included on the LOAD DATA statement.

N

An empty table space is required. The RESUME NO clause is included.

Specify whether logging is performed during the load. Y

Logging is performed during the load. The LOG YES clause is included on the LOAD DATA statement.

N

Logging is not performed during the load. The LOG NO clause is included. If NO is specified, the table space is placed in Copy Pending status. Consider specifying YES to the prompt for reset copy pending or to the prompt for a full image copy.

Specify whether the DB2 REPAIR utility is to be executed after the Load is performed. This is only relevant if Perform Logging is NO. Use this to reset the Copy Pending status that occurs when LOG NO is specified. Y

REPAIR is invoked and the Copy Pending is reset.

N

REPAIR is not invoked.

The REPAIR utility will reset the COPY PENDING flag without establishing a recoverable set of data. Since the Create Full Image Copy option resets the flag and establishes a recoverable set of data, it takes precedence over this option if both are set to YES. That is, if both are selected, the COPY Utility is performed and the

366

Move for DB2

5.5 DB2 Load Process REPAIR Utility is not. ENFORCE

Enforce RI Constraints During Load

Specify whether Referential Integrity constraints should be enforced during the load. Y

Any invalid row that is encountered during the load is discarded. The ENFORCE YES clause is included on the LOAD DATA statement.

N

The ENFORCE NO clause is included on the LOAD DATA statement. This may be desirable if RI cycles are involved because this may be the only way to insert all of the data. Referential Integrity rules are not checked on a row by row basis. Instead, the checks are suspended and the table is left in 'Check Pending' status. (For more information about the 'Check Pending' status see the discussion on page 379.)

COPY

Create Full Image Copy after Load

Specify whether the DB2 COPY Utility is executed after the Load. Use this to establish a recoverable data set and reset the Copy Pending status that occurs when LOG is NO. Y

COPY is invoked and the Copy Pending is reset.

N

COPY is not invoked.

Since the Create Full Image Copy option establishes a recoverable data set, it takes precedence over the option to Reset Pending Copy if both are set to YES.

User Manual

367

5. Data Migration COPYDDN

If YES, Number of Local Copies

Specify the number of local copies to be created by the COPY utility: 0

Local copies are not created.

1

The primary local copy is created.

2

The primary and back up local copies are created.

If Create Full Image Copy after Load is NO, this is ignored. RECOVERYDDN

Number of Remote Copies

Specify the number of remote copies to be created by the COPY utility: 0

Remote copies are not created.

1

The primary remote copy is created.

2

The primary and back up remote copies are created.

If Create Full Image Copy after Load is NO, this is ignored. RUNSTATS

Invoke RUNSTATS after Load is Completed

Age Date Values

Specify whether RUNSTATS is to be invoked after LOAD to ensure that the statistical data required by the DB2 Optimizer is accurately updated. RUNSTATS is invoked at the table space level and includes all tables and indexes in the table space. Y

RUNSTATS is invoked.

N

RUNSTATS is not invoked.

Specify whether date values are to be aged as part of this process. Specify: Y

368

Date values are to be aged. The Specify Aging Parameters panel is displayed. On this panel, specify aging values to be used. These values supplement the specifications for columns mapped with AGE and FUTURE_YEAR functions and are used, if requested, to age DATE and

Move for DB2

5.5 DB2 Load Process TIMESTAMP columns not explicit targets of an AGE or FUTURE_YEAR function. N

Date values are not to be aged. The specifications for aging on the Column Maps included in the process are ignored.

Additional information about the Specify Modification Type and Value panel is provided on page 342. Sort Rows on Cluster Index (if it exists)

Allow Restart on (Keep SYS* Work DSNs)

Specify whether the data is to be sorted by the cluster index if one exists. Specify: Y

Sort data. Default.

N

Do not sort data.

Specify whether and which DB2 work files are retained to enable restartability on a specified level. Specify: W

Keep the files if warnings or errors are encountered. (The return code is 4 or greater.) Default.

E

Keep the files if errors are encountered. (The return code is 8 or greater.)

N

Always delete the files when the step completes.

Note that each tablespace comprises a separate job step and generates a set of work files. The specification for this prompt applies to each job step. Also, when warnings are encountered, processing continues, but, if an error is encountered, the job is terminated. The successful processing up to the step that generated the error is retained. You must run the load for the succeeding steps.

User Manual

369

5. Data Migration DISCARDS

Stop Load if there are 'N' Discards

Specify a maximum number of acceptable discarded rows. When that limit is reached, the load is terminated. Specify an integer from 1 through 2147483547. Specify 1 to terminate the load if any rows are discarded.

Review Propagation

Review Propagation Key Sets

Specify whether the Propagate Key Set(s) panel is to be displayed before the Load Process is performed. This option is only displayed when the PROP function has been specified in one or more Column Maps used by the Load Process. Specify: A

To always display the panel prior to performing the process.

E

To display the panel prior to performing the process only when the PROP specifications contain errors. Default.

For information about the Propagate Key Set(s) panel see page 347. JCL Review

370

Review or Save JCL Before Job Submission

Specify whether JCL is reviewed prior to job submission. This is specified for batch execution only. Since the JCL is displayed in the ISPF editor, you can modify it for the current request and save it to submit later. Specify: N

Submit job, do not display or save the JCL.

R

Display the JCL for review prior to job submission.

S

Save the JCL. Prompts are provided for you to specify the name of a file in which to store JCL.

Move for DB2

5.5 DB2 Load Process

5.5.2 LOADPLUS Utility Parameters The following panel is displayed when BMC’s LOADPLUS Utility is to 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) If NO, Can Tablespace have Rows (RESUME) If YES, Reallocate Datasets (REDEFINE) Reset Copy Pending (REPAIR) Create Full Image Copy during Load If YES, Number of Local Copies (COPYDDN) Number of Remote Copies (RECOVERYDDN) Invoke RUNSTATS after Load is Completed Age Date Values Check Data for Duplicate Rows Ignore Discarded Rows Stop Load if there are 'N' Discards Review Propagation Key Sets Review JCL or Save Before Job Submission

===> ===> ===> ===> ===> ===> ===> ===> ===> ===> ===>

N Y N Y N 1 0 B A A N

(Y-Yes, N-No) (Y-Yes, N-No) (Y-Yes, N-No) (Y-Yes, N-No) (Y-Yes, N-No) (1, 2) (0, 1, 2) (B-BMC, I-IBM, N-No) (Y-Yes, N-No) (Y-Yes, N-No) (A-All, D-Dups, V-Validproc, N-No) ===> __________ (1-2147483647, Blank-No Limit) ===> A (A-Always, E-Errors) ===> N (N-No, R-Review, S-Save)

Figure 184. Specify LOADPLUS Parameters and Execute The default values are shown in this figure. Panel Fields

The fields on the panel are provided to enable users to supply several parameters to determine which tasks are performed by LOADPLUS and to specify whether the DB2 REPAIR or RUNSTATS utilities are to be executed after the data is loaded by LOADPLUS.

RESUME

The combination of the following two prompts determine the RESUME parameter of the LOAD DATA statement. Delete All Rows in Tablespace

User Manual

Specify whether or not all rows in the Table Space are to be deleted. Specify: Y

All rows are to be deleted. The RESUME NO REPLACE clause is included on the LOAD DATA statement.

N

All rows are not to be deleted. Either the RESUME YES or the RESUME NO clause is included based on the next prompt.

371

5. Data Migration If NO, Can Tablespace have Rows

REDEFINE

REPAIR

If YES, Reallocate Datasets

Reset Copy Pending

Specify whether the table space must be empty for the process to be performed. This is only relevant if the Delete All Rows in Tablespace prompt is NO. Y

Table space can have rows. The RESUME YES clause is included on the LOAD DATA statement.

N

An empty table space is required. The RESUME NO clause is included.

Specify whether the table and index spaces are to be deleted and redefined when Delete All Rows in Tablespace is YES. Y

Table and index spaces are redefined. The REDEFINE YES clause is included with REPLACE on the LOAD DATA statement.

N

Table and index spaces are not redefined. The REDEFINE NO clause is included with REPLACE on the LOAD DATA statement.

Specifies whether the DB2 REPAIR utility is to be executed after the LOAD is performed. Y

REPAIR is invoked and the Copy Pending is reset.

N

REPAIR is not invoked.

The REPAIR utility will reset the COPY PENDING flag without establishing a recoverable set of data. LOADPLUS can be specified to establish a recoverable data set and reset the COPY PENDING flag while performing the load. This is requested by the Create Full Image Copy option that takes precedence when both options are set to YES.

372

Move for DB2

5.5 DB2 Load Process COPY

COPYDDN

Create Full Image Copy during Load

If YES, Number of Local Copies

Specify whether a full image copy is created. Use this to establish a recoverable data set and reset the Copy Pending status. Y

Copy Pending is reset.

N

Copy Pending is not reset.

Specify the number of local copies to be created: 1

The primary local copy is created.

2

The primary and back up local copies are created.

If Create Full Image Copy during Load is NO, this is ignored. RECOVERYDDN

Number of Remote Copies

Specify the number of remote copies to be created: 0

Remote copies are not created.

1

The primary remote copy is created.

2

The primary and back up remote copies are created.

If Create Full Image Copy during Load is NO, this is ignored. RUNSTATS

Invoke RUNSTATS after Load is Completed

Specify whether RUNSTATS is to be invoked after LOAD to ensure that the statistical data required by DB2 Optimizer is accurately updated. Specify: B

BMC’s UPDATEDB2STATS YES clause is included on the LOAD DATA statement, therefore statistics are gathered during the load.

I

IBM’s RUNSTATS utility is executed after the load.

N

RUNSTATS is not executed.

If IBM, RUNSTATS is invoked at the table space level and includes all tables and indexes

User Manual

373

5. Data Migration in the table space. Date Handling

Age Date Values

Specify whether date values are to be aged as part of this process. Specify: Y

Date values are to be aged. The Specify Aging Parameters panel is displayed. On this panel, specify aging values to be used. These values supplement the specifications for columns mapped with AGE and FUTURE_YEAR functions and are used, if requested, to age DATE and TIMESTAMP columns not explicit targets of an AGE or FUTURE_YEAR function.

N

Date values are not to be aged. The specifications for aging on the Column Maps are ignored.

Additional information about the Specify Aging Parameters panel is provided on page 342. UNIQUECHECK

DISCARDS IGNORE

Check Data for Duplicate Rows

Ignore Discarded Rows

Specify whether data is to be checked for duplicate rows. Y

All rows are to be checked. The UNIQUECHECK CLUSTER clause is included on the LOAD DATA statement.

N

The rows are not checked.

Specify which, if any, discarded rows are to be ignored. A

Ignore all discarded rows.

D

Ignore discarded duplicate rows.

V

Ignore rows discarded because of a validation procedure check.

N

Do not ignore discarded rows.

If A, D or V is specified, the DISCARDS IGNORE clause with an appropriate operand

374

Move for DB2

5.5 DB2 Load Process is specified on the LOAD DATA statement. DISCARDS integer

Stop Load if there are 'N' Discards

Specify a maximum value, from 1 through 2147478347, as the limit for the number of acceptable discarded rows. When that limit is reached, the load is terminated. Specify 1 to terminate the load if any rows are discarded. A discarded row is included in the count based on the specification for the Ignore Discarded Rows prompt.

Review Propagation

Review Propagation Key Sets

Specify whether the Propagate Key Set(s) panel is to be displayed before the process is performed. This option is only displayed when the PROP function has been specified in one or more Column Maps used by the process. Specify: A

To always display the panel prior to performing the process.

E

To display the panel prior to performing the process only when the PROP specifications contain errors. Default.

For information about the Propagate Key Set(s) panel see page 347. JCL Review

User Manual

Review or Save JCL Before Job Submission

Specify whether JCL is reviewed prior to job submission. This is specified for batch execution only. Since the JCL is displayed in the ISPF editor, you can modify it for the current request and save it to submit later. Specify: N

Submit job, do not display or save the JCL.

R

Display the JCL for review prior to job submission.

S

Save the JCL. Prompts are provided for you to specify the name of a file in which to store JCL.

375

5. Data Migration

5.5.3 Job Processing Once you have completed the appropriate panel, either DB2 Load Parameters or LOADPLUS Parameters, the job can be submitted. The JCL is generated from the specifications on the Job Card Options panel and the parameters panel. Additional jobsteps for the LOAD, CHECK, REPAIR, COPY and RUNSTATS utilities may also be generated. The DSNs for output and input files, for example, are generated, by default, based on the prefix option chosen on the User Options panel. No JCL Display

If you have not requested to view the JCL before Job submission and, on the User Options panel you have not requested that job card information should be displayed, press ENTER to submit the job.

Job Card Review

However, if you have specified YES to Review Job Card on the Job Card and Print Options panel, the job card information is displayed for your review. You may modify the Job Card information and specify whether these changes apply to the current request only or are to be permanent. Use END or ENTER to proceed to edit the JCL or perform the Load Process depending on the response to Review JCL Before Job Submission.

JCL Review

If Review or Save JCL Before JOB Submission on the current parameters panel is Review, the jobstream generated by MOVE is displayed in the ISPF editor. The jobstream can be edited and saved while displayed in the ISPF editor. The changes apply only for the current job and do not affect the specifications on the Job Card Options panel. You may save the JCL using ISPF facilities. Note that the COPY Utility requires unique data set names for each image copy defined in the COPYDDN and RECOVERYDDN statements.

376

Move for DB2

5.5 DB2 Load Process Save JCL

You can save the JCL, modify it and execute the process without reinvoking MOVE. Specify S to the prompt, If Batch, Review or Save JCL 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 Panel Fields

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 partitioned data set. If you specify a partitioned data set, specify the member in the field provided for the Member prompt.

Member (if PDS)

Name of the member in the partitioned data set specified for the DSN prompt. If a sequential file is specified and you specify a member name, an error message displays.

Submit JCL or Review?

Specify whether the JCL is saved, saved and submitted, or displayed for review. If you select Submit, the JCL is saved and the job is submitted. If you select to review the JCL, use ISPF facilities to save or submit. If you select Neither, the JCL is saved, but not submitted or displayed for review.

Replace Existing Data? Automatic SUBMIT

User Manual

Specify whether the generated JCL replaces existing data in the specified file.

END is used to return from the ISPF editor to MOVE, however your specification for the prompt, Submit Jobs with END on the User Options panel, determines whether the job is automatically submitted.

377

5. Data Migration If you specify NO to the prompt, you must submit the job explicitly from the ISPF editor using the SUBMIT command. When Submit Jobs with END is YES, use the CANCEL command to return to the Load Process panel without submitting the job. Controlling when the job is submitted is especially useful. You can prepare the job to be executed later. For example, to minimize contention you can prepare the LOAD job during the day and execute it overnight. Note LOADPLUS users can take advantage of the PRELOAD phase that does not prevent other users from accessing the database. PRELOAD does identify discarded rows based on the IGNORE and UNIQUE CHECK options. You can then decide whether or not to execute the LOAD phase based on the return code set by the PRELOAD phase. Job Steps

The job steps performed are as follows. Note that Step 1 is executed once, but Step 2 may be executed several times. Steps 3, 4, and 5 are optional and, if performed, are executed once. Step 1

Transform the Extract File to one or more Load Utility input files. During this operation, the Table Map and the Column Map are applied to the data. A Load Utility input file is needed for each table space. Based on the destination tables, MOVE will determine how many and which table spaces are affected.

Step 2

DB2 LOAD executes a Load Job Step for each table space. The number of times Step 2 is performed is equal to the number of table spaces involved in the load. If the load is successful, a job step is performed to delete the interim data sets. Whether this step is performed is determined by the return code from the Load Job Step. LOADPLUS executes the load step as two phasesPRELOAD and LOADfor each table space. First the PRELOAD is executed for each table space and processing can be paused. Then the LOAD phase is performed for each table space. If requested, the Copy function is performed as part of the LOAD phase.

378

Step 3

Execute the Check Utility for each table space in Check Pending status that is being loaded.

Step 4

Execute, if requested, the REPAIR Utility or the COPY Utility.

Move for DB2

5.5 DB2 Load Process Using either DB2 Load or LOADPLUS, the REPAIR Utility executes a single jobstep for all table spaces. Using DB2, the COPY Utility executes a single jobstep for all table spaces. Using LOADPLUS, the Copy Utility is executed, if requested, as part of the LOAD step and does not require a separate step. Step 5

Execute, if requested, the RUNSTATS utility. This executes a single jobstep for all table spaces.

If the number of jobsteps exceeds 256, Relational Tools automatically splits the request into multiple jobs. The jobs must be executed in the proper sequence to maintain the steps in the order generated by Relational Tools. To handle this, review the JCL and specify TYPERUN=HOLD to hold the job. Then manually submit the jobs in the correct order. Check Pending Status

A table space may be placed in Check Pending status when one or more of the following conditions occur: •

Enforce RI Constraints is set to NO. This indicates that data can be loaded into dependent tables without DB2 verifying that it meets RI constraints. Before the database can be used, DB2 must verify that RI rules have not been violated by the load. For example, proper parents must exist for all rows inserted into a child table.



Delete All Rows in the Table Space is set to YES. There are two possible scenarios: 1. If a parent table is involved in the load, any other tables spaces containing child tables are placed into check pending status. This is because all of the child rows initially become orphans and the load process may or may not replace all of the parent rows. 2. If a parent table is not involved in the load but is in a table space that is cleared, any other table spaces containing child tables are placed into check pending status. If any child table's table space is not involved in the load, MOVE will not generate a check data job for the dependent table space. To alert you to this potential problem, MOVE compares the number of tables to be loaded into the table space and the number of tables in the table space. When these numbers are different, MOVE displays a warning. You can terminate the load at this point or proceed. If you proceed, all of the rows

User Manual

379

5. Data Migration of the parent tables not involved in the load will be deleted and any child table rows will remain orphans. You may be deleting more data than you expected. Copy Pending Status

When the DB2 Load utility is executed with LOG NO, a COPY PENDING restriction is placed on the table space being loaded. This prevents updates to any table in the table space. It is intended to force the user to establish a point of recoverability for the data which the LOG NO option lost. MOVE provides two options for clearing the Copy Pending status and prompts for them on the Specify DB2 LOAD Parameters and Execute: 1. The DB2 REPAIR Utility. This is requested by the If NO, Reset Copy Pending prompt and will only be executed when LOG NO is specified. 2. The DB2 COPY Utility. This is requested by the Create Full Image Copy after Load prompt and can be executed when either LOG NO or LOG YES is specified. The COPY PENDING status may also occur when LOADPLUS is executed based on the site installation options. The DB2 REPAIR utility is requested by the Reset Copy Pending prompt and will only be executed if a Full Image Copy is not requested, however a Full Image Copy is created automatically during the PRELOAD phase.

DB2 REPAIR

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 the COPY PENDING restriction when loading data into a new table space or replacing all of the data in a table space. When used with LOAD REPLACE, the Extract File serves the purpose of a DB2 Full Image Copy. However, when used with LOAD RESUME YES, the database is non-recoverable.

DB2 COPY

The DB2 COPY Utility establishes recoverability by creating image copies of a table space. This is recommended when you are not replacing all of the data in a table space. Up to four image copies can be made: main and backup copies for both local and remote sites. The panel options for COPYDDN and RECOVERYDDN, as documented in the panel field descriptions, determine which copies are created.

RUNSTATS

380

The performance of Relational Tools and your applications programs is very dependent on the DB2 statistics, therefore it may be useful to Move for DB2

5.5 DB2 Load Process execute RUNSTATS to maintain optimum performance. However, if various statistics have been specifically modified (for example, to force the test system to accurately simulate the production environment), you may choose to bypass RUNSTATS. Process Complete

User Manual

After the LOAD is executed, you can browse the Control File to identify any rows that were discarded when transforming the Extract File to the DB2 load format. The Load utility produces a report that shows the errors encountered while loading the data.

381

5. Data Migration

5.6 Delete Process The Delete Process is used to delete the data extracted from the source database. You may use the Delete Process in combination with the Extract and Insert 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 rows that are to be deleted from the database. The Delete Process verifies that the rows in the source database are exactly the same as the rows in the Extract File before deleting those rows. Any rows that do not match exactly are not deleted. Select Option 4 DELETE on the Data Migration menu. The following 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 Commit Every Nth Row Limit Number of Discarded Rows Run Process in Batch or Online If Batch, Review or Save JCL

===> ===> ===> ===> ===>

(Y-Yes, N-No) (1-1000, Blank-Site Limit) (1-999999, Blank-No Limit) (B-Batch, O-Online) (N-No, R-Review, S-Save)

Figure 186. Specify DELETE Parameters and Execute Panel Fields

The fields on the panel are: Extract File DSN

Name of the Extract File that contains the source data. This file must exist and must be a sequential data set. You can obtain a selection list of Extract Files using either wild card character, * or %, as the last character in the name.

Control File DSN

Name of a sequential file to be used to accumulate information and statistics about the Delete Process. If the data set exists, MOVE overlays the

382

Move for DB2

5.6 Delete Process previous data. If the named file does not exist, you are prompted for the allocation information and the file is created. You can obtain a selection list of Control Files using either the wild card characters, * or %, as the last character in the name. Lock Tables During Process

Specify whether locks should be applied to the tables involved in the Delete Process. Locking the tables ensures that the other database activity does not interfere with the Delete Process. However, it will prevent other users from accessing the table. Specify: Y

Lock tables for the process.

N

Do not lock tables.

If site management has established that tables are not to be locked, this option is set to NO and cannot be modified. Commit Every Nth Row

Specify the frequency of commits. The commit points affect the starting point in case of a Restart. Frequent commits will keep page locks to a minimum. Specify: 1-999999

Commit each n deletes where n is a value from 1 through 999999 inclusive.

BLANK

Use site limit.

The value specified for Commit Every Nth Delete is not relevant if Lock Tables During Delete is YES. Then, the commit is performed as the processing for each table is completed. The figure shows the distributed default value of 1,000. At your site, the maximum value defined by site management is displayed. Limit Number of Discarded Rows

Specify a limit to the number of rows that can be marked as discarded. If that limit is met, the process is

User Manual

383

5. Data Migration terminated. You can use Restart to begin the process at the termination point. Specify: 1-999999

Maximum number of discards.

BLANK

No limit.

To terminate the process if any rows are discarded, specify 1. Run Process in Batch or Online

Specify whether execution of the Delete Process is performed in batch or online. Specify: B O

Batch Online

If site management has established a maximum number of rows for online processing and this request exceeds that limit, this option is forced to Batch and cannot be changed. Site management may have guidelines. If Batch, Review or Save JCL

Available Commands

N

Submit job, do not display or save the JCL.

R

Display the JCL for review prior to job submission.

S

Save the JCL. Prompts are provided for you to specify the name of a file in which to store JCL.

The available primary commands include: CANCEL

384

Specify whether JCL is reviewed prior to job submission. This is specified for batch execution only. Since the JCL is displayed in the ISPF editor, you can modify it for the current request and save it to submit later. Specify:

END

OPTIONS

Move for DB2

5.6 Delete Process Specification Complete

When you have completed your specifications, press ENTER and the Delete Process begins. If the process is executed online, a panel is displayed 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 total number of rows to be deleted is displayed. Also, the name of the currently processing table, total number of rows that have been deleted from that table, total number of rows that could not be found to be deleted from that table, and total number of rows that could not be deleted for that table are displayed. This is revised: •

Every 1000 rows for each table to display the current total number of processed rows.



When the processing for a table is complete and the processing for the next table begins.

Batch Execution If you specify batch execution, MOVE builds the necessary JCL. The JOB card information is taken from the JCL specified on the Job Card and Print Options panel. If you specified YES to Prompt for Changes Before Job Submission on the Job Card and Print Options panel, the job card is displayed prior to job submission. You may edit the job card and specify whether your changes are to apply only to the current job submission or are to be applied permanently. Then, the job card and the Delete parameters are used to build the JCL required to perform the Delete Process.

User Manual

385

5. Data Migration Review

If you specify Review to If Batch, Review or Save JCL on the Specify DELETE Parameters and Execute panel, the complete jobstream is displayed in the ISPF editor. You can edit and save the JCL. END is used to return from the ISPF editor to MOVE, however your specification for the prompt Submit Jobs with END on the User Options panel, determines whether the job is automatically submitted. If you specify NO to the prompt, you must submit the job explicitly form the ISPF editor using the SUBMIT command. If you specify YES, the job is automatically submitted when END is used. You can use CANCEL to return to the Specify DELETE Parameters and Execute panel without submitting the job. You can modify the specifications or cancel the insert request from this panel. (See Section 6.1 User Options, for information on establishing whether jobs are automatically submitted when END is used.)

Save

If you responded Save to If Batch, Review or Save JCL, you are prompted for the name of the file in which to save the JCL and whether the job should be submitted after saving the JCL. (Details are discussed on page 358.)

Job Card Error

If you submit the job and an error is encountered in the job card, a message is displayed. You can review the job card and correct the error or terminate the Delete Process.

Discarded Rows

Rows are discarded when an attempt to delete the row is unsuccessful. This can occur when RI rules prevent the row from being deleted. For example, a row is not deleted if this table has a Delete Restrict relationship to another table that still contains rows. This can only occur if that table was not part of the original Extract since MOVE will delete rows in the proper order. These discarded rows are noted in the Control File.

Important Note

If the Delete Process is being performed on rows for which the primary key is defined as non-unique in the Princeton Softech Directory, a row is deleted at the destination only when all of the data in all of the columns in the source row and destination row match. Therefore, each row in the Extract File containing an occurrence of the primary key, is compared to each potentially matching row. When a successful match is encountered the row is deleted and the Extract File row marked OK. If none of the destination rows match the Extract File row, a delete is not performed and the row is marked as NOT FOUND.

Cascade Delete

If you attempt to delete tables which are parents in a relationship defined with cascade delete, MOVE warns you that descendant rows

386

Move for DB2

5.6 Delete Process may be deleted regardless of whether those tables were selected for deleting. MOVE displays a pop-up to confirm the cascade delete. DELETE Process Report

A DELETE Process Report is generated as part of the process. This report contains information including various statistics about the execution of the process.

Display Report Contents

The contents of the DELETE Process Report can be browsed. When the process is executed online, the DELETE Process Report is automatically displayed. Standard ISPF scrolling functions are available. In batch, the report is placed in the default output as specified on the JCL. You can then display the report as you would the output from any job.

Report Contents

The DELETE Process Report is formatted as shown in the following figure.

---------------------------- DELETE Process Report ----------------------Command ===> Scroll ===> PAGE ROW 0 OF 18 ******************************** TOP OF DATA ***************************** DELETE Process Report Extract File Created by Control File Processed by Time Started Time Finished Totals: Number Number Number Number

1 2 3 4

: : : : : :

PSTDEMO.SAMPLE.EXTRACT.FILE.DSN Job COHEND, using SQLID COHEND on DB2 Subsystem DSNA PSTDEMO.SAMPLE.CONTROL.FILE.DSN Job COHEND, using SQLID COHEND on DB2 Subsystem DSNA 01-15-98 09.52.33 01-15-98 09.53.15

of Delete Tables of Deleted Rows of: Failed Rows of Rows not Found

: : : :

4 3972 0 0

Deleted Delete Tables Rows ------------------------- --------PSTDEMO.CUSTOMERS 132 PSTDEMO.ORDERS 792 PSTDEMO.DETAILS 2176 PSTDEMO.ITEMS 872

Failed Rows -------0 0 0 0

Not Found --------0 0 0 0

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

Figure 188. Delete Process Report Format Report Format

User Manual

The report format includes headings to identify the information. This includes the Extract File name, the Control File name, the user requesting the Delete, the date and time the process was executed, the number of tables in the delete, the number of successfully deleted rows, the number of discarded rows, and the number of rows not found.

387

5. Data Migration The sequence in which the tables are listed is the order in which these tables were specified in the Extract File. The number of successful and unsuccessful rows is provided on a table-by-table basis. If Row Updated

When MOVE deletes a row, the entire row is checked to ensure that it matches the row in the Extract File exactly. If another user has updated the row between the time the Extract Process was performed and the time the Delete Process is performed, that row is not deleted.

DB2 RI Rules

MOVE normally deletes rows from the child table before attempting to 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 previously deleted by DB2, these child rows are marked as NOT FOUND in the DELETE Process Report.

Print Report

While browsing the DELETE Process Report online, you can use the OUTPUT command to direct the contents of the report to an output file or SYSOUT. A panel is displayed prompting for the necessary information based on the specified output destination. (For details on the OUTPUT command, see the Relational Tools Command Reference Manual.)

388

Move for DB2

5.7 Create Process

5.7 Create Process The Create Process is used to migrate object definitions from one DB2 subsystem or database to another. The object definitions are extracted from the source using the Extract Process and stored in the Extract File. (MOVE supports object definitions created using DB2 releases up through and including 4.1.) The Create Process uses these extracted 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 DB2 Load processes to load data. These processes will create any destination tables that do not exist along with any other object definitions for these tables, such as primary keys and relationships, indexes, etc. that have been extracted. However, Insert and DB2 Load Processes do not automatically create any additional objects for existing destination tables. The Create Process must be used to create the 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, the following panel is displayed.

------------------------------- CREATE Process ---------------------------OPTION ===> 0

DEFAULTS

- Specify Object Creation Defaults

1 2

TABLE MAP PERFORM

- Specify Table Map - Specify Objects to Create and Perform CREATE

3 4 5

GRANT SYNONYMS OUTPUT

- Grant Table and View Authorizations - Create Additional Synonyms - Specify File for Output of SQL

Extract File DSN

===> 'Z13600MP.PSTND.XFILE'

Figure 189. CREATE Process Menu Panel Options

User Manual

The options on this panel include: 0 DEFAULTS

Specify default values to be used to create tables, tablespaces, and indexes. You can also specify default Creator IDs for views and aliases.

1 TABLE MAP

Specify the names of the destination tables for each source table in the Extract File. You must

389

5. Data Migration select this option to specify the Destination Creator ID. By default, MOVE assumes the base destination table names are the same as the names defined in the Extract File. There is no default Destination Creator ID. 2 PERFORM

Presents the CREATE Object List panel from which you select the object definitions to be created.

3 GRANT

Specify table and view authorizations. This option applies to existing tables and views, therefore it is selected after performing the create.

4 SYNONYMS

Specify additional synonyms for existing tables. This option applies to existing tables and views, therefore it is selected after performing the create.

5 OUTPUT

Specify the name of a file to contain the SQL generated by the Create request so that the SQL can be saved and reused. The stored SQL can also be edited directly.

Extract File DSN Specify the name of the Extract File containing the source object definitions. (The Extract File must be one created with Release 2.0 or later of MOVE.) You must be appropriately authorized to create any object definitions and to grant authority.

5.7.2 CREATE Process Defaults Before using MOVE to migrate object definitions, you may want to establish several default values. These defaults will then be used every time an object is created by the Create Process, the Insert Process, or the DB2 Load Process. If you do not specify default values, you will be prompted as necessary for these values whenever objects are to be created.

390

Move for DB2

5.7 Create Process When you select Option 0 Defaults from the CREATE Process menu, the following panel is displayed.

------------------------------ CREATE Defaults ---------------------------OPTION ===> 1 2 3 4

TABLE DEFAULTS TABLESPACE DEFAULTS INDEX DEFAULTS CREATOR ID DEFAULTS

-

Specify Specify Specify Specify

Default Default Default Default

Table Parameters Tablespace Parameters Index Parameters View and Alias Creator IDs

Figure 190. CREATE Defaults Menu Panel Options

The options on this panel include: 1 TABLE DEFAULTS

Specify default values for several parameters required to create tables.

2 TABLESPACE DEFAULTS

Specify default values for the creation of tablespaces.

3 INDEX DEFAULTS

Specify default values for the creation of indexes.

4 CREATOR ID DEFAULTS

Specify default values for the Creator IDs used when creating views and aliases.

Table Defaults Use Option 1 Table Defaults on the CREATE Defaults menu to specify default values for several parameters used when creating tables. You can specify values for any of the prompts on the following panel, but all values are optional. If the DATABASE NAME is omitted, it will be prompted for when a table is to be created. If you leave any other field blank, MOVE omits that parameter when generating the SQL. Therefore, the DB2 default is used when the object is created.

User Manual

391

5. Data Migration The specifications on the Table Defaults panel are profiled.

------------------------------ Table Defaults ---------------------------Command ===> DATABASE NAME ===> TABLESPACE NAME ===> EDITPROC VALIDPROC AUDIT OBID DATA CAPTURE

===> ===> ===> ===> ===>

* * *

(Pgm Name, *-Same as Source Table) (Pgm Name, *-Same as Source Table) (N-None, C-Changes, A-All, *-Same as Source) (0 – 32767) (N-None, C-Changes, *-Same as Source)

*

Figure 191. Table Defaults Panel Fields

The fields on this panel include: DATABASE NAME

Default name for the database in which a table is created, as displayed on the Create Object List panel. Specify a literal, use one or more keywords, or combine literal and keywords to generate a default database name that follows naming conventions for your site. Leave blank if a default database name is not desired. Note that you can modify a default database name displayed on the Create Object List. Keywords are:

Creator ID of the table.



Table name.

For example, for a default database name that begins with ARE, followed by the Creator ID of the user, specify ARC; for a default database name that begins with the Creator ID of the table, followed by the table name, specify . If a generated name exceeds the DB2, 8character requirement it is truncated on the right and a message is displayed. TABLESPACE NAME

392

Default name for the tablespace in which a table is created, as displayed on the Create Objects List panel. Specify a literal, use one or more keywords, or combine literal and keywords to generate a default tablespace name that follows naming conventions for your site. Leave blank if a no default tablespace name is

Move for DB2

5.7 Create Process desired. If you do not specify a default tablespace name, the default name is derived from the table name when the table is created. (The IN DATABASE clause is used.) Note you can modify a default tablespace name displayed on the Create Object List. Keywords are:

Database name for the table.



Creator ID of the table.



Table name.

For example, for a default tablespace name that begins with ARC, followed by the Creator ID of the user, specify ARC; for a default tablespace name that begins with the Creator ID of the table followed by the database name, specify . If a generated name exceeds the DB2, 8character requirement it is truncated on the right and a message displayed. EDITPROC

Specify the name of an edit procedure or exit routine that DB2 invokes when a row in the table is accessed. Specify: pgmname

Explicit name of the exit routine.

*

Name of the exit routine specified for the source table.

If the field is blank, an edit procedure is not specified. VALIDPROC

Specify the name of a validation procedure or exit routine DB2 invokes when a row in the table is updated. Specify: pgmname

Explicit name of the exit routine.

*

Name of the exit routine specified for the source table.

If the field is blank, a validation procedure is not specified.

User Manual

393

5. Data Migration AUDIT

Specify which table activity is to be audited. Specify: NONE

No auditing is performed.

CHANGES

Audit insert, update and delete operations.

ALL

Audit all table access.

*

The assignment specified for the source table determines whether the table activity is to be audited.

OBID

Specify the OBID to be used for the table.

DATA CAPTURE

Specify whether additional information is logged for SQL INSERT, UPDATE and DELETE operations. Specify: NONE

Data capture is not performed.

CHANGES

Write additional data about SQL updates to the log.

*

The assignment specified for the source table determines whether data capture is performed.

Tablespace Defaults Select Option 2 Tablespace Defaults on the CREATE Defaults menu to specify default values for several parameters used when creating a table space. Although MOVE does not extract object definitions for table spaces, a table space may need to be created based on specifications for the tables you explicitly want to create. On the following panel you can specify values for any of the prompts for default parameters for table spaces, but all values are optional. If you leave any field blank, MOVE omits that parameter when generating the SQL and the DB2 default values are used.

394

Move for DB2

5.7 Create Process The values on the Tablespace Defaults panel are profiled. For the initial display, the panel fields are blank. The following figure is displayed when Version 5 of DB2 is installed: --------------------------- Tablespace Defaults ----------------------------Command ===> USING STOGROUP

===>

or VCAT

===>

FREEPAGE PCTFREE SEGSIZE BUFFERPOOL LOCKSIZE CLOSE DSETPASS COMPRESS LOCKMAX CCSID LARGE NUMPARTS MAX ROWS

===> ===> ===> ===> ===> ===> ===> ===> ===> ===> ===> ===> ===>

PRIQTY ===> SECQTY ===> ERASE ===>

(Y-Yes, N-No)

(0-255) (0-99) (4, 8, 12, ... 64, Blank - Not Segmented) (BP0-49, BP32K, BP32K1-9) (A-Any, P-Page, TS-Tablespace, T-Table, R-Row) (Y-Yes, N-No) (Y-Yes, N-No) (0-2147483647 or SYSTEM) (E-EBCDIC or A-ASCII) (Y-Yes, N-No) (1-254) (1-255)

Figure 192. Tablespace Defaults Panel Fields

The fields on this panel include: USING STOGROUP

Name of the storage group. This specifies that DB2 will define and manage the data sets for the table space. If specified, you may also specify values for the following prompts: PRIQTY

Indicates the primary allocation for the data set as an integer value. The default value is based on the BUFFERPOOL specification. For 4K, PRIQTY must be between 12 and 4194304. For 32K, the minimum is 96. Minimums for DB2 version 6.1 and later are: 8K – 24 and 16K – 48.

SECQT

User Manual

Indicates the secondary allocation for the data set as an integer value. The default value must be greater than or equal to 0 and less than or equal to 4194304 for any BUFFERPOOL specification.

395

5. Data Migration ERASE

Specify whether the data sets in the table space are to be erased when they are deleted. Specify: YES NO

VCAT

Erase Do not erase.

Name of the identifier of the VSAM catalog where the data sets defined for the table space are catalog. This indicates that the table space is user-managed. You may specify a value for USING STOGROUP or a value for VCAT, not both.

FREEPAGE

Frequency with which a page of free space is left when the table space is loaded or reorganized. Specify: 0-255

Any integer in this range. The DB2 default is 0.

Specify 0 for no free pages, 1 for a free page after every page, 2 for a free page after every two pages, and so forth.

PCTFREE

If the table space is segmented, the number of pages left free must be less than the SEGSIZE value. Percentage of each page that is to be left as free space when the table space is loaded or reorganized. Specify: 0-99

SEGSIZE

396

Any integer in this range. The DB2 default is 5 meaning 5%.

Specify whether the table space is to be segmented. If an integer is specified, the table space is assumed to be segmented. Specify: 4-64

Any integer that is a multiple of 4 in this range. The value specifies the number of pages assigned to each segment.

Blank

Table space is not segmented.

Move for DB2

5.7 Create Process BUFFERPOOL

Name of the buffer pool used as the default for tablespaces. The panel shows the valid selections 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 of DB2 is installed, BP0-49, BP32K, and BP32K1-BP32K9 are valid. If version 2 is installed, BP0, BP1, BP2, BP32K are valid. The adjustment to the 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 can be specified for a segmented tablespace only.

R

Row is the locking level. (This locking level is available beginning with release 4.1 of DB2. It is not displayed if you are using an earlier release.)

CLOSE

Indicates whether data sets can be closed when not in use if the number of open data sets has reached the limit.

DSETPASS

Master level password. (For DB2 version 5.1 or earlier.)

COMPRESS

Specify whether or not data compression is performed. Specify: YES

Data is compressed when the LOAD or REORG utility is run on the table in the table space.

NO

Data is not compressed.

This prompt is only displayed for release 3 or greater of DB2. LOCKMAX

User Manual

Maximum number of locks that can be in effect simultaneously in the table space.

397

5. Data Migration Specify: 0

Unlimited number of locks.

1-2147483647

Explicit number of locks.

SYSTEM

System value is used.

This prompt is only displayed for release 4.1 or greater of DB2.

398

CCSID

Table is EBCDIC or ASCII data. (For DB2 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 version 5.0 or higher.)

MAX ROWS

Maximum number of rows per page. (For version 5.0 or higher.)

MEMBER CLUSTER

Clustering of inserted data. (For DB2 version 6.1 or later.) Y

Inserted data is clustered by the implicit or explicit clustering index.

N

DB2 chooses the location of data in the tablespace on the basis of variable space.

Move for DB2

5.7 Create Process

Index Defaults Select Option 3 Index Defaults on the CREATE Defaults menu to specify default values for several parameters used when creating indexes. You can specify default values for the parameters for indexes, but all values 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 *SOURCE Blank Other

USING STOGROUP

===>

PRIQTY ===> SECQTY ===> ERASE ===>

or VCAT

===>

FREEPAGE PCTFREE SUBPAGES BUFFERPOOL CLOSE DSETPASS DEFER INDEXTYPE

===> ===> ===> ===> ===> ===> ===> ===>

* * * * * * *

-

Same as Corresponding Table Same as Source Index's Creator ID Current SQLID Explicit Creator ID

(Y-Yes, N-No)

(0-255, * - Same as Source Index) (0-99, * - Same as Source) (1, 2, 4, 8, or 16, * - Same as Source) (BPO-49, * - Same as Source) (Y-Yes, N-No, * - Same as Source) (Explicit Value, * - Same as Source) (Y-Yes, N-No) (1 or 2, * - Same as Source)

Note: PRIQTY and SECQTY may be specified as Explicit Quantities or as a Percentage of Extracted Source Index, e.g. 25%.

Figure 193. Index Defaults Panel Fields

The fields on this panel include: INDEX CREATOR ID

User Manual

Creator ID to be used for the name of the index. Specify: *TABLE

Creator ID from the table for which the index is being created.

*SOURCE

Creator ID from the original source index.

Blank

Current user’s SQLID.

Other

An explicit Creator ID value is supplied.

399

5. Data Migration USING STOGROUP

VCAT

Name of the storage group. This specifies that DB2 will define and manage the data sets for the table space. If specified, you may also specify values for the following prompts: PRIQTY

Indicates the primary allocation for the data set as an integer value. PRIQTY must be between 12 and 4194304.

SECQTY

Indicates the secondary allocation for the data set as an integer value. The default value must be greater than or equal to 0 and less than or equal to 4194304.

ERASE

Specify whether the data sets in the table space are to be erased when they are deleted. Specify: YES

Erase.

NO

Do not erase.

Identifier of the VSAM catalog where the data sets defined for the table space are cataloged. This indicates that the table space is user-managed. You may specify a value for USING STOGROUP or for VCAT, not both.

FREEPAGE

Frequency with which a page of free space is left when the table space is loaded or reorganized. Specify: 0-255

An integer in this range. The default is 0.

*

The value assigned to the source index is to be used.

When specifying an integer, 0 indicates no free pages, 1 indicates a free page after every page, 2 indicates a free page after

400

Move for DB2

5.7 Create Process every two pages, and so forth. PCTFREE

SUBPAGES

BUFFERPOOL

Percentage of each page that is to be left as free space when the table space is loaded or reorganized. Specify: 0-99

An integer in this range. The default is 5.

*

The value assigned to the source index is to be used.

Number of subpages for each physical page. (For DB2 version 5.1 or earlier.) Specify: 1, 2, 4, 8, or 16

An integer indicating the number of subpages. The default is 4.

*

The value assigned to the source index is used.

Name of the default buffer pool for indexes. The panel shows the valid selections when DB2 version 3.1 and higher is installed. If version 2 is installed, BP0, BP1, and BP2 are valid. The adjustment to the correct DB2 version is automatic. Specify * to use the value assigned to the source index.

CLOSE

Specify whether the data sets can be closed when they are not in use and the number of open 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 during the CREATE INDEX statement. YES

User Manual

Index is not built.

401

5. Data Migration 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. (For DB2 version 4.1 to version 5.1.) Specify: 1

Type 1 index is created.

2

Type 2 index is created.

*

Type matches type of source index.

Indicates whether copy option is used. (For DB2 version 6.1 or later.) Specify:

COPY

Y

Index space can be image copied. Target index also includes copy option.

N

Index space cannot be image copied.

Creator ID Defaults Select Option 4 Creator ID Defaults on the CREATE Defaults menu to 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 *SOURCE Blank Other

-

Same as Base Table Same as Source View's Creator ID Current SQLID Explicit Creator ID

ALIAS CREATOR ID ===>

*TABLE *SOURCE Blank Other

-

Same as Base Table or View Name Same as Source Alias' Creator ID Current SQLID Explicit Creator ID

Figure 194. Creator ID Defaults

402

Move for DB2

5.7 Create Process Panel Fields

The fields on this panel include: VIEW CREATOR ID

ALIAS CREATOR ID

Creator ID to be used for the name of the index. Specify: *TABLE

Creator ID from the base table.

*SOURCE

Creator ID from the source view.

Blank

Current user’s SQLID.

Other

An explicit Creator ID value is supplied.

Creator ID to be used for the name of the alias. Specify: *TABLE

Creator ID from the base table or the view.

*SOURCE

Creator ID from the source alias.

Blank

Current user’s SQLID.

Other

An explicit Creator ID value is supplied.

5.7.3 CREATE Process Table Map A Table Map is used to specify the names of the tables to be created at the destination. By default, MOVE assumes the base names of the tables in the Extract File are to be used. You must specify a Destination Creator ID. This option is required in order to execute the Create Process, grant privileges, specify synonyms, use the OUTPUT option.

User Manual

403

5. Data Migration When you select Option 1 Table Map from the CREATE Process menu, the CREATE Process Table Map panel is displayed. Assume the object definitions for three tables are specified in an Extract File. The following panel is displayed:

-------------------------- CREATE Process Table Map ----------------------Command ===> SCROLL ===> CSR Available Commands: APPLY, SAVE, LIST, END when Complete Destination May be any DB2 Tables or Views Src CID: PSTDEMO

Dest CID ===>

Extract Tables Destination Table Name Type ------------------ ---------------------------- -------*************************** TOP ************************ CUSTOMERS CUSTOMERS UNKNOWN ORDERS ORDERS UNKNOWN DETAILS DETAILS UNKNOWN ************************* BOTTOM ***********************

Figure 195. Create Process Table Map Panel Fields

The fields on this panel include: Src CID

The default Creator ID for the source tables as specified in the Extract File. This value cannot be modified.

Dest CID

The default Creator ID for the destination. Initially, the field is blank. A valid value must be specified.

Extract Tables

Names of the tables included in the Extract File. The Creator ID is included only when it differs from the Src CID. These values cannot be modified.

Destination Table Name

Names of the destination tables that correspond to the listed source tables. Initially, MOVE supplies the source table names for the destination tables. You can specify other names by overtyping the name in the field, by requesting a selection list from which to choose, or using the APPLY command. If you leave the field blank, the corresponding object definitions in the Extract File are ignored for the current Create Process.

404

Move for DB2

5.7 Create Process Type

The destination type supplied by MOVE and indicated as: TABLE VIEW UNKNOWN A-TABLE A-VIEW S-TABLE S-VIEW UNUSED TEMPTBL

Available Commands

The following commands are available on this panel: APPLY BOTTOM CANCEL

Selection List

A table A view Not found or initial display An alias of a table An alias of a view A synonym of a table A synonym of a view A destination table is not specified. Temporary table

DOWN END LIST

OPTIONS TOP UP

The LIST command is available for aliases, synonyms, tables, and views. For example, to obtain a selection list of available tables, use the command LIST TABLES and position the cursor on the destination table name you want to supply. A selection list of available tables with the destination Creator ID is displayed. You can override the destination Creator ID with the LIST TABLES command as in LIST TABLES SMITH.%. Use the Select line command, S, to select a table name from the selection list. MOVE automatically places the name in the destination table name field on which the cursor is positioned. Duplicate table names are not allowed. Therefore, the same table name cannot be specified twice as a destination table.

Use Existing Table Map

You can use the APPLY command to populate the Table Map with the specifications from a previously defined Table Map. If the source tables 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 CID regardless of any entry, or populate only the blank fields.

Destination Table Type

MOVE automatically revises the Type each time you modify a destination table name. If you modify the Dest CID, any tables that are specified without an explicit Creator ID automatically use the new Dest CID. This may change the Type value and require review. You can explicitly supply the Creator ID with the Destination Table Name. Then, changing the Dest CID does not affect the table name.

User Manual

405

5. Data Migration Additional Information

Additional information about defining Table Maps is provided in Section 4.4 Table Maps.

5.7.4 Perform Create Process Select Option 2 Perform to invoke the Create Process. You are presented with the CREATE Object List panel which includes entries for each destination table in the Table Map and all of the related object definitions contained in the Extract File. You can select which objects are to be created and modify the name to be assigned to those objects. Use the CREATE ALL primary command to create all of the selected objects, the CR line command to create specific objects, or the CRA line command to create a single table and all of its related objects. Assume the object definitions for three tables, as listed on the CREATE 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 Panel Fields

The fields on this panel include: Cmd

Line command area. The following line commands are available: S

406

Select object. This object is to be created if the CREATE ALL command is executed.

Move for DB2

5.7 Create Process

Status

User Manual

U

Unselect object. This object is not created if the CREATE ALL command is executed.

CR

Create this object regardless of whether it has the status SELECT or UNSELECT.

CRA

Create this table regardless of the status and all related objects that have the status SELECT.

DR

Drop the existing object. This is normally used to drop an existing object that is no longer needed or wanted.

DB2

Switch the type of key to be created from a Princeton Softech definition (PST) to a DB2 definition (DB2). This is only valid for PST primary keys and PST relationships that are defined by a valid DB2 primary key/foreign key pairing. These relationships are identified as FK(PST).

PST

Switch the type of key to be created from a DB2 definition (DB2) to a Princeton Softech definition (PST). A relationship is identified as FK(PST) after it is created.

SQL

Display the SQL that would be used to create an object (for SELECT or UNSELECT status only) or the SQL that was used to create an object during this create session (for CREATED status).

Status of the object definition. The possible statuses are: CONFLICT

An object exists with the specified name, but it does not correspond to the object on the list.

CREATED

The object was created during this session.

EXISTS

The object exists.

PENDING

The object is a joined view or a relationship and create was requested but a prerequisite object does not exist. Create the prerequisite object and MOVE will automatically create the

407

5. Data Migration pending object.

Type

SELECT

Object definition is to be created if the CREATE ALL command is executed.

UNSEL

Object definition is not to be created if the CREATE ALL command is executed.

Type of object definition as one of the following: TABLE VIEW PK(DB2) FK(DB2)

INDEX JVIEW PK(PST) FK(PST REL SYNONYM

ALIAS TEMPTABLE The source of existing or the destination of nonexisting primary keys and relationships is noted appropriately with the type. Thus keys in the DB2 Catalog are designated as PK(DB2) and FK(DB2); those in the Princeton Softech Directory are designated as PK(PST) and FK(PST) or REL. The objects designated FK(PST) follow the rules for DB2 Catalog foreign keys and can be respecified to be created in the DB2 Catalog. The objects designated as REL are relationships in the Directory that are not based on primary key/foreign key pairing and therefore cannot be created in the DB2 Catalog. (For more information about the differences in these relationships, see Section 4.2 Relationships.) The table type is left justified in the field. Since all of the other object types are directly related to specific tables, their type is indented to indicate this subordination. Note that Temporary Tables are available only for DB2 release 5.0 or greater. Therefore, a table identified as TEMPTABLE is forced to UNSEL when using DB2 4.1 or lower. Object Name

408

Name of the object. The object name may be changed by overtyping this value for any object type except TABLE. When the name is changed, the status is automatically amended. (The name of a table can only be changed on the Table Map panel.)

Move for DB2

5.7 Create Process Database

If the table exists, the name of the database that the table belongs to is displayed. If the table does not exist, the default value, as specified on the Table Defaults panel, is specified. If a default value has not been established, the field is blank. You may type the desired database name directly in this field. This value is retained. A database name is required, therefore if this field is blank when you request that the table be created, you will be prompted. If you enter the name of a database that does not exist, the Create Database panel prompts for the information needed to create it. See Section 5.7.4.1 Create Database.

Tablespace

If the table exists, the name of the table space the table belongs to is specified. If the table does not exist, the default value, as specified on the Table Defaults panel, is specified. If a default value has not been established, the field is blank. You may type the desired tablespace name directly in this field or leave blank. The typed value is retained. If you enter the name of a tablespace that does not exist, the Create Tablespace panel prompts for the information needed to create it. (See Section 5.7.4.2 Create Tablespace.) If you initiate a CREATE for the table and the Tablespace field is blank, DB2 automatically generates a tablespace name, based on the table name.

Review SQL Before Create

Specify whether the SQL generated by MOVE to create the objects is to be displayed in the ISPF editor prior to being executed. Specify: YES

SQL is displayed prior to execution. You can edit and save the SQL.

NO

SQL is not displayed.

If YES, you must use the RUN command in the ISPF editor to execute the SQL. The display includes top and bottom markers to indicate the first and last entries on the list. A count indicating the relative position of the

User Manual

409

5. Data Migration first displayed object on the list and a total number of objects is displayed to the right on a line below the SCROLL field. Initial Display

On initial display, the CREATE Object List panel includes an entry with the TABLE type for every destination table listed on the CREATE Process Table Map panel. The table names are listed in the order in which they are specified on the Table Map panel. The Extract File is checked for the other types of object definitions. Only the object definitions associated with the listed table definitions are included on the CREATE Object List panel. Relationships and joined views are included only if all prerequisite tables are included on the CREATE Process Table Map panel.

Object Definition Status

For the initial display, MOVE checks each object definition on the list and assigns a status as follows: •

If an object definition matches an existing object at the destination, it is assigned the EXISTS status.



If an object definition name matches an existing object name but the definition does not match the object, the object definition is assigned the CONFLICT status.



If an object definition does not exist at the destination, it is assigned the SELECT status.

The status determines which object definitions are created when the CREATE ALL command is entered. SELECT Status

MOVE attempts to create only those object definitions assigned the SELECT status when CREATE ALL is executed. From the initial display, you can specify individual object definitions to be “unselected” or assigned the UNSEL status using the Unselect line command, U. The object definitions in UNSEL status are not created when CREATE ALL is executed. You can reassign the SELECT status using the Select line command, S. Note that the CR line command can be used to create individual objects regardless of status and the CRA line command to create a table, regardless of the status, and all of its related SELECTed objects.

CONFLICT Status

410

The CONFLICT status results when the object definition for a named object on the CREATE Object List panel conflicts with an existing object at the destination. This can occur for indexes and relationships. For example, an index definition on the panel has the same name as an index defined at the destination but the indexes are for different tables.

Move for DB2

5.7 Create Process 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 the table name on the Table Map panel. (Changing the database name will also affect the status of the object definitions associated with that table definition.) When a TABLE is in CONFLICT status, all related object definitions are also in CONFLICT status. For object definitions other than TABLES when the TABLE is not in CONFLICT status, you can respecify the name of the object definition on this panel.



Using the DR line command to drop the conflicting object at the destination. Then the object definition can be used to create a new object. (You cannot use the DR line command to drop a table 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 drop objects in conflict.

Due to performance consequences, MOVE does not perform any column checking for existing tables, primary keys, relationship, foreign keys, and views when creating these objects. If the name and type of the object definition on the CREATE Object List panel matches that on the destination, it is assigned the EXISTS status. CREATED Status

All objects successfully created during the current session are assigned the CREATED status.

PENDING Status

The PENDING status is assigned to a joined view or a relationship, when an object on which one of these dependent object definitions is based does not exist at the destination and a request is made to create this dependent object. (A request to create any other dependent object such as aliases, indexes and primary keys results in an error message.) If the CREATE ALL command is executed, MOVE can detect these potential pending situations and create the dependent objects after the requisite tables. If the CR or CRA command is executed, MOVE checks the object definitions in pending status and creates them if possible and changes the status to CREATED. Otherwise, they remain in PENDING status.

Modifying the List

User Manual

You can modify the names of the object definitions for any object except TABLE by overtyping the values provided in the name fields.

411

5. Data Migration If you do modify the names, MOVE amends the status for each object definition appropriately. You can redisplay the CREATE Process Table Map panel and modify the destination table names. Any destination table names that you remove from the Table Map are deleted from the CREATE Object List along with their associated object definitions. Conversely, any tables that you add to the Table Map, are included on the CREATE Object List. You cannot insert or delete object definitions from the list directly. DEFAULTS Command

You can use the DEFAULTS command to display the CREATE Defaults menu. From this menu you can select an option and modify the defaults. The changes you make on the default panels only affect those object definitions that have not been explicitly modified by the user and do not already exist. See Section 5.7.2 CREATE Process Defaults for additional information.

DROP ALL Command

Use the DROP ALL command to drop all objects in the destination before creating the new objects. The DROP ALL command does not drop objects in conflict, however.

DB2 or PST

You can use the line commands DB2 and PST to switch the type of primary key or foreign key that is created. By default, the key is created based on the source type. However, using these line commands you can switch from the DB2 Catalog to the Princeton Softech Directory and vice versa. You can determine the current destination with the type field. For example, FK(PST) designates a relationship that adheres to DB2 requirements for a foreign key to be defined in the Princeton Softech Directory, and PK(DB2) designates a primary key and is to be defined in the DB2 Catalog. Unlike the DB2 Catalog, the Directory does not require a primary key/foreign key pairing to define a relationship. However, any relationship in the Directory that conforms to the DB2 Catalog requirements is indicated as FK(PST) on the CREATE Object List panel. Indicating these relationships as FK(PST) enables users to switch the destination from the Directory to the DB2 Catalog. Any relationships in the Directory that do not conform to the DB2 requirements are indicated as REL and cannot be defined to the catalog. These different types are also evident in the SQL statement that is generated. The following show the SQL that is generated for relationships. The first is the SQL for a DB2 foreign key and the second for a comparable PST key, and for a PST relationship that is not based on a primary key/foreign key pairing.

412

Move for DB2

5.7 Create Process PST to DB2

The SQL for a DB2 foreign key generated from a PST relationship always includes the DELETE RESTRICT rule. Assume the foreign key RTCO, where SOFTECH.CUSTOMERS is the parent to SOFTECH.ORDERS and the key column is CUST_ID, is switched to DB2.

The following SQL would be generated. ALTER TABLE SOFTECH.ORDERS FOREIGN KEY RTCO (CUST_ID) REFERENCES SOFTECH.CUSTOMERS ON DELETE RESTRICT;

PST Relationship and DB2 to PST

The SQL to generate a PST relationship either from a PST relationship or from a DB2 foreign key lists the corresponding columns. Assume the column CUST_ID in SOFTECH.CUSTOMERS is not the primary key. The following sample SQL would be generated to create a PST relationship named RTCO where the column CUST_ID in SOFTECH.CUSTOMERS is related to the column CUST_ID in SOFTECH.ORDERS. PST ALTER TABLE SOFTECH.ORDERS RELATIONSHIP RTCO (CUST_ID = CUST_ID) REFERENCES SOFTECH.CUSTOMERS;

Although only one column is listed in these examples, multiple columns can be involved. Also, PST relationships can include expressions such as substrings of columns, concatenated columns, literals and constants. (For more information about PST relationships, see Section 4.2 Relationships.) As documented later in this section, the SQL can be modified prior to being submitted, therefore you can respecify the destination directly. Handling the List

User Manual

In addition to scrolling facilities, the SHOW command can be used to display only the object definitions for a specific type or a specific status. (The object definitions for the type TABLE, regardless of status, are always displayed.)

413

5. Data Migration For example, the following figure shows the result when SHOW INDEX is entered on the panel in Figure 196. CREATE Object List: ---------------------------- 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 repeated executions of the SHOW command or all object definitions with the command SHOW ALL. Review SQL

If you specify Yes, to Review SQL Before Create, the SQL generated by MOVE to create the selected objects is displayed. Since the SQL is displayed in the ISPF editor, you can edit it directly and save it. Use RUN to execute the SQL; use END or CANCEL to abandon execution.

SQL Line Command

You can use the SQL line command to display the SQL for any object on the list with the UNSEL, SELECT, or CREATED status. This display is browse-only and the SQL will include any user modifications that were made to create the object. (The SQL line command is not available to display the SQL for existing object definitions because of the lengthy catalog retrieval that would be required.)

Create Performed

After the Create Process has executed, the resulting information from DB2 is automatically displayed as browse-only data in SPUFI-format. Assume the relationship RTCO for the ORDERS table, as shown in Figure 196. CREATE Object List, is created.

414

Move for DB2

5.7 Create Process The DB2 output is displayed as shown in the following figure:

------------------------------ Browse DB2 Output ---------------- SUCCESSFUL SQL Command ===> 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 0 DSNE616I STATEMENT EXECUTION WAS SUCCESSFUL, SQLCODE IS 0 ---------+---------+---------+---------+---------+---------+---------+---------+ DSNE601I SQL STATEMENTS ASSUMED TO BE BETWEEN COLUMNS 1 AND 72 DSNE620I NUMBER OF SQL STATEMENTS PROCESSED IS 1 DSNE621I NUMBER OF INPUT RECORDS READ IS 2 DSNE611I NUMBER OF OUTPUT RECORDS WRITTEN IS 14 ******************************** BOTTOM OF DATA ********************************

Figure 198. DB2 Output from CREATE Available Commands

The primary commands available on the CREATE Object List panel include: BOTTOM CANCEL CREATE ALL DEFAULTS

DROP ALL DOWN END OPTIONS

SHOW TOP UP

5.7.4.1 Create Database If, on the CREATE Object List, you specify the name of a database that does not exist, MOVE prompts for the information to create the database. Note the "DATABASE NOT FOUND" message in the upper right corner of the following panel.

------------------------------ Create Database ------------ DATABASE NOT FOUND Command ===> DATABASE NAME BUFFERPOOL ROSHARE STOGROUP

: TSTDB ===> ===> ===>

(BP0-BP49, BP32K, BP32K1-9) (O-Owner, R-Read, Blank-DB Not Shared)

Review SQL before Create ===> Y

(Y-Yes, N-No)

Figure 199. Create Database

User Manual

415

5. Data Migration The fields on this panel include:

416

DATABASE NAME

Name of the new database. This value is inserted by MOVE and cannot be edited.

BUFFERPOOL

Name of the buffer pool used as the default for tablespaces. The panel shows the valid selections when DB2 version 5.1 is installed. However, if DB2 version 6.1 is installed, BP049, BP8K0-9, BP16K0-9, BP32K, or BP32K1-9 is valid. If version 3.1 of DB2 is installed, BP0-49, BP32K, or BP32K1BP32K9 is valid. The adjustment to the correct DB2 version is automatic.

ROSHARE

Sharing of read-only data in database. (DB2 version 5.1 or earlier.) Leave blank if database is not shared. Otherwise, specify: O

Current server can update database.

R

Current server has read-only access to database.

INDEX BUFFERPOOL

Name of the default buffer pool for indexes within the database. The panel shows the valid selections (BP0-BP49). If a value is not specified, the default is the name of the database buffer pool. (DB2 version 6.1 or later, only.)

STOGROUP

Name of the storage group.

Review SQL before Create

Specify Yes, to display the SQL generated by MOVE to create the database. The SQL is displayed in the ISPF editor, where you can edit it directly and save it. Use RUN to execute the SQL; use END or CANCEL to abandon execution.

Move for DB2

5.7 Create Process 5.7.4.2 Create Tablespace If, on the CREATE Object List, you specify the name of a tablespace that does not exist, MOVE prompts for the information to create the tablespace. Note the "TABLESPACE NOT FOUND" message in the upper right corner of the following panel. ---------------------------- Create Tablespace ---------TABLESPACE NOT FOUND Command ===> DATABASE NAME : TSTDB USING STOGROUP ===>

TABLESPACE NAME : PSTTEST PRIQTY ===> SECQTY ===> ERASE ===> (Y-Yes, N-No)

or VCAT ===> FREEPAGE PCTFREE SEGSIZE LARGE NUMPARTS BUFFERPOOL LOCKSIZE CLOSE DSETPASS COMPRESS LOCKMAX CCSID MAX ROWS

===> ===> ===> ===> ===> ===> ===> ===> ===> ===> ===> SYSTEM ===> ===>

(0-255) (0-99) (4, 8, 12, ... 64, Blank - Not Segmented) (Y-Yes, N-No) (1-254, Blank – Not Partitioned) (BP0-49, BP32K, BP32K1-9) (A-Any, P-Page, TS-Tablespace,T-Table,R-Row) (Y-Yes, N-No) (Y-Yes, N-No) (0-2147483647 or SYSTEM) (E-EBCDIC or A-ASCII) (1-255)

Review SQL before Create ===> Y

(Y-Yes, N-No)

Figure 200. Create Tablespace Panel Fields

The fields on this panel include: DATABASE NAME

Name of the database. This value is inserted by MOVE and cannot be edited.

TABLESPACE NAME

Name of the new tablespace. This value is inserted by MOVE and cannot be edited.

USING STOGROUP

Name of the storage group. A value in this field indicates that DB2 defines and manages the data sets for the tablespace. You may also provide values for the following prompts: PRIQTY

Indicates the primary allocation for the data set as an integer value. The default value is based on the BUFFERPOOL specification. For 4K, PRIQTY must be between 12 and 4194304. For 32K, the minimum is 96. Minimums for DB2 version 6.1 and later are: 8K – 24 and 16K – 48.

User Manual

417

5. Data Migration SECQTY

Indicates the secondary allocation for the data set as an integer value. The default value must be greater than or equal to 0 and less than or equal to 4194304 for any BUFFERPOOL specification.

ERASE

Indicates whether data sets in the tablespace are erased when deleted. Specify: YES NO

Erase Do not erase

or VCAT

The identifier of the VSAM catalog where the data sets defined for the tablespace are cataloged. This parameter indicates that the tablespace is user-managed. You may specify a value for USING STOGROUP or a value for VCAT, but not both.

FREEPAGE

Frequency of a page of free space when the tablespace is loaded or reorganized. Specify: 0-255

Any integer in this range. The DB2 default is 0. Specify 0 for no free pages, 1 for a free page after every page, 2 for a free page after every two pages, and so forth. If the tablespace is segmented, the number of pages left free must be less than the SEGSIZE value. PCTFREE

Percentage of each page left as free space when the tablespace is loaded or reorganized. Specify: 0-99

SEGSIZE

418

Any integer in this range. The DB2 default is 5, which means 5%.

Indicates whether the tablespace is segmented. Specify: 4-64

Any integer that is a multiple of 4 in this range. The value indicates the number of pages assigned to each segment.

Blank

Tablespace is not segmented.

Move for DB2

5.7 Create Process

User Manual

LARGE

Default established as LARGE or not. (For DB2 version 5.1 or later.)

NUMPARTS

Number of partitions. (For DB2 version 5.1 or later.)

BUFFERPOOL

Name of the buffer pool used as the default for tablespaces. The panel shows the valid selections when version 5.1 is installed. However, if DB2 version 6.1 is installed, BP049, BP8K0-9, BP16K0-9, BP32K, and BP32K1-9 are valid. If version 3.1 of DB2 is installed, BP0-49, BP32K, and BP32K1BP32K9 are valid. If version 2 is installed, BP0, BP1, BP2, BP32K are valid. The adjustment to the 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 can be specified for a segmented tablespace only.

R

Row is the locking level. (This locking level is available beginning with release 4.1 of DB2. It is not displayed if you are using an earlier release.)

CLOSE

Indicates whether data sets can be closed when not in use if the number of open data sets has reached the limit.

DSETPASS

Master level password. (For DB2 version 5.1 or earlier.)

COMPRESS

Indicates if data compression is performed. (For DB2 release 3 or later.) Specify: YES

Data is compressed when the LOAD or REORG utility is run on the table in the tablespace.

NO

Data is not compressed.

419

5. Data Migration LOCKMAX

Maximum number of locks that can be in effect simultaneously in the tablespace. (For DB2 release 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 DB2 version 5.1 or later.)

MAX ROWS

Maximum number of rows per page. (For version 5.1 or later.)

MEMBER CLUSTER

Clustering of inserted data. (For DB2 version 6.1 or later.)

Review SQL before Create

Y

Inserted data is clustered by the implicit or explicit clustering index.

N

DB2 chooses the location of data in the tablespace on the basis of variable space.

Specify Yes, to display the SQL generated by MOVE to create the tablespace. The SQL is displayed in the ISPF editor, where you can edit it directly and save it. Use RUN to execute the SQL; use END or CANCEL to abandon execution.

5.7.5 Grant Privileges In addition to creating the desired objects, the Create Process enables you to specify the DB2 authorizations for the destination tables and views 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, you do not have to specify the authorizations immediately after you create the objects. However, since the Table Map information is not profiled it is usually most convenient to grant privileges directly after you perform the Create Process. If you decide to grant privileges as a separate step at a later time, you can grant privileges to any existing tables or views specified in the destination table field of the CREATE Process Table Map panel.

420

Move for DB2

5.7 Create Process When you select Option 3 GRANT from the CREATE Process menu the following panel is displayed. This panel shows the initial values. Any values you specify are profiled and displayed for subsequent requests to grant privileges.

-------------------------------- Grant Privileges --------------------------Command ===> GRANT

TO

ALL ALTER DELETE INDEX

===> ===> ===> ===>

Y N N N

(Y-Yes, (Y-Yes, (Y-Yes, (Y-Yes,

N-No) N-No) N-No) N-No)

INSERT ===> N SELECT ===> N UPDATE ===> N

(Y-Yes, N-No) (Y-Yes, N-No) (Y-Yes, N-No)

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

Review SQL before Granting Privileges ===> Y

(T-Tables In Table Map, V-Extracted Views) (Y-Yes, N-No)

Figure 201. Grant Privileges Panel Fields

The fields on this panel include: GRANT

Specify which authorizations are to be included in the grant request. All authorizations can be granted by specifying Y to ALL. Specifications for any of the individual authorizations listed are ignored. The following authorizations are granted by ALL or can be granted separately: ALTER DELETE INDEX

INSERT SELECT UPDATE

For each of these specify:

User Manual

Y

Privilege is included.

N

Privilege is not included.

421

5. Data Migration TO

Specify whether the authorizations for this request are granted to all or specific users. For the prompt PUBLIC specify: Y

Privileges are granted to all users.

N

Privileges are to be granted to specific users as listed.

An area consisting of 16 8-character fields is provided below the prompt on which to specify the AUTHIDs for up to 16 users. If you want to specify more than 16 users, you must re-execute the grant request. ON

Select the tables or views that are to be included in the grant request. Specify: T

Tables

V

Views

A selection list of the specified object definitions is displayed. Review SQL before Granting Privileges

Select Tables/Views

Specify whether the SQL generated by this request is displayed for review prior to execution. Specify: Y

SQL is displayed.

N

SQL is not displayed.

When you specify T or V in response to ON Select List of, a selection list of the specified object type is displayed. The selection list of tables is comprised of those tables included on the CREATE Process Table Map panel that have been created or exist. The selection list of views is comprised of those views defined in the Extract File and that have been created or exist with the default Creator ID applied. (The default Creator ID for views can be defined on the CREATOR ID Defaults panel, page 402.) Use the S line command to select one or more of the objects to be included in the request. After objects are selected, use the U line command to unselect a previously selected object. The block form of the commands, SS and UU, are available. You can scroll the list using UP, DOWN, TOP and BOTTOM if necessary.

422

Move for DB2

5.7 Create Process Selections Complete

When you are satisfied with your selections, use END or ENTER. If you have responded N to Review SQL before Granting Privileges, the request is executed. If you responded Y, the SQL is displayed for review in the ISPF editor. 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 browseonly display. This output is in SPUFI-like format and includes the executed SQL statement, the DB2 SQLCODE, and any other pertinent execution information. (An example of the display is shown in Figure 198. DB2 Output from CREATE on page 402.)

5.7.6 SYNONYMS This option enables you to specify additional synonyms by providing a list of the synonyms for the tables in the Extract File. When you select Option 4 SYNONYMS on the CREATE Process menu, the CREATE Additional Synonyms panel is displayed. Assume the Extract File that has been specified contains six tables and the CREATE Additional Synonyms panel is displayed as shown in the following 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 ===> Cmd --*** ___ ___ ___ ___ ___ ___ ___ ***

1 of 7

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

User Manual

423

5. Data Migration Panel Fields

The fields on this panel include: Synonym Owner

Specify the Authorization ID of the user for whom the synonyms are being created. If the value specified is different from the SQLID currently in use for the MOVE session, you must have authorization to switch to that SQLID.

Cmd

Line command entry field. The available line commands are:

Status

424

S

Select the synonym to be created.

U

Unselect this previously selected synonym. Do not create this synonym.

Indicates whether or not the synonym exists, and, if not, whether it is to be created. The possible values are: CONFLICT

Synonym exists but for a different table.

EXISTS

Synonym already exists with specified name.

SELECT

Synonym is to be created.

UNSEL

Synonym is not to be created.

Synonym Name

1- to 18-character name to be used as a synonym. This field is initially populated with the synonyms extracted with the base tables from the source. It is unprotected so that you can specify your own names.

Base Name

Name of the table as specified in the Destination Table field on the CREATE Process Table Map panel.

Review SQL before Create

Specify whether you want to review the SQL before it is executed. Specify: Y

Display SQL.

N

Do not display SQL.

Move for DB2

5.7 Create Process Available Commands

The following primary commands are available: BOTTOM CANCEL CREATE ALL

Specifications Complete

DOWN END OPTIONS

TOP UP

When you are satisfied with your selections, use CREATE ALL. If you have responded N to Review SQL before Create, the request is executed. If you responded Y, the SQL is displayed for review in the ISPF editor. 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 browseonly display. This output is in SPUFI-like format and includes the executed SQL statement, the DB2 SQLCODE, and any other pertinent execution information. (An example of the display is shown in 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 for editing and future use, but more importantly, it enables you to save the SQL to create all object definitions on the CREATE Object List regardless of whether they exist or not. With this stored SQL, the objects 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

User Manual

425

5. Data Migration Panel Field

The fields on this panel include: Output Dataset

Specify the name of the data set to contain the generated SQL statements. You may specify a partitioned data set or a sequential data set. The data set must be defined with 80-character fixed length records. If the named data set does not exist, MOVE prompts for the information required to allocate the data set and allocates it for you. If the data set does exist, MOVE overlays any existing data with the SQL statements. You can display a selection list of data sets using wild card characters.

Output SQL for (existent or nonexistent objects)

Output for SQL (selected or all objects)

Review SQL after Output

Specify whether the SQL for only the nonexistent objects, objects to be created, or the SQL for all objects is to be output. Specify: N

Only the SQL for nonexistent objects.

A

The SQL for all objects.

Specify whether only the selected objects are to be included or if all object definitions are to be included in the output SQL. Specify: S

Only the SQL for selected objects.

A

The SQL for all objects.

Specify whether you want to review the SQL after it is output. Specify: Y

Display SQL.

N

Do not display SQL.

The SQL is written in SPUFI format. It is provided for the object definitions as specified by your responses to the Output for SQL prompts. The SQL incorporates the defaults that you have established on the various defaults panels (see Section 5.7.2 CREATE Process Defaults.)

426

Move for DB2

5.8 Convert Process

5.8 Convert Process The Convert Process enables users to apply the data transformations specified in a Table Map and a set of Column Maps to the contents of the Extract File to obtain a “converted” version of the Extract File. The Convert Process can be performed as part of an Extract Process or at any other time for an existing Extract File. This converted Extract File can then be used as the input to any MOVE process. Many sites use Convert to mask sensitive data before inserting it. In this way, sensitive data is eliminated from the Extract File. An Extract File does not have the same level of protection afforded by DB2. This capability can be used whenever the data is to be inserted into tables in the same subsystem, inserted in another subsystem, or downloaded to another platform and loaded using Relational Tools for Servers on other platforms.

5.8.1 Convert Extract File Panel When you select Option 6 from the Data Migration menu, the following panel is displayed.

----------------- Specify CONVERT Parameters and Execute -----------------OPTION ===> 1 2

TABLE MAP PERFORM

- Specify Table Map and Column Maps - 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 Run Process in Batch or Online ===> O If Batch, Review or Save JCL ===>

(Y-Yes, N-No) (B-Batch, O-Online) (N-No, R-Review, S-Save)

Figure 204. CONVERT Extract File

User Manual

427

5. Data Migration Panel Options

The options on this panel include: 1 TABLE MAP

Specify the names of the destination tables for each table in the Extract File. A Table Map must be specified to perform the Convert Process, therefore if you do not select this option first, MOVE automatically displays the Table Map panel before proceeding with the selected option. When the Table Map is displayed, you must specify the destination Creator ID, Dest CID. By default, MOVE assumes the base destination table names are the same as the names defined in the Extract File. There is no default destination Creator ID. You may specify Column Maps for one or more destination tables. These maps enable you to specify the destination data column-by-column. For more information about specifying Table Maps and Column Maps, see Section 4.4 Table Maps and Section 4.3 Column Maps.

2 PERFORM Panel Fields

Perform the conversion request.

The fields on this panel include: Source Extract File DSN

Name of the Extract File that contains the source data to be converted.

Control File DSN

Name of a sequential file that is to be used to accumulate information and statistics about the Convert Process.

Destination Extract DSN

Name of the data set to contain the converted Extract File. If a name is not specified, the actual transformations are performed in a temporary file which the user is prompted to allocate. After successful execution, the Source Extract File is deleted and the temporary file is saved under the source file name. Object definitions in the source Extract File are lost.

Age Date Values

Specify whether date values are to be aged as part of this process. Specify: Y

428

Date values are to be aged. The Specify Aging Parameters panel is displayed. On this panel, specify aging values to be used.

Move for DB2

5.8 Convert Process These values supplement the specifications for columns mapped with AGE and FUTURE_YEAR functions and are used, if requested, to age DATE and TIMESTAMP columns not explicit targets of an AGE or FUTURE_YEAR function. N

Date values are not to be aged. The specifications for aging on the Column Maps included in the process are ignored.

Additional information about the Specify Aging Parameters panel is provided on page 342. Limit Number of Discarded Rows

Specify a maximum number of rows that can be discarded. When this value is reached, the Convert Process is terminated.

Sort Extract File Rows

Specify whether the data for destination tables with a cluster index are to be sorted. Specify:

Review Propagation Key Sets

Y

Sort rows.

N

Do not sort rows.

Specify whether the Propagate Key Set(s) panel is displayed before the process is performed. This option is only displayed when the PROP function has been specified in one or more Column Maps used by the process. Specify: ALWAYS

To always display the panel prior to performing the process.

ERRORS

To display the panel prior to performing the process only when the PROP specifications contain errors. Default.

For information about the Propagate Key Set(s) panel see page 347. If Batch, Review or Save JCL

User Manual

Specify whether JCL is reviewed prior to job submission. This is specified for batch execution only.

429

5. Data Migration Since the JCL is displayed in the ISPF editor, you can modify it for the current request and save it to submit later. Specify: N

Submit job, do not display or save the JCL.

R

Display the JCL for review prior to job submission.

S

Save the JCL. Prompts are provided for you to specify the name of a file in which to store JCL.

Selection List

You can obtain a selection list of names of Extract File or names of Control Files by specifying the wild cards, * or %, as the last character in the name. When the list is displayed, use the Select line command, S, to select an entry. A sample of the selection list displayed for Extract File or Control File data set names is provided in Figure 165. Select Extract Data Set on page 311.

Available Commands

The following primary commands are available: CANCEL

Option 1 TABLE MAP

END

OPTIONS

When you select Option 1 TABLE MAP, the CONVERT Process Table Map panel is displayed. (As noted previously, a discussion of Table 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. Online Execution

If the process is executed online, a panel is displayed noting the progress 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

430

Move for DB2

5.8 Convert Process The total number of rows that have been converted out of the total number of rows to be converted is displayed. Also, the name of the currently processing table, total number of rows that have been converted, and total number of rows that could not be converted for that table are displayed. This is revised: •

Every 1000 rows for each table to display the current total number of processed rows.



When the processing for a table is complete and the processing for the next table begins.

Batch Execution If you specify batch execution, MOVE builds the necessary JCL. The JOB card information is taken from the JCL specified on the Job Card and Print Options panel. If you specified YES to Prompt for Changes Before Job Submission on the Job Card and Print Options panel, that panel is displayed prior to job submission. You may edit the job card information and specify whether your changes are to apply only to the current job submission 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 Convert Process parameters, to build the JCL required to perform the Convert Process. Review

If you specify Review to If Batch, Review or Save JCL, the complete jobstream is displayed in the ISPF editor and can be edited and saved. When you have completed reviewing the JCL, use END. If you have established that jobs are automatically submitted when END is used, the job is submitted. Otherwise, you will have to explicitly SUBMIT the job from the ISPF editor. (See Section 6.1 User Options, for information on establishing whether jobs are automatically submitted when END is used.)

Save

If you specify Save to If Batch, Review or Save JCL, you are prompted for the name of the file in which to save the JCL and whether the job should be submitted after saving the JCL. (Details are provided on page 358.)

Job Card Error

If you submit the job and an error is encountered in the job card, a message is displayed. You can review the job card and correct the error or terminate the Convert Process.

User Manual

431

5. Data Migration

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 the execution of the process. Display Report Contents

The contents of the CONVERT Process Report can be browsed. When the process is executed online, the CONVERT Process Report is automatically displayed. Standard ISPF scrolling functions are available. In batch, the report is placed in the output as specified in the JCL. You can then display the report as you would the output from any job.

Report Contents

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

1 2 3 4

Extract Convert Table Rows ------------------------ -------PSTDEMO.CUSTOMERS 132 PSTDEMO.ORDERS 792 PSTDEMO.DETAILS 2176 PSTDEMO.ITEMS 872

Data Exit Converted Conversion Routine Rows Errors Discards -------- ----------- --------132 0 0 796 0 0 2176 0 0 872 0 0

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

Figure 206. Convert Process Report Format Report Format

432

The report format includes headings to identify the information. These are: the Extract File name, the Control File name, the destination Extract File name, the user requesting the Convert Process, the date and time the process was executed. This is followed by: the number of tables, the number of rows in the Extract File to be converted, the number of rows successfully converted, and the number of rows having conversion errors and the number of rows discarded by an exit routine.

Move for DB2

5.8 Convert Process The tables are listed below this with a complete breakdown of the totals for each table. The sequence in which the tables are listed is the order in which these tables were specified in the Extract File. Aging Parameters

If aging parameters have been specified for the process, the report also includes: •

Any exception conditions encountered for each table. (This is included only when you specify Yes to Report Skipped Dates and Report Invalid Dates.) The following is a sample list of exception conditions 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 after the summary information. For example, the following lists specifications for a Convert Process that uses many of the defaults. Processing Parameters: Default Aging Amount: Default Aging Table: Default Aging Rule: Century Pivot Year: Process Date Columns: Report Invalid Dates: Report Skipped Dates: Output Rows With Invalid Dates: Output Rows With Skipped Dates:



=’2000/01/31’ PSAPRULE NEXTWORKDAY 65 Y YES YES YES YES

The aging results for each table include the information as specified on the Specify Aging Parameters panel. The information includes: Destination Column/Source Column names Number of valid dates Number of invalid dates Number of skipped dates Minimum value encountered Maximum value encountered Date format Aging Rule applied to column Rule Table containing Aging Rule applied to column Aging Amount applied to column Pivot year specifications for column (The format for DB2 DATE and TIMESTAMP columns is displayed as DB2 DATE and DB2 TMSTAMP.)

User Manual

433

5. Data Migration Print Report

While browsing the CONVERT Process Report online, you can use the OUTPUT command to direct the contents of the report to an output file or SYSOUT. A panel is displayed prompting for the necessary information based on the specified output destination. (For details on the OUTPUT command, see Relational Tools Command Reference Manual.) After the Convert Process has executed, you can review the resulting Extract File to ensure the transformation of the data. Use Option B BROWSE on the Data Migration menu to display the contents of the Extract File.

Discarded Rows

Rows are discarded when a requested conversion cannot be performed. For example, a row is discarded if an expression, specified to convert the source, would result in an invalid data type for the column. The discarded rows are noted in the Control File. Use Option B on the Data Migration menu to display the Control File to determine which rows were not converted. Also, rows can be discarded by user-defined exit routines. These rows are also included in the Control File.

434

Move for DB2

5.9 Retry/Restart Process

5.9 Retry/Restart Process MOVE keeps track of the Insert, Update/Insert and Delete processes that do not complete successfully and stores this information in the Princeton Softech Directory. This information includes the type of process, name of the Control File, the date and time the process was performed, and whether the process can be retried or restarted. RETRY

When one or more rows were discarded during the process, the process can be retried. A row might be discarded because of RI conflicts. For example, attempting to insert a child row that refers to a non-existent parent row.

RESTART

When a process does not execute to completion, the process can be restarted. For example, a process may not complete if it exceeds the allowable CPU limit.

Menu Option

When you select Option R, RETRY/RESTART, from the Data Migration menu, a list of pending processes initiated by the current user 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 Panel Fields

The fields on the panel are: Cmd

Line command entry field. The following line commands are available: I

Display information about a pending process.

D Delete a pending process. S Timestamp

User Manual

Select a pending process.

Date and time the process was performed. The list is arranged by timestamp in ascending order.

435

5. Data Migration Process/Status

The process that was being performed and the status of that process. The process is indicated as: DELETE INSERT UPDATE The status is indicated as: RETRY

Rows were discarded and can be retried.

RESTART

Process did not complete and can be restarted.

*DELETE

Process has been deleted using the Delete line command.

If the Extract File has been used since the process listed on this panel, MOVE cannot guarantee that its contents applies to the Control File therefore it is no longer valid. If you attempt to retry, restart, or display information about this process, the Process and status information is replaced with *INVALID. This process cannot be retried or restarted. RETRY and RESTART can apply to any process as appropriate. For example, a process in RETRY status cannot be restarted. Control File

436

The name of the Control File created by the process and required for the RESTART or RETRY.

Move for DB2

5.9 Retry/Restart Process List All Pending Processes

You can display a list of all pending processes for all users using the ALL 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 in Figure 208. Pending Process List - All SQL IDs. The Process/Status field 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 ascending order. Within each set of SQLIDs, the list is arranged by timestamp in ascending order. You can toggle between the display of all pending processes and only the processes for the current user, by entering ALL, for the complete list, and USER, for the user-specific list. These pending process lists can be scrolled using the standard ISPF scrolling facilities. Information about Process

You can display additional information about any of the listed pending processes. Use the Information line command, I. For example, assume I is entered for the first process, the following panel is displayed.

--------------------- Pending Process Attributes -------------------Command ===> Control File: Status :

Z13600MP.PSTDC.EXTRACT.SAMPLE1 RESTART

Extract File: Created By : Job : SQLID : Run On :

Z13600MP.PSTDC.XFILE COHEND COHEND SOFTECH 1998-04-13 14.07.10

Last Process: Job : SQLID : Run On :

DELETE COHEND SOFTECH 1998-04-13 16.57.53

Figure 209. Pending Process Information

User Manual

437

5. Data Migration Use END to return to the Pending Process List panel. Select Process

Use the Select line command, S, to select a process from the list. The process is retried or restarted based on its status.

Parameters Panel Redisplayed

When the process is retried or restarted, the Parameters panel for the process is redisplayed appropriately. The panel title indicates whether the process is Insert, Update/Insert, or Delete and whether the execution will be a retry or a restart. Although you cannot change the names of the Extract File DSN and the Control File DSN, you can respecify the other parameters. For example, the following figure is displayed when a Delete Process is restarted. (For details, see the information 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 Commit Every Nth Row Limit Number of Discarded Rows Run Process in Batch or Online If Batch, Review or Save JCL

===> ===> ===> ===> ===>

Y 100 1000 B

(Y-Yes, N-No) (1-1000, Blank-Site Limit) (1-999999, Blank-No Limit) (B-Batch, O-Online) (N-No, R-Review, S-Save)

Figure 210. Restart Delete Process When the Restart is invoked, the process is restarted with the row after the last committed deleted row. Any discarded rows from the original processing are retained. Any rows discarded by this execution are marked accordingly. Processing notification is provided for online execution. Also, a Process Report is generated. If the process completes successfully and there are no rows to retry or restart, the entry is deleted from the Pending Process List. If the process does not complete successfully, the entry is retained. The process can then be retried or restarted as required.

438

Move for DB2

5.10 Browse Extract File

5.10 Browse Extract File The Browse Extract File option allows you to display the contents of an Extract File or a Control File. This is useful when an Insert, Delete, Convert, or DB2 LOAD Process did not successfully complete. You can examine the discarded rows to determine the nature of the problems that may need to be handled. You can display the contents of the Extract File based on the status information in the Control File for discarded rows or incomplete activity. Browsing the Extract File is also helpful in determining the content of that 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 if row status information is to be included in browsed data or if row status information 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 Filter Extract Rows ===> _

(N-No, Y-Yes, X-Include Explanations) (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 Panel Fields

The fields on the panel are: Extract or Control File DSN

User Manual

Data set name of the Extract File or the Control File to use for constructing the browse output. The Control File contains the name of the associated Extract File. When the Extract File is to be browsed without regard to row status, you can specify either. However, if row status is to be displayed or used to selectively display rows, you must specify the Control File. Only the Control File contains information about row status.

439

5. Data Migration You can obtain a selection list of Extract Files or Control Files using * or % as a wild card character in the last position of the name. (A sample of the selection list displayed for Extract File or Control File data 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 to be browsed. If blank, all tables in the Extract File are included in the browse. If a Creator ID is specified followed by a period, as in PSTDEMO, then all tables with that Creator ID are listed.

Include Row Status

Specifies whether the row status defined in the Control File is displayed with the data. Specify: YES

Row status is included. A Control File DSN must be specified, otherwise this choice is ignored.

NO

Row status is not included.

X

Include explanations of the error with the SQL error code and the constraint or column name if any. For more information about the SQL errors that are documented in the Control File, see page 423.

The row status will show the result of processing each row. For example, the status shows whether the row was discarded. Filter Extract Rows

440

Specifies whether all of the rows in the Extract File are included or just the rows that have been discarded. Specify: E

Only rows in error, the discarded rows, are included. A Control File DSN must be specified, otherwise this choice is ignored.

A

All rows are included.

Move for DB2

5.10 Browse Extract File Provide Data Set Name

Data set name of a sequential file to contain the browse data. Specify only if the data is to be saved. If not specified, the browse data is put in a temporary data set for the browse operation and is not retained. If the specified data set does not exist, MOVE prompts for allocation information and allocates the file. (See Appendix B. Allocating External Files for details regarding file allocation.) This field contains 46 spaces providing for 44-character names and, if necessary, delimiters. Explicit names must be delimited by single quotes; otherwise, a prefix as specified on the User Options panel is added to the user-specified name to obtain the data set name.

If Display Length File Width

LIST TABLES Command

Specify what action should be taken when the display length of the data exceeds the width of the file. Specify: C

Change file characteristics to accommodate the data.

W

Do not change the file characteristics. The data will be wrapped onto multiple lines.

The LIST TABLES command is available to obtain a list of tables in the named Extract or Control File. The LIST TABLES command accepts no parameters. Use the Select line command, S, to select the tables.

Available Commands

The following commands are available on the EXTRACT Browse Parameters panel: CANCEL

User Manual

END

LIST TABLES

OPTIONS

441

5. Data Migration Browse Example

Assume you have selected a Control File named PSTDEMO.SAMPLE.CONTROL and specified that all rows and their status are to be included in the display. The following figure shows the formatted contents of the Control File.

BROWSE -- SYS94031.T141746.RA000.COHEND.R0000049 -- LINE 00000000 COL 001 080 Command ===> Scroll ===> PAGE ********************************* TOP OF DATA ****************************** Extract File Print Report Extract File Created by Created on Number of Tables

: : : :

Control File : Processing Status: Processed by : Process on :

PSTDEMO.SAMPLE.EXTRACT Job COHEND using SQLID PSTDEMO on DB3 Subsystem TDB2 15 Sep 1998 at 10:53 AM 4 PSTDEMO.SAMPLE.CONTROL Retry of Delete Process Started Job COHEND using SQLID COHEND on DB2 Subsystem TDB2 15 Sep 1998 at 03:01 PM

Table Statistics: PSTDEMO.CUSTOMERS Status of Processing on Table Destination Table Being Processed Column Map Being Used for Process Total Number of Rows Rows Successfully Deleted Rows to be Deleted not Found Rows to be Deleted with Mismatching Columns Rows not yet Processed Rows not Processed because of Errors

: Started : PSTDEMO.DESTABLE : COHEND.COLMAP2 : 32 : 11 : 0 : 0 : 19 : 2

Figure 212. Browse Control File - Statistics Statistical information is displayed at the top of the data. This includes the names of the Extract and Control Files as well as the name of each destination table and statistics that summarize the processing. Some statistics are dependent on certain processes and may not be included in the report.

442

Move for DB2

5.10 Browse Extract File To view the rows in the Control File from each table, scroll the display. The following figure displays several rows from the CUSTOMERS table. Note the status in the Status field on the left is provided only when the Control File is used.

BROWSE -- SYS94031.T141746.RA000.COHEND.R0000049 -- LINE 00000019 COL 001 080 Command ===> Scroll ===> PAGE Status CUST_ID CUSTNAME ADDRESS ------------ ------- -------------------- -------------------OK: 1 07006 Excalibur Video 35 Seminary Ave OK: 1 07260 Five Star Videos 123 Howe Lane OK: 1 07235 Jack's Grafton Plaza POSTPONED 07440 Monarch Movies 280 Chestnut St OK: 1 07201 Movie Buff 400 Merrimac OK: 1 07101 Movie Mania 572 Front St OK: 1 07126 Movie Rentals 101 Munson St OK: 1 07118 Movie Store 752 State Road OK: 1 07203 Movies-R-Us 1772 Bridge St OK: 1 07191 Popcorn 15 Crystal Park OK: 2 07156 Prime Tyme 982 Upper State St OK: 3 07140 ProMusic 84 Second Ave UNPROCESSED 07160 Reely Great Videos 590 Frontage Rd UNPROCESSED 07053 Replay Video 9032 Dickerson St UNPROCESSED 07150 Rick's Flicks 823 Chestnut St UNPROCESSED 07140 Showcase 1150 Indiana Terr UNPROCESSED 07141 Showcase II 57 Rock Hollow

CITY ----------Harvard Boston Grafton Springfield Concord Auburn Greenfield Menemsha Bourne Lenox Marion Chicopee Amherst Amherst Springfield Beverly Salem

ST -MA MA MA MA MA MA MA MA MA MA MA MA MA MA MA MA MA

Figure 213. Browse Control File - Status of Each Row Possible Status

User Manual

The status of each row is listed on the left-hand side of the panel. The possible values and their meaning are: OK: nnnnn

The row was successfully processed. The number represents the Logical Unit of Work in which it was processed. (A Logical Unit of Work ends with each commit.)

UNPROCESSED

The row has not been processed. This occurs when a process has not been performed yet, the process 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 a DB2 error. The number represents the DB2 SQLCODE. (For a list of SQL codes that are accompanied with an explanation, if requested, see page 445. )

RI ERROR

The row could not be processed because of a violation of RI rules defined to DB2. This status is provided after retrying a row in a cycle and the row is not successfully inserted when the process completes. (Note, when a cycle is not involved, a DB2 diagnostic is displayed in the format DB2: -nnn.)

443

5. Data Migration POSTPONED

The row could not be processed because of a violation of RI rules, but this row may be successfully processed later in the cycle. However, the process was terminated before this row could be reprocessed. This status is also set for rows that failed because of DB2 errors that are being retried.

444

CONV ERROR

The row was discarded because one or more columns could not be properly converted from the Extract File format to the database format. This can occur when the Extract File column contains NULL and the DB2 column is defined as NOT NULL or when the Extract File column value and the DB2 column data types are not compatible. This row cannot be restarted or retried. (For details on data type compatibility, see page 235.)

NOT FOUND

The row could not be found for a Delete Process.

MISMATCH

One or more columns on the Extract File did not match the column in DB2 for a Delete Process.

MISM PEND

One or more columns on the Extract File did not match the column in DB2 for a Delete Process, but this row may be successfully processed later in the process. However, the process was terminated before this row could be reprocessed. This occurs when deleting from tables with non-unique primary keys.

DUP PK

The row was discarded because it has a DB2 primary key that is the same as another row on the Extract File. This duplicate row cannot be restarted or retried. This can occur only when performing an Update/Insert. Before inserting the row, MOVE checks the destination. If the destination table is defined with a unique key but the Extract File contains multiple source rows, only the first encountered row is applied, the others are discarded with this status and are not processed further.

Move for DB2

5.10 Browse Extract File EXIT ERROR SQL Error Codes as Row Errors

About Conversion Errors

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. When you specify X for the prompt Include Row Status, pertinent error messages are included. The following are the SQL error codes and the 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 DUPLICATE VALUES

When a conversion error occurs, the column containing the error is displayed and a right-arrow, >, is placed to the left of the data in error. The right-arrow highlights the location of the error and can be used on the FIND command to locate these errors. The contents of the Extract File or Control File can be printed. For additional information see Appendix E. Printing Extract and Control Files.

Available Primary Commands

Several primary commands are available to manipulate the display: BOTTOM CANCEL DOWN

User Manual

END FIND LEFT

LOCATE RIGHT RFIND

UP TOP

445

6. Specify Options Several options are available to control the functions performed while using MOVE. These options can be modified by selecting Option 0 on the Main Menu or by entering the OPTIONS command from any panel with a COMMAND prompt. User Options, Edit and Display Options, and JOB Card information are specified on separate panels, therefore a submenu is displayed. Options Menu

------------------------- Choose Option Type -----------------------OPTION ===> 1 2 3 4 5

USER EDIT JOBCARD COMPARE ARCHIVE

-

User Options Editor and Display Options Job Card and Print Options Compare Options 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 for DB2 and Archive for DB2 are installed. For information about these Options, see the respective product’s User Manual. An additional option, 0 Site Options, is displayed for any user having an authorized password. For detailed information on Site Options see the Princeton Softech Relational Tools Installation and Administration Guide. Panel Format

The format of these Options panels is either full-screen or pop-up based on how the panel was accessed. When invoked from the OPTIONS command, the panels are pop-up. The full screen format is always displayed when selected through the Main Menu.

Values Profiled

The values you specify on the Options panels are profiled.

User Manual

446

6.1 User Options

6.1 User Options User options determine several user-specific parameters that govern a MOVE session. When you select Option 1 from the Choose Option Type menu, the following panel is displayed.

------------------------------ User Options ------------------------Command ===> Caps Mode On Confirm on Deletes Load Utility to Use Submit Jobs with END Display DB2 SubSystem Selection List Format Data Set Prefix User Supplied Password

===> ===> ===> ===> ===> ===> ===> ===>

N N D Y N S USERID

Change Line Characters ===> N Print Tables in JCL ===> 1 Review Job Card =è N

Y-Yes, N-No Y-Yes, N-No D-DB2, B-BMC Y-Yes, N-No Y-Yes, N-No S-Short, F-Full, D-Desc PREFIX, USERID, NONE or value Enable Administrator Mode Y-Yes, N-No 1-No, 2-Ext/Arc, 3-Ins/Res, 4-All Y-Yes, N-No

Figure 215. User Options Panel Panel Fields

The user options include: Caps Mode On

Confirm on Deletes

Load Utility to Use

User Manual

Specifies whether all edited data is translated to upper case or maintained as entered. This applies to specifying selection criteria. Specify: Yes

Caps Mode is on.

No

Caps Mode is not on.

Specifies whether a confirmation prompt is displayed every time an Access Definition, Primary Key, Relationship, Table Map, or Column Map is deleted. Specify: Yes

Confirmation prompt is displayed.

No

Confirmation prompt is not displayed.

Specifies the load utility to be used for the DB2 Load process. Site management may establish a non-modifiable default value. If modifiable, specify: D

IBM’s DB2 Load Utility is used.

B

BMC’s LOADPLUS Utility is used.

447

6. Specify Options Submit Jobs with END

Display DB2 SubSystem

Specifies whether jobs are automatically submitted when END is used while reviewing JCL for any batch job. The jobstream is generated by MOVE for the processes it performs and can be displayed in the ISPF editor prior to job submission. While in the ISPF editor, all standard ISPF facilities are available including saving the jobstream. Use this option to establish whether the job is automatically submitted when you exit the ISPF editor. Specify: Yes

Submit job.

No

Do not submit job. The SUBMIT command must be used to submit the job.

Specifies whether the DB2 subsystem is displayed on the second line on the right hand side of every Relational Tools panel. Specify: Yes

DB2 Subsystem is displayed.

No

DB2 Subsystem is not displayed.

If connected to a remove subsystem, the DB2 subsystem is replaced with the location of the remove subsystem. Selection List Format

Specifies which information is presented on a selection list of PST objects (Access Definitions, Table Maps, Column Maps, Relationships and Primary Keys). Specify: S

Short format. Modification information displays along with the objected name. (This is the display used throughout this manual.)

D

Description is displayed along with the object name.

F

Information is presented on two lines per entry. The first line is the same as for Short format. The second line displays the description and the security status if other than PUBLIC. Information about specifying security status is provided on page 451.

448

Move for DB2

6.1 User Options Data Set Prefix

PREFIX

The user’s TSO PREFIX is used. PRFX is an alternate form.

USERID

The current user’s TSO user ID is used. USER is an alternate form.

NONE

A prefix is not used.

Value

An explicit 1- to 17-character value to be used. This can be a combination of PREFIX, USERID and a literal.

User Supplied Password

Enables specification of the password required to modify the site options on the Site Options panel. If the password supplied in this field matches the Administrator Password, the current user can access the Site Options panel.

Change Line Characters

Enables users to respecify the characters used to define the perimeter of pop-up windows. (See Figure 216. Line Characters Pop-up Prompt) Specify:

Print Tables in JCL

User Manual

Specifies the default value to be used as the high order qualifier for any data set name that is not enclosed in apostrophes. Specify:

Yes

Display the line characters prompts.

No

Do not display the line characters prompts.

Enables user to insert a list of tables that participate in a batch process as comments in the JCL. The list of tables is displayed when you review JCL before submitting a job or browse the saved JCL. Specify: 1

Do not list tables for a batch process.

2

List source tables in a batch Extract or Archive Process.

3

List source and destination tables in a batch Insert, Update, or Restore Process.

4

List all tables in a batch Extract, Archive, Insert, Update, or Restore Process.

449

6. Specify Options Review Job Card

450

Specifies whether the job card prompts on the Job Card and Print Options panel are displayed enabling users to respecify the job statement and several other job parameters before 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.

Move for DB2

6.1 User Options

Change Line Characters If you specify Yes to Change Line Characters, the prompt is displayed as shown in the following figure. Only the characters you specify to override the default characters are displayed.

--------------------- User Line Drawing Characters ----------------Top Left Corner Top Right Corner Bottom Left Corner Bottom Right Corner Horizontal Bar Vertical Bar Forward Slash Backward Slash

===> ===> ===> ===> ===> ===> ===> ===>

Any Any Any Any Any Any Any Any

Displayable Displayable Displayable Displayable Displayable Displayable Displayable Displayable

Character Character Character Character Character Character Character 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 or END.

Specify Description and Security Status You use the Selection List Format option to specify whether the description and security status are displayed on the selection list of PST Directory objects. However, to specify the description and security status, use the ATTRIBUTES command from the object editor or the AT line command on the selection list to display prompts for specifying these values.

User Manual

451

6. Specify Options The prompts are displayed on the Object Attributes panel. In the following figure, the attributes for an Access Definition named PSTDEMO.PSTDEMO.SAMPLE are displayed.

------------------------- Select Access Definitions -------------------------Command ===> Scroll ===> PAGE ----- Access Definition ------ ------ Last Modified ------1 OF 8 Cmd --- - +-----------------------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 Panel Fields

The name of the object is displayed. You specify the following: Description

Specify a 1 to 40 character description of the object.

Security Status

Specify the access privileges for the named object as one of the following: PUBLIC

Any user can access and edit the object.

PRIVATE

Only the user that created the object can access and edit the object.

READONLY

Any user can access the object, but only the user that created the object can edit it.

Site management determines whether or not security status is available. If it is not available, this prompt is not displayed.

452

Move for DB2

6.2 Editor and Display Options

6.2 Editor and Display Options A set of editor and display options are available. When you select Option 2 from the Options menu, the following prompts are displayed.

------------------------ Editor and Display Options ---------------------Command ===> NULL Value Indicator DB2 VarChar Delimiter AutoCommit Mode Deleted Rows Display Audit Mode Maximum Fetch Rows Display Column Attributes Display Data in Hex Editor Display Format Columnar Max Display Width Sidelabels Max Display Width User Supplies Defaults NULL as Insert Default Editor Exit Processing ENTER Exits Criteria Panels AutoSwitch Mode Single View Mode

===> ===> ===> ===> : ===> ===> ===> ===> ===> ===> ===> ===> ===> ===> ===> ===>

? ; A S OFF 500 N N C 20 50 N N E A Y N

?,!,&,%,#,@ ;,:,?,!,&,%,#,@ A-Automatic, M-Manual S-Show, H-Hide Forced OFF In Range (1 - 500) Y-Yes, N-No Y-Yes, N-No C-Columnar, S-Sidelabels In Range (15 - 70) In Range (50 - 32767) Y-Yes, N-No Y-Yes, N-No E-Entry Panel, P-Prompt Panel A-Always, N-Never, U-Unchanged Y-Yes, N-No Y-Yes, N-No

Figure 218. Editor and Display Options Panel Panel Fields

The editor and display options include: NULL Value Indicator

Specifies the character to be used to represent the null value. The default character is question mark, "?". The possible characters are listed on the panel.

DB2 VarChar Delimiter

Specifies the character that is used by MOVE to delimit the end of a variable length character string with significant trailing blanks. The default character is the semicolon, ";". The possible characters are listed on the panel. For example, if the string "ABC " is entered in a variable length character field, it is retained as "ABC" unless a delimiter is used to indicate otherwise. Assume the delimiter character is ";", the string entered as "ABC ; , is retained as "ABC ".

AutoCommit Mode

User Manual

Specifies whether edited data is automatically committed with each screen interaction. (Access for DB2 only.)

453

6. Specify Options Deleted Rows Display

Specifies whether rows deleted during an edit session are displayed. (Access for DB2 only.)

Audit Mode

Specifies whether the Audit Facility is active during an edit session. Site management controls whether this option is available. (Access for DB2 only.)

Maximum Fetch Rows

Defines the maximum number of rows that can be accessed from any one table displayed during Point-and-Shoot or browse. The value can be from 1 to the site-defined maximum. The figure shows the distributed default maximum, 500 rows. Since the default maximum is site-defined, the value may be different at your site. The MAXIMUM FETCH ROWS command can be used during the session to modify this value for only the current session. This command takes effect immediately and all data is refetched.

Display Column Attributes

Specifies whether the column attributes or type, dimension and nullability are displayed. For column display, the attributes are displayed directly below the column heading for each column. For sidelabels display, the attributes are displayed to the left of the column heading. Specify: Yes

Attributes displayed.

No

Attributes not displayed.

The ATTRIBUTES command can be used during the session to specify whether or not column attributes are displayed. Display Data in Hex

Specifies whether character data is displayed only in 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 requires three display lines: one for character text and two for the corresponding hexadecimal values. The HEX command can be used during the session to specify whether or not the hexadecimal format is

454

Move for DB2

6.2 Editor and Display Options displayed. Editor Display Format

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 with column headings above each column of data are displayed. For sidelabels format, a single row of data with column headings to the left of each column of data is displayed. The SIDELABELS command can be used during the session to toggle the display between columnar and sidelabel. Columnar Max Display Width

Defines the maximum number of characters that are displayed for each column of a columnar display format. This only affects the data display during a Point-and-Shoot or browse session. The value can be from 15 to 70. This value does not affect the actual width of the column. If, however, this value is less than the total length for the column, that column display is truncated. This has no impact on sidelabels display.

Sidelabels Max Display Width

Defines the maximum number of characters that are displayed for each column of a sidelabel display format. This only affects the data display during a Point-and-Shoot or browse session. The value can be from 50 to 32768. This value does not affect the actual length of the column. If, however, this value is less than the total length for the column, that column display is truncated. This has no impact on columnar display.

User Supplies Defaults

User Manual

Specifies the default handling of columns defined by DB2 as columns that cannot have default values when inserting a row. (Access for DB2 only.)

455

6. Specify Options

NULL as Insert Default

Specifies the default handling of nullable columns if these columns are blank when inserting a row. (Access for DB2 only.)

Editor Exit Processing

Specifies the behavior when END is used to terminate an edit or browse session. Specify:

ENTER Exits Criteria Panels

456

E

The panel from which the session was invoked is displayed. This may be the Describe Columns panel, Specify Selection Criteria panel, or the SQL WHERE Clause panel.

P

The prompt panel from which the session was initiated is displayed. This may be a Choose panel or a selection list of tables or Access Definitions.

Specifies when the ENTER key can be used to exit the Specify Selection Criteria panel, the SQL WHERE Clause panel, and the Describe Columns panel during a browse session. Specify: A

The ENTER key acts as the same as the END key (usually PF3) and always exits the panel unless errors are detected. Default.

N

Only the END key exits the panel. The ENTER key never exits the panel.

U

The ENTER key exits the panel only when the values on the panel are not changed. If values are changed, only the END key exits the panel.

Move for DB2

6.2 Editor and Display Options AutoSwitch Mode

Specifies whether AutoSwitch mode is enabled for multi-way joining during a browse session. By default, when a parent table is scrolled, the currently displayed child table is also scrolled. Sometimes when scrolling, the child table has no related rows to display. AutoSwitch mode is useful when scrolling a parent table that is joined to two or more children in a stack. When the parent table is scrolled and the currently displayed child table has no related rows, AutoSwitch mode automatically displays the first child table in the stack that has at least one related row. Specify:

Single View Mode

Y

Enable AutoSwitch mode.

N

Disable AutoSwitch mode. (The child table is not switched.) Default.

Specifies whether views can be joined when browsing data. Specify: Y

Views cannot be joined. Single view mode is in effect.

N

Views can be joined. Default.

Browsing views is faster and more efficient using single view mode because the relationship information is bypassed. However, if related data is to be displayed simultaneously, joining is required. This option disables the Join Facility when the Start Table is a view. It cannot be modified from an editor session.

User Manual

457

6.3 Job Card and Print Options

6.3 Job Card and Print Options The Job Card and Print Options determine several user-specific parameters that govern batch execution. When you select Option 3 from the Choose Option Type menu or when you specify Yes to the Review Job Card prompt on the User Options panel, the following panel is displayed. The information displayed on the panel is initially set to the user-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 If Dataset: DSN ===> PST.PRINT Disposition ===> If SYSOUT: SYSOUT Class ===> Destination ===> Hold ===>

D-Dataset, S-SYSOUT M * LOCAL Y

M-MOD, O-OLD A - Z, 0 - 9, * Y-Yes, N-No

Prompt for Changes Before JOB Submission ===>

Y-Yes, N-No

Figure 219. Job Card and Print Options Panel Fields

JOB Statement

A 66-character wide area to provide the default job statement. Five lines are provided. The first line must contain a line in the form: //name JOB where name is the job name.

Report Type

User Manual

Specify the type of report output to be generated. Specify: Dataset

Report is placed in a data set.

SYSOUT

Report is placed in SYSOUT.

458

6.3 Job Card and Print Options

If Data Set:

If SYSOUT:

DSN

Name of the data set to receive the report. This must be a sequential file.

Disposition

Disposition of the data set. Specify:

SYSOUT CLASS

MOD

Append to existing data.

OLD

Replace existing data.

Specify the SYSOUT class as one of the following: 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 is held. Specify: YES

SYSOUT file is held for online viewing.

NO

SYSOUT file is available for printing when execution is complete.

If not specified, the site default specification is used. Prompt for Job Card Changes

Job Card Profiled

User Manual

Specify whether or not the Job Card information is displayed each time you submit a batch request to MOVE. When displayed, you can change the job card information before MOVE generates the complete JCL to execute your request. You can request a modifiable display of the complete JCL prior to any batch job submission.

The Job Card information is profiled. If there is no profiled information, the Job Card is filled in with the ISPF variables, ZLLGJOB1 through ZLLGJOB4, from ISPF option 0.2 LOG AND LIST DEFAULTS. (Note if the information profiled exceeds the display width of 66 characters, it is truncated.) Use the RESET command to reset the Job Card to these original values.

459

7. Batch Maintenance Utilities Batch utilities help you maintain the Relational Tools environment. These utilities are an efficient means of monitoring the usage of PST objects to ensure maximum benefit from the Relational Tool. For example, if a database table is removed or renamed, you can use a batch utility to generate an impact analysis report of PST objects that reference the table or column. The report can be a useful tool to help you decide whether to remove and replace, or edit the affected PST objects. If you decide to remove the objects, another batch utility allows you to delete the same PST objects from the Directory simply by changing the command verb in the control statement from DIRECTORY to DELETE. You can also use the utilities to audit compliance with naming standards for PST objects or review ownership of the objects. Batch utilities also automate certain online functions such as, copying PST objects in a Directory and migrating PST objects across Directories. Categories of batch maintenance utilities are:

User Manual



Utilities to retrieve information from the Princeton Softech Directory.



Utilities to maintain PST objects in the Directory.



Utilities to migrate PST objects.

460

7. Batch Maintenance Utilities JCL Requirements

The JCL needed to migrate PST objects is described in Section 7.3 Utilities to Migrate PST Objects. The JCL needed to execute utilities for information retrieval and Directory maintenance is: // EXEC // //SYSPRINT //SYSTERM //PDPDDFLT //PSTRACE //PSDFASUM //PSDFADIR //PSDFAREP //SYSIN

PGM=PDPMMAIN,REGION=0M, PARM=' CON UTILITY subsys planname sqlid userid ' DD SYSOUT=* DD SYSOUT=* DEFAULT SITE OPTIONS DD DSN=your.loadlib.(PDPDDFLT) DD SYSOUT=* SUMMARY LISTING FILE DD SYSOUT=* DIRECTORY LISTING FILE DD SYSOUT=* REPORT LISTING FILE DD SYSOUT=* DD * control statements

/*

A sample of this JCL is provided in the install library as member JCLOBUTL. To use a custom module for default site options, replace "PDPDDFLT" with the name of the data set for the module. To direct listings for PSDFASUM, PSDFADIR, or PSDFAREP to a data set, rather than to SYSOUT, define attributes of the data set as: RECFM=F or FB LRECL=132

Also, block size must be a multiple of 132. The data set may be sequential or partitioned. Note that, unlike a listing directed to SYSOUT, there is no carriage control byte before each line. Error Codes

If no errors are found during the run, the return code is 0. If errors are found, the return code is 12.

Control Statements

Insert control statements for the functions after the SYSIN DD * statement. Available control statements and their functions include the PAGESIZE, ERROR, and OUTDD statements, which affect the execution of other control statements. They are discussed in detail in Section 7.4 General Batch Control Statements. The remaining control statements, grouped according to function, are discussed on the following pages of this section.

User Manual

461

7. Batch Maintenance Utilities Informational

DIRECTORY

A DIRECTORY statement generates a listing of PST objects that are in the Directory.

Maintenance – PST Objects and Archive Entries

DELETE

A DELETE statement removes PST objects from the Directory.

RENAME

A RENAME statement changes the name of a PST object in the Directory and generates a report about the renamed objects.

COPY

A COPY statement reproduces PST objects, names the new objects, and generates a report about the copied objects.

Control Statement Format

User Manual

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 items in the list with commas. Blanks after a comma are optional.



Continue a statement on another line by breaking the statement with a blank after an operand and entering the next operand on the new line. End-statement or continuation indicators are not needed; a valid command verb, such as DELETE or DIRECTORY, ends a control statement and begins the next.



Indicate a comment line by placing hyphens or minus signs, in columns 1 and 2. Single hyphens or hyphens in other columns do not indicate a comment.



Be certain a keyword is appropriate for the specified TYPE. Using a TYPE-specific keyword with an inappropriate TYPE causes an error condition.

462

7. Batch Maintenance Utilities The syntax used on the following pages to describe the control statements is:

User Manual

KEYWORD(S)

A keyword is shown in uppercase. Generally, you must provide a keyword as shown. However, the portion of a keyword in parentheses is optional.

text

Variable text is shown in lowercase italics.

()

A series is shown in parentheses. You must use parentheses as a delimiter, even if using a single parameter in the series. For example, (text1, text2, …) or (KEYWORD1 text1, KEYWORD2 text2,…).

[]

Options are shown in square brackets.

{}

A choice is shown in curved brackets. You must use one of the parameters indicated as a choice.

|

The "|" separates choices shown in curved brackets.

463

7. Batch Maintenance Utilities

7.1 Informational Control Statements DIRECTORY Statement The DIRECTORY, or DIR, statement is the only informational control statement available to MOVE. Use the Directory statement to generate a report of objects in the Directory. Such a report can be useful to determine if, for example, any Column Maps are affected by changes to a database 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 the keywords and operand values you specify. If you include multiple DIRECTORY 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 the DIRECTORY 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 } ]

464

Move for DB2

7.1 Informational Control Statements The keywords and values for operands are: Required Criteria Keywords

TYPE

NAME

Type of objects to list. This keyword must be included in the DIRECTORY statement with one of the following: AD

List all Access Definitions that match the criteria.

CM

List all Column Maps that match the criteria.

TM

List all Table Maps that match the criteria.

R

List all Relationships that match the criteria.

PK

List all Primary Keys that match the criteria.

CD

List all Compare Definitions that match the criteria.

Name of one or more objects. This keyword and the name operand must be included in the DIRECTORY statement. name

Specify as an explicit value or a pattern, using SQL LIKE syntax.

Optional Criteria Keywords:

Use the following keywords to further refine the criteria for objects to be listed.

– For All PST Objects

MODIFIEDBY TSO ID of the last person to modify the objects. modifiedby Specify as an explicit value or a pattern, using SQL LIKE syntax. DESC

Case-sensitive descriptive information for the objects. desc

User Manual

Specify as an explicit value or a pattern, using SQL LIKE syntax. Delimit values that include blanks in single (') or double (") quotes.

465

7. Batch Maintenance Utilities TABLE

Name of a table referenced in objects to be listed. cid.tblname Indicate the table name. Prefix with Creator ID, if needed to identify the table. Specify as an explicit value or a pattern, ending with %.

– For Access Definitions or Compare Definitions

DSNAME

Data set name referenced in listed objects. The referenced data set may be a Point-and-Shoot File, a Compare File, an Extract File, or an Archive File. Use this keyword only if TYPE is AD or CD. dsname

– For Access Definitions Only

PNS

Specify the fully qualified data set name, without quotes, as an explicit value or a pattern, ending with %.

Point-and-Shoot attributes for the Access Definitions to be listed. Use PNS only if TYPE is AD. NO

List Access Definitions without regard to the Point-and-Shoot Start Table option.

YES

List only Access Definitions that use the Point-and-Shoot Start Table option.

If you do not use the PNS keyword, Access Definitions are listed without regard to Point-andShoot attributes. ARC

Archive criteria attributes for the Access Definitions to be listed. Use this keyword only if TYPE is AD. NO

List Access Definitions without regard to archive criteria.

YES

List only Access Definitions for which archive criteria are specified.

If you do not use the ARC keyword, Access Definitions are listed without regard to archive criteria.

466

Move for DB2

7.1 Informational Control Statements – For Primary Keys or Relationships

DB2

Type of primary keys or relationships to be listed. Use this keyword only if TYPE is R or PK. NO

List only PST primary keys or relationships.

YES

List PST and DB2 primary keys or relationships.

If you do not use the DB2 keyword, only PST primary keys or relationships are listed. – For Access Definitions, Primary Keys or Relationships

GENERIC Generic attributes of objects to list. Use this keyword only if TYPE is AD, PK, or R. NO

List objects without regard to generic attributes or references.

YES

List only generic primary keys, generic relationships, or Access Definitions that reference generic relationships.

If you do not use the GENERIC keyword, Access Definitions, primary keys, or relationships are listed without regard to generic attributes. Report Formatting Keywords

Use the following optional keywords to format the Directory Report. SORT

The sequence for list of objects in the report. If you do not specify a SORT keyword, the items are listed in ascending order, by name. NAME

DESC

In order by name. NAME is the default. In ascending order. A is the default. A D In descending order. In order by description. A D

DATE

In order by date modified. A D

User Manual

In ascending order. A is the default. In descending order.

In ascending order. A is the default. In descending order.

467

7. Batch Maintenance Utilities MODIFIEDBY

– For Detailed List

In order by TSO ID of the user that last modified the object. A

In ascending order. A is the default.

D

In descending order.

DETAIL The level of detail in the report. NO

Report includes only Name, Description, Owner, Last Modified Date, and (if activated for site) Security Status for each listed object. This is also the information provided if you do not use the DETAIL keyword.

YES

Report includes Name, Description, Owner, Creation or Last Modified Date, and Security Status for each listed object. The report also includes the following information, according to the type of object listed: AD

− − − − −

468

Default Creator ID Start Table name Table List Relationship Usage information Column information (Optional, see PRINTCOL keyword, on page 469.)

Move for DB2

7.1 Informational Control Statements CM

− − − −

TM

− − − − − −

R(PST)

− −

R(DB2)

− − −

Source File name Source Table name with column names and data types Destination Table name with column names and data types Status of mapping for each column Source Creator ID Source Table names Destination Creator ID Destination Table names Column Map Creator ID Column Map Names Parent Table name with column names and data types Child Table name with column names and data types 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 this keyword only if TYPE is AD and DETAIL is YES.

User Manual

ALL

List all information for each Access Definition, as described on page 468, and include all column names and criteria information.

NONE

List all information for each Access Definition except column information.

469

7. Batch Maintenance Utilities SEL

List all information for each Access Definition, but limit column information to columns with selection criteria.

ARC

List all information for each Access Definition, but limit column information to columns with archive criteria.

If you do not use the PRINTCOL keyword, detailed listings of Access Definitions have no column information. NEWPAGE Page break processing for the report. Use this keyword only if DETAIL is YES.

Examples

NO

Begin a new page on the basis of the PAGESIZE specification or default only. (See page 482 for an explanation of the PAGESIZE statement.)

YES

In addition to normal page breaks, begin a new page 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 and include information about tables referenced in each Access Definition, specify: DIR TYPE AD NAME PSTDEMO.% PNS DETAIL 3. To create a listing of all Access Definitions that refer to the table CUSTOMERS, specify: DIRECTORY TYPE AD NAME % TABLE CUSTOMERS

470

Move for DB2

7.2 Utilities to Maintain PST Objects

7.2 Utilities to Maintain PST Objects The Directory contains PST objects such as Access Definitions, Table Maps, Column Maps, PST Primary Keys and Relationships, and Compare Definitions. You can use a batch utility to copy, for example, Access Definitions modified by a specific user – creating a set of identical Access Definitions with different names. Other batch utilities allow you to delete or rename PST objects. Control statements that can be used to maintain objects in the Directory and 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 the Directory.

DELETE Statement Use a DELETE statement to remove one or more Access Definitions, Column Maps, Table Maps, Primary Keys, or Compare Definitions from the Directory. For example, PST objects exported to a Directory in a different subsystem can be deleted from the original Directory. The PST objects to be removed are selected according to keywords and values specified as operands. Delete Statement for PST Objects To delete PST objects, use the DELETE statement syntax as follows: DELETE TYPE { AD | CM | TM | R | PK | CD } NAME name [ MODIFIEDBY modifiedby ] [ DESC desc ]

The NAME, MODIFIEDBY, and DESC keywords and operands are identical to those in the DIRECTORY statement. You can use these keywords and operands in a DIRECTORY statement to list and review candidates for deletion before submitting a job with the same keywords and operands in a DELETE statement.

User Manual

471

7. Batch Maintenance Utilities Required Criteria Keywords

TYPE

NAME

Type of PST objects to be deleted. This keyword must be included in the DELETE statement with one of the following: AD

Delete all Access Definitions that match the criteria.

CM

Delete all Column Maps that match the criteria.

TM

Delete all Table Maps that match the criteria.

R

Delete all PST Relationships that match the criteria.

PK

Delete all PST Primary Keys that match the criteria.

CD

Delete all Compare Definitions that match the criteria.

Name of one or more PST objects. This keyword and the name operand must be included in the DELETE statement. name

Optional Criteria Keywords:

Specify as an explicit value or a pattern, using SQL LIKE syntax.

Use the following keywords as necessary to further refine the criteria for objects 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 PST objects to be deleted. desc

472

Specify as an explicit value or a pattern, using SQL LIKE syntax. Delimit values that include blanks in single (') or double (") quotes.

Move for DB2

7.2 Utilities to Maintain PST Objects Example

The following is an example of DELETE statement usage for PST objects: 1. To delete Column Maps with names that are prefixed with PSTDEMO, specify: DELETE TYPE CM NAME PSTDEMO.%

COPY Statement Use a COPY statement to create one or more PST objects that are exactly like specified existing objects, but have different names. The COPY statement also generates a report of the new objects in the Directory listing file. COPY TYPE { AD | CM | TM | R | PK | CD } FROM objectname TO objectname [ MODIFIEDBY modifiedby ] [ DESC desc ] [ REPLACE { NO | YES } ]

The keywords and operands in the COPY statement are: Required Criteria Keywords

User Manual

TYPE

Type of objects to be copied. This keyword must be included in the COPY statement with one of the following: AD

Copy all Access Definitions that match other criteria.

CM

Copy all Column Maps that match other criteria.

TM

Copy all Table Maps that match other criteria.

R

Copy all PST Relationships that match other criteria.

PK

Copy all PST Primary Keys that match other criteria.

CD

Copy all Compare Definitions that match other criteria.

473

7. Batch Maintenance Utilities FROM

Name of source objects to be copied. This keyword and objectname must be included in the COPY statement. objectname Specify as an explicit value or a pattern, using SQL LIKE syntax. An ERROR condition occurs if a matching object is not in the Directory.

TO

Name of new objects. This keyword and objectname must be included in the COPY statement. objectname Specify as an explicit value or a pattern, using SQL LIKE syntax.

Optional Criteria Keywords

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 PST objects. desc

Optional Replace Keyword

REPLACE

Specify as an explicit value or a pattern, using SQL LIKE syntax. Delimit values that include blanks in single (') or double (") quotes.

Action taken when the name of a new object (taken from the objectname operand for the TO keyword) matches the name of an existing object in the Directory. NO

Do not reproduce.

YES

Reproduce the object and replace the preexisting object with the same name.

If you do not use the REPLACE keyword, existing objects are retained. Examples

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 with matching names, specify: COPY TYPE CM FROM PSTDEMO.% TO PSTPROD.% REPLACE YES

474

Move for DB2

7.2 Utilities to Maintain PST Objects 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 PST objects and generate a report of the renamed objects in the Directory listing file. Security requirements are the same as those for the online Rename function. RENAME TYPE { AD | CM | TM | R | PK | CD } FROM objectname TO objectname [ MODIFIEDBY modifiedby ] [ DESC desc ] [ REPLACE { NO | YES } ]

The keywords and operands in the RENAME statement are: Required Criteria Keywords

User Manual

TYPE

Type of objects to rename. This keyword must be included in the RENAME statement with one of the following: AD

Rename all Access Definitions that match the criteria.

CM

Rename all Column Maps that match the criteria.

TM

Rename all Table Maps that match the criteria.

R

Rename all PST Relationships that match the criteria.

PK

Rename all PST Primary Keys that match the criteria.

CD

Rename all Compare Definitions that match the criteria.

475

7. Batch Maintenance Utilities FROM

Name of source objects to rename. This keyword and the objectname operand must be included in the RENAME statement. objectname Specify as an explicit value or a pattern, using SQL LIKE syntax. An ERROR condition occurs if the indicated objects are not in the Directory.

TO

Name of objects after renaming. This keyword and the objectname keyword must be included in the RENAME statement. objectname Specify as an explicit value or a pattern, using SQL LIKE syntax.

Optional Criteria Keywords

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 PST objects. desc

Optional Replace Keyword

REPLACE

Specify as an explicit value or a pattern, using SQL LIKE syntax. Delimit values that include blanks in single (') or double (") quotes.

Action taken when the name of a new object (taken from the objectname operand for the TO keyword) matches the name of an existing object in the Directory. NO

Do not rename.

YES

Rename the source object and replace the similarly named existing object.

If you do not use the REPLACE keyword, existing objects are retained. Examples

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 with matching names, specify: RENAME TYPE CM FROM PSTDEMO.% TO PSTPROD.% REPLACE YES

476

Move for DB2

7.2 Utilities to Maintain PST Objects 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

User Manual

477

7. Batch Maintenance Utilities

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 import objects in batch or online. Batch execution is documented in this section. (See Section 4.5 Export and Import Processes for information about online execution.) Batch processing allows you to migrate entire Directories, which can be useful when setting up a new subsystem. The online processes may be more useful when migrating small groups of objects. You can also create a file of PST objects independently and use Import batch processing to load the objects. (The format of the objects is discussed in Section 4.5.3 File Format.) JCL Requirements

The JCL needed to export or import PST objects is somewhat different from the JCL needed for other batch processes. For this reason, JCL requirements are discussed with both the batch Export Utility and the batch Import Utility.

Batch Export Utility The JCL needed to export PST objects is: // EXEC // //SYSPRINT //SYSTERM //PDPDDFLT //PSTRACE //PSDFRPRT //PSDFEXPT //SYSIN

PGM=PDPMMAIN,REGION=0M, PARM=' CON OBJEXP subsys planname sqlid userid ' DD SYSOUT=* DD SYSOUT=* DD SYSOUT=* DD SYSOUT=* DD SYSOUT=* EXPORT OR IMPORT REPORT DD SYSOUT=* FILE DD* DSN=* EXPORT DEFINITIONS FILE control statements

/*

A sample of this JCL is provided in the install library, as member JCLEXP. You can copy this JCL and modify it as needed. Define a data set for PSDFRPRT listings in the same manner as for the other utilities. Error codes are the same as for the other batch utilities.

478

Move for DB2

7.3 Utilities to Migrate PST Objects Control Statements

Insert control statements for functions after the SYSIN DD* statement. Export control statements and their functions are: SUBDEF

A SUBDEF statement determines whether objects subordinate to those specified in subsequent EXPORT statements are also exported.

EXPORT

An EXPORT statement specifies the objects that are copied from the Directory to a file.

SUBDEF Statement A SUBDEF statement determines whether PST objects subordinate to those specified in subsequent EXPORT statements are exported. For example, referenced relationships are subordinate to an Access Definition or Column Maps are subordinate to a Table Map. SUBDEF { NO | YES }

Each SUBDEF statement remains in effect until another SUBDEF statement is encountered in the JCL. Keywords in the SUBDEF statement are: NO

Do not export subordinate objects. NO is the default setting.

YES

Export subordinate objects.

EXPORT Statement Use an EXPORT statement to select PST objects in the Directory, by type and name of object, and copy the objects to a file. Any number of EXPORT statements may be used; objects are copied to the file in the order specified. EXPORT { ALL | PK | R | CM | TM | AD | CD } objectname

To be exported, an object must satisfy criteria described by the selected keyword and objectname operand: Required Criteria Keyword

User Manual

ALL PK R CM TM AD CD

All PST objects Primary Keys Relationships Column Maps Table Maps Access Definitions Compare Definitions

479

7. Batch Maintenance Utilities objectname

Examples

Specify as an explicit value or a pattern, using SQL LIKE syntax. A value or wild card for every segment 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" with the subordinate relationships and all Access Definitions for the user, Smith, in groups that begin with PST, without the subordinate relationships, specify: SUBDEF YES EXPORT AD PSTDEMO.%.% SUBDEF NO EXPORT AD PST%.SMITH.% 4. To export all Access Definitions, specify: EXPORT AD %.%.%

Batch Import Utility The JCL needed to import PST objects is: // EXEC // //SYSPRINT //SYSTERM //PDPDDFLT //PSTRACE //PSDFRPRT //PSDFIMPT //SYSIN

PGM=PDPMMAIN,REGION=0M, PARM=' CON OBJIMP subsys planname sqlid userid ' DD SYSOUT=* DD SYSOUT=* DD SYSOUT=* DD SYSOUT=* DD SYSOUT=* EXPORT OR IMPORT REPORT DD SYSOUT=* FILE DD* DSN=* DEFINITIONS DATA SET control statements

/*

A sample of this JCL is provided in the install library, as member JCLIMP. You can copy this JCL and modify it as needed. Define a data set for PSDFRPRT listings in the same manner as for the other utilities. Error codes are the same as for the other batch utilities.

480

Move for DB2

7.3 Utilities to Migrate PST Objects Control Statements

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 are copied (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 statements may 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: Required Criteria Keyword

TYPE

The type of object to import. ALL PK R CM TM AD CD

Option Replace Keyword

OVERWRITE

All PST objects Primary Keys Relationships Column Maps Table Maps Access Definitions Compare Definitions

Action taken if a specified object exists. NO

Do not replace an existing object; handle as an error.

YES

Replace existing object.

If you do not use the OVERWRITE keyword, an existing object is not replaced and an error is caused. Example

To import all primary keys with the Creator ID "PSTDEMO" and replace any primary keys with the same name: TYPE PK OVERWRITE YES

User Manual

481

7. Batch Maintenance Utilities

7.4 General Batch Control Statements Several general control statements apply during the execution of the batch maintenance utilities. The following control statements can be placed anywhere among the other control statements: PAGESIZE

A PAGESIZE statement governs the number of lines per page.

ERROR

An ERROR statement governs the handling of error conditions that may occur during a run.

OUTDD

An OUTDD statement indicates the DDNAME for the Directory listing data set. (The default DDNAME for a Directory listing file, used if no OUTDD 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 is encountered. The default operand for a PAGESIZE statement is 56; if no PAGESIZE statement applies, the page size is 56 lines plus top and bottom margins. The following is an example of a PAGESIZE statement: PAGESIZE 75

ERROR Statement An ERROR statement governs the handling of error conditions during a run. ERROR { STOP | CONT }

Each ERROR statement applies until another ERROR statement is found. Keywords for an ERROR statement are: STOP

Halt the run if an error occurs.

CONT

Continue the run, executing the next control statement, regardless of errors.

If you do not provide an error statement, the run stops when an error occurs.

482

Move for DB2

7.4 General Batch Control Statements

OUTDD Statement An OUTDD statement indicates the DDNAME for the Directory listing data set. OUTDD ddname

Each OUTDD statement applies until another OUTDD statement is encountered. The following is an example of an OUTDD statement used to direct output to the data set corresponding to the DDNAME ADREPT: OUTDD ADREPT If you do not provide an OUTDD statement, the default DDNAME, PSDFADIR, is used.

User Manual

483

A. Main Menu Variations The Main Menu display varies based on which of the Relational Tools components are installed and whether remote access is to be available. MOVE only

The following figure displays the Main Menu when only MOVE is installed. 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 X

TUTORIAL EXIT

- Information About MOVE for DB2 - Terminate MOVE for DB2

Figure 220. Main Menu - Move Only

User Manual

485

A. Main Menu Variations

Remote Access

When remote access is available, the LOCATION field is provided for 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 X

TUTORIAL EXIT

- Information About MOVE for DB2 - Terminate MOVE for DB2

Figure 221. Main Menu - Remote Access

486

Move for DB2

B. Allocating External Files MOVE processing requires several types of files: Point-and-Shoot Extract Control OUTPUT Output SQL Extract Browse Export Process Report MOVE automatically prompts for allocation information for these external files when they do not exist. To allocate these files, MOVE prompts for the necessary information. Some of the values, based on the type of file to be allocated, are required as specified and cannot be changed. The following figure shows all of the prompts for non-SMS data sets. The chart on page 491 details the values for each prompt for each type of external file.

----------------------------- Allocate Dataset ------------------------Data Set Name: Z13600MP.TEST.DSN Volume Serial Generic Unit Space Units Primary Quantity Secondary Quantity Directory Blocks Record Format Record Length Block Size

===> ===> : BLKS ===> 5 ===> 2 ===> ===> ===> ===>

(Blank for Authorized Default Volume) (Generic Group Name or Unit Address) (In 8KB BLKS) (In Above Units) (In Above Units) (Zero for Sequential Data Sets) (F, FB, FS, V or VB)

* *

(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

User Manual

487

B. Allocating External Files Panel fields

Volume Serial

The volume serial number of the volume on which the dataset is to reside. Leave this field blank to use the default volume for which you are authorized. This value must contain only alphanumerics, national characters, and the hyphen. The value for volume serial number is mutually exclusive with Generic Unit.

Generic Unit

The generic unit name or unit address of the device on which the dataset is to reside. Leave this field blank, to use the default generic volume. This value must contain only alphanumeric characters. This value is mutually exclusive with Volume Serial.

Space Units

Specify the DASD space for the dataset to be allocated as: BLKS

Blocks (abbreviations: BLK or B).

TRKS

Tracks (abbreviations: TRK or T).

CYLS

Cylinders (abbreviations: CYL or C).

When MOVE provides the suggested sizes, this field is BLKS. If the user is supplying the value, select one. Site management may have guidelines regarding which to use.

488

Primary Quantity

Specify the primary quantity of space to be allocated in the indicated space units. Site management may have guidelines regarding appropriate values.

Secondary Quantity

Specify the secondary quantity of space to be allocated in the indicated space units. Site management may have guidelines.

Directory Blocks

Specify the number of directory blocks to be allocated. This value is required for partitioned data sets and should be 0 for sequential data sets. Site management may have guidelines.

Move for DB2

B. Allocating External Files Record Format

Specify record format as F, FB, FS, or VB. This value must be FS for sequential data sets created for Extract Files and Control Files. When directing browsed output to a dataset using the OUTPUT command, the record format 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. When directing browsed output to a dataset using the OUTPUT command, the record length must be 80. Site management may have guidelines for allocating other datasets.

Block Size

Specify the block size in bytes. Note requirements in the accompanying chart for default values. If you specify the default of 0 as the BLKSIZE for the Extract and Control Files and for the file being browsed, the actual value will be calculated at run time. Site management may have guidelines.

User Manual

489

B. Allocating External Files Calculated Values Shown, Change to Profiled Values

Specify whether you want to allocate the file using the values calculated by MOVE or the values you explicitly specified. The userspecified values are profiled. Specify: Y

User values previously specified and profiled are to be used. Also, if you have modified the values on this panel, they are profiled and replace any previously specified values.

N

The values calculated by MOVE are to be used.

These values are calculated based on the “worst case”. For example, for an Extract File, the value is determined by the maximum number of rows that can be extracted times the length of the longest row. Reasonable primary and secondary extents are also calculated from this value. The Control File is calculated based on the size of the Extract File. Any unused space is freed when the process using the data set is complete.

SMS Considerations

If Managed Data Support is present for the underlying operating environment, the panel contains the prompts necessary for SMS data set creation. Extract Files and Control Files must be physical sequential. They cannot be extended format data sets.

490

Move for DB2

B. Allocating External Files Defaults for Specific Files

Each external file type has defaults. The chart lists the files. The modifiable defaults are shown in italics. The other values cannot be modified. External File

DSORG SEQ

Extract/ Control

Dir Blks 0

RECFM

LRECL

BLKSIZE

FS

0

LRECL = BLKSIZE; minimum is 2048, maximum is 9999 (This value is based on the number of columns.)

Point-andShoot/ Export/ Output SQL

SEQ/PDS*

0

FB/F*

80

3200

If RECFM=F, BLKSIZE=80 and BLKSIZE=LRECLBrowsed File

SEQ

0

VB

0

0

BLKSIZE=LRECL+1;min LRECL=84, BLKSIZE=88 Process Report Output

SEQ

0

FB

80

3200

BLKSIZE=multiple of LRECL

About Point-andShoot File

The Point-and-Shoot file, by default, is allocated as a sequential file with a RECFM of FB. You may allocate this file as a member of a PDS and specify a value other than 0 for directory blocks. If you specify the RECFM as F, the BLKSIZE must be 80. For more detailed information on these fields, refer to the IBM Job Control Language documentation applicable to your operating system.

Extract File

If you are transferring an Extract File from OS/2, you must allocate a file that physically matches the characteristics used in creating the file. Specifically, the DCB parameters should be: BLKSIZE=7476 LRECL=7476 RECFM=FS DSORG=PS Also, when copying the file to the MVS machine, make sure that it is transferred in Binary (not Text) format and that no carriage returns or line feeds are inserted in the data. For example, the CRLF option of some terminal emulators should not be used.

User Manual

491

B. Allocating External Files

492

Move for DB2

C. Exit Routines for Column Maps Column Maps allow you to specify the source data for each destination column. User exits are supported when defining Column Maps to allow you to set values for columns in the destination table that could not be established otherwise. Exits can be used to:

Requirements

User Manual



Perform data transformations that are beyond the scope of Column Maps. For example, an exit can change an employee department number for selected rows based on some complex algorithm.



Mask confidential information. For example, an exit can change an employee name or salary information on selected rows.



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 or C (using the SAS/C compiler with a _dynamn entry).



The exit must be reentrant and must be available to all MOVE online and batch processes using the Column Map.



Each exit must be compiled and linked as a separate load module. This load module is loaded dynamically at execution time.



The exit must set the value in the destination column.



If the exit accesses DB2, the DBRM for that exit program must be bound into the Relational Tools plan.

493

C. Exit Routines for Column Maps Parameters

The exit is called for each row in the mapped table. The following parameters are passed with every call: •

A structure containing the following: Information

Data Type

DB2 subsystem name User's primary SQLID Current SQLID Source table Creator ID Source table name Destination table Creator ID Destination table name Destination column identifier

CHAR(4) CHAR(8) CHAR(8) CHAR(8) VARCHAR(18) CHAR(8) VARCHAR(18) SMALL INT

The Destination column identifier is the subscript of the SQLVAR entry for the column in the destination SQLDA. The first 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 is described 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 zeros for the first call to the exit and will be unchanged for later calls. This area is used to pass information from one call to another, serve as a save area, and so forth. A separate work area is provided for each column even when multiple columns use the same exit.

Avoiding Overhead

Since the exit may be called frequently, avoid unnecessary overhead. For example, the exit should perform initialization processing in the first call and save information for subsequent calls in the work area. Also, there may be significant overhead when the PL/I runtime environment is established. To avoid this, write the exits in Assembler, SAS/C, or COBOL. (For COBOL, MOVE creates the runtime environment only once if there are any COBOL II exits.)

Setting Destination Values

When the exit is called, all destination and source columns are available except those destination columns that are yet to be assigned a value by an exit. To set the value in the destination column, the exit can examine data in the source row or the data in other columns in the destination row.

494

Move for DB2

C. Exit Routines for Column Maps The exit is passed a copy of the destination row. The value for the destination column supplied by the exit is moved back into the actual row used by MOVE. Thus, an exit can only set a value in the column that was specified. The exit must adhere to the following:

Special Registers



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 column allows nulls.



MOVE uses the primary key information to build internal work areas. Any exit that assigns a value to a column that is part of the primary key must ensure that it generates the same output value if it is called multiple times with the same source row.

The destination columns which use the CURRENT DATE or CURRENT_DATE, CURRENT TIME or CURRENT_TIME, or CURRENT TIMESTAMP or CURRENT_TIMESTAMP special registers are assigned values by DB2. These columns are marked in the SQLDATA field as: Special Register

SQLDATA Value

CURRENT DATE CURRENT_DATE

-2

CURRENT TIME CURRENT_TIME

-1

CURRENT TIMESTAMP CURRENT_TIMESTAMP

-3

Special processing is provided for DATE, TIME, and TIMESTAMP destination columns which are marked as NOT NULL WITH DEFAULT when the mapped source column is NULL. For these columns, the SQLDATA field is set to -4. Note these special values only affect destination columns assigned values by MOVE, not those assigned values by an exit. Return Codes

The exit must set one of the following return codes: Return Code

User Manual

Meaning

0

Destination column has been assigned a value.

4

Destination column can not be assigned a value and the row should be discarded.

8

Fatal error. Terminate execution. To return an error message, place the message in the work area and set 495

C. Exit Routines for Column Maps the unused space to blanks or null. Termination Call

A termination call is made to the exit after all destination table processing is completed. The call is identified by a value of 0 in the destination column identifier field. The exit can use this call to clean up any dynamically acquired storage.

Sample Exits

Sample exits are included with MOVE. They illustrate how to use the data areas available to the exit and the type of processing that can be accomplished using an exit. These exits are distributed on the MOVE installation tape. The source is available on the Installation Library. PSRTEXTA and PSRTEY2K are available as load modules on the product load library. PSRTEXTA

An Assembler exit which assigns a sequential value to a column for each row in the destination table. This can be used to mask sensitive information. The results are similar to those achieved by using the SEQ function in a Column Map but the exit can be used to as an example of exit processing in Assembler.

PSRTEXTC

A COBOL exit which performs two operations on the CUSTOMERS table distributed with MOVE. First, it filters rows processed by MOVE such that any row with a value of 0 in the YTD_SALES column is discarded. Second, it changes the SALESMAN_ID column for the customers in Florida.

PSRTEY2K

An Assembler exit which sets the year portion of DATE or TIMESTAMP columns to 2000. This is useful for generating test data to ensure that applications are year 2000 compliant. When specified as an exit for a destination column, PSRTEY2K locates the source column with the same name as the destination column. If the source column is not null, the value is changed to the year 2000 before inserting it at the destination. If the source is a DATE data type and the destination is a TIMESTAMP, “00.00.000000” is added to the time value. If the source is a TIMESTAMP and the destination is a DATE, only the date portion is inserted. If the source column is NULL and the destination is nullable, the destination is set to NULL. If the destination is not nullable, “2000-01-01” is inserted into a DATE column and “2000-01-01-00.00.000000” is inserted into a TIMESTAMP column.

For more details on these sample exits, consult the program source.

496

Move for DB2

D. Creating a Row List File The Point-and-Shoot facility is used to specify the primary key values for the Start Table when performing an Extract Process. These values are automatically stored in a Row List file. However, the Point-and-Shoot Facility is available for DB2 tables only. When you want to use values from data that does not reside in DB2, you can generate the Row List file manually or by a utility appropriate for the source of the data. The file must conform to the format of the file generated by Point-and-Shoot as follows:

Example

User Manual



The file must be a member of a partitioned data set or a sequential data set.



The file must contain 80-character records.



The data in the file must conform to DB2 syntax and rules for column data types. Additionally, the data must match, by data type and length, the attributes of the primary key column(s) in the Start Table.



The DD name of the file must be PSDFPNS.

For example, assume you want to extract specific rows from the DETAILS table using a list created by a method other than Point-andShoot. The primary key for the DETAILS table consists of two columns, ORDER_ID and ITEM_ID. These columns are defined as: Column Name

Data Type

ORDER_ID ITEM_ID

DEC(5,0) CHAR(5)

497

D. Creating a Row List File The following figure shows an example of how the list should be structured. In this example, the file containing the list is displayed in the ISPF editor. For each row to be extracted, the value in the ORDER_ID column is followed by the value in the ITEM_ID column. Commas separate the values for each row, and semicolons separate each row.

EDIT ---- PSTDEMO.PSTPK.KEY -------------------------- COLUMNS 001 072 Command ===> 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.

Character Data



Primary key values for each row must be separated by a semicolon followed by one or more spaces.



Character data must be enclosed in single quotes. Embedded quotes must be in the form of two single quotes. Character data can be wrapped to the next line. The segments of the data must be individually enclosed in quotes without an intervening colon. The following is an abbreviated example of character data that is wrapped followed by character data that is not wrapped: '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 is truncated or padded appropriately to fit the column. Character data that is stored in variable length columns is truncated if necessary but is not padded.

498

Move for DB2

D. Creating a Row List File Date/Time



All date and time data must be enclosed in single quotes. Any valid DB2 format for these values is acceptable and will be handled appropriately.

Numeric Data



Numeric data is not enclosed in quotes. The decimal can be indicated by either a comma or a period and will be handled appropriately.

Partial Primary Key

You can use this information to create a Point-and-Shoot file to specify an alternate key or a partial primary key. This is very useful for selecting non-unique values or values that do not correspond to the primary key definition. To indicate to MOVE that the data in this file contains 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 the columns are listed. Example 1: Assume you have a set of ITEMS rows that are not in your DB2 database. However, you want to extract the DETAILS rows from your DB2 database for specific ITEMS. The primary key for the DETAILS rows is comprised of two columns, ORDER_ID and ITEM_ID. However, you prefer to extract rows based on only the ITEM_ID. You can generate a file to be used as the Point-and-Shoot file to extract the several DETAILS rows for each specified ITEM_ID value regardless of the ORDER_ID value.

EDIT ---- PSTDEMO.PSTPK.KEY --------------------------- COLUMNS 001 07 Command ===> Scroll ===> CSR ****** **************************** TOP OF DATA ********************** 000001 COLUMN-LIST 000002 ITEM_ID 000003 END-COLUMN-LIST 000004 'CH001'; 'CH002'; 'CH003'; 'CH004'; 000005 'CH005'; 'CH006'; 'CH007'; 'CH008'; 000006 'CH009'; 'CH010'; ****** ************************ BOTTOM OF DATA ***********************

Figure 224. Specify Partial Primary Key - Example 1

User Manual

499

D. Creating a Row List File Example 2: Assume that two columns comprise the partial primary key, ORDER_ID and ITEM_ID. Specify the column values in the order in which they are listed for the column list. For each row, in this examples, the values for ORDER_ID are followed by the values for ITEM_ID separated by commas. Semicolons separate the rows. Since the values are delimited by commas and semicolons, entries can span multiple lines and multiple entries can be specified on a single line.

EDIT ---- PSTDEMO.PSTPK.KEY --------------------------- COLUMNS 001 07 Command ===> Scroll ===> CSR ****** **************************** TOP OF DATA ********************** 000001 COLUMN-LIST 000002 ORDER_ID 000003 ITEM_ID 000004 END-COLUMN-LIST 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 225. Specify Partial Primary Key - Example 2 Using the List

You can use the generated list for the Extract Process by performing the following steps: •

Select Option 1 EXTRACT from the Data Migration menu.



Select Option 1 TABLES from the EXTRACT Process menu.



Enter the POINT command on the Select Tables/Views for AD panel.



A pop-up window is displayed prompting for the name of an Input DSN. Specify the name of the Row List file you created at the Input DSN prompt and press END. The Select Tables/Views for AD panel is redisplayed. When you press END, a Point-and-Shoot session is not initiated, but the file you named will be used to extract rows from the Start Table when the Extract Process is performed.

500

Move for DB2

E. Printing Extract and Control Files This appendix describes how to print the contents of an Extract File or a Control File. You can browse these files online using the Browse option on the Data Migration menu, however, to print these files you must submit a batch job. The following sample JCL can be used to print the contents of the Extract File and, optionally, the Control File. You must supply the appropriate values for all italicized text: Sample JCL

//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:

User Manual

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 is optional. Print the Control File if you want to print the row status information resulting from a MOVE process. (In the sample JCL, this statement is commented.)

PSDFRPRT

Destination for the print request. This can be SYSOUT or a disk data set. This file has variable length record format with carriage control. (A parameter on the EXEC statement can be used to modify this.)

SYSPRINT

Destination of error messages.

501

E. Printing Extract and Control Files Several parameters can be specified in the parameter field on the EXEC JCL statement. These are all optional:

Errors

Option

Description

-E

Print rows with errors. This is ignored if a Control File is not supplied.

-NE -X -NX Row Status

-S -NS

Insert Status

Table Count

-I

Do not print message. Default. Include row status. This is ignored if a Control File is not supplied. Default. Do not include row status. Include insert status. This is ignored if a Control File is not supplied. Default. Do not include row status.

-C

Include table counts. Default.

Wrap Output

Do not include table counts. Indicate how the output is handled if the length of the records in the Extract File is greater than the length of the output line:

-W -NW

502

Print message with error code of rows in error. This is ignored if a Control File is not supplied.

-NI

-NC

Table Name

Print all rows. Default.

cid.table

Wrap the output. Default. Change the output file characteristics to fit the longest record in the Extract File. This optional setting is appropriate only when the output is directed to a disk data set. Indicate one or more tables in the Extract File that are to be printed. If you do not specify a value, all tables are printed. This is the default. If you specify: cid

All tables with the specified Creator ID are printed.

table

All tables with the specified base name, regardless of Creator ID, are printed.

cid.table

The named table is printed.

Move for DB2

E. Printing Extract and Control Files Varchar Delimiter

-VCDCnnn

Indicate the value of the character to be used as the varchar delimiter. For nnn specify the decimal equivalent for the character. For example, to define an asterisk as the delimiter, specify -VCDC92 where 92 is the decimal representation of the asterisk. The default varchar delimiter is semicolon, ';'.

Null Field Indicator Character

-NFCnnn

Indicate the value of the character to be used as the null field indicator. For nnn specify the decimal equivalent for the character. For example, to define an asterisk as the null field indicator character, specify -NFC92 where 92 is the decimal representation of the asterisk. The default null field indicator character is question mark, '?'.

Example

The following is an example of an EXEC statement using parameters to specify that all rows including row status are to be printed for the CUSTOMERS table in an Extract File: EXEC PGM=XFPMAIN,PARM='-NE -S CUSTOMERS' The parameters are separated by spaces.

User Manual

503

E. Printing Extract and Control Files

504

Move for DB2

F. Compatibility Rules for Relationships When defining a PST relationship using the Define Relationship or Modify Relationship panel, corresponding columns must be compatible as defined in the following table. The word “Yes” at the intersection of two column types indicates that those columns are compatible and may be defined as corresponding columns. The term “column” in this appendix refers to actual columns as well as expressions containing concatenation, substrings, and literals. VARCHAR DATE Column Column

TIME Column

TIMESTAMP Column

String Literal

Numeric Constant

String

Numeric Column

CHAR Column

Numeric Column

Yes

Yes

Yes

CHAR Column

Yes

2

Yes

Yes

Yes

Yes

VARCHAR Column

Yes

2

Yes

Yes

Yes

Yes

2

2

DATE Column

1

Expression

3

Yes

Yes

TIME Column

Yes

TIMESTAMP Column

Yes

String Literal

Yes

Yes

Yes

Yes

Yes

3

Numeric Constant

Yes

String

Yes

Yes

1

Expression 1

2

3

”String Expression” refers to any comparand containing a concatenation operator or a substring function. The “Numeric Column” must be an INTEGER or SMALLINT column or a DECIMAL column with a scale of 0 (that is, the numeric value cannot have any digits to the right of the decimal point). The “Numeric Column” must be an INTEGER, SMALLINT, or DECIMAL column.

User Manual

505

F. Compatibility Rules for Relationships Verification

MOVE verifies that corresponding columns are compatible when you press ENTER on the Define Relationship or Modify Relationship panel. If they are not, an error message is displayed. You must correct the incompatibility before saving the relationship definition.

Character to Numeric Columns

Character columns are compatible with numeric columns when defined in a PST relationship. To compare character data to numeric data, it may be necessary for MOVE to convert the numeric data to character format. This may involve padding the data prior to the comparison. The data is padded 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 a relationship: COL1 CHAR(5)

COL2 DECIMAL(2)

If the data in COL2 is 43, MOVE pads the value with three leading zeros to form “00043” prior to comparing it with the data in COL1, which is five characters long. This automatic padding may affect how MOVE retrieves related rows of data. Character-to-numeric conversion only occurs when the character column only contains digits. Different Length Columns

506

Corresponding CHAR and VARCHAR columns do not require the same length attribute. However, if the length of one column exceeds the length of its corresponding column, MOVE truncates trailing blanks in the longer column to obtain a length equal to the corresponding column. If the data in the longer column does not have enough trailing blanks to truncate, that data is not considered related and is not retrieved. Truncation also occurs when the length of a concatenated expression exceeds the length of its corresponding column.

Move for DB2

G. Skipped Columns Frequently, values that are not valid dates are inserted into date columns to indicate special handling or conditions. Rather than treat these nondate values as invalid or as errors, Relational Tools “skips” them. That is, when a column contains such a value, the column is bypassed. Since there is no error, processing continues with the next date column. The user can indicate whether skipped values are noted in the Aging Report and if rows with skipped dates are written to the output file. To determine whether a column should be skipped, Ager 2000 evaluates the field.

User Manual



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 2000 parses the column based on the specified date format or user exit, if specified, and then examines the values for each unit of the format. Based on site-specific definitions, the value may be skipped. Typical skipped dates include 0000/00/00 and 99992/31. Check with site management for a list of skipped values.

507

G. Skipped Columns

508

Move for DB2

H. Date Formats Date formats specify the format of a date column. These are encoded internally as a list of possible data types in a single format table. New formats can be added easily to the table without requiring coding for each individual format. Each format is specified by its name. You specify these formats on the Aging Specifications panel available from the Column Map editor. On this panel, you can display a selection list of values appropriate for the specific column data type by entering an asterisk in 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 a character column and also as a decimal column even though these are processed differently.

H.1 Date Components The formats distributed with MOVE are formatted with the following characters to represent the date component. CC YY YYY YYYY or CCYY MM MMM DD DDD DDDDDD / * U

User Manual

Two-digit century Two-digit year without century Three-digit year relative to 1900 Four-digit year Two-digit month Three-character abbreviation for name of month (e.g., Jan or JAN). Two-digit day Three-digit Julian day Lilian date (number of days since Oct.14, 1582) Slash in date Dash in date Any delimiter in date Unsigned decimal field. It precedes the format.

509

H. Date Formats

H.2 Examples MOVE supports a wide variety of internal date storage schemes. For instance, a YYMMDD date column may be stored in a variety of ways: •

6-byte character column



3-byte packed unsigned column



4-byte packed-decimal column



4-byte packed-decimal column with high-order bits indicating century

Character formats, numeric formats, as either packed decimal or binary 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

510

Move for DB2

H. Date Formats

User Manual

511

H. Date Formats

512

Move for DB2

Index

* * Aging Rule Selection List, Column Map ...................................................... 244 Aging rules selection list ......................... 347 All indicator for group selection............... 139 File name .................................................. 19 Format selection list, Column Map ...................................................... 244 Generic primary keys ....................................... 188 relationships ....................................... 217 Group Selection processing...................... 139 Primary keys, generic .............................. 182 Relationships, generic.............................. 217 Specify Relationship Usage panel ............ 143 *ERROR*, Column Map status.................... 236

| || concatenation operator Column Maps.......................................... 252 Relationships....................................... 207–8

A Abbreviated table name (Tn).......................... 90 Access Definition Description................................................ 52 Ref Tbl...................................................... 59 Rename ................................................... 262 TEMPTABLE ........................................... 58 Access Definition Parameters panel.............. 171 Access Definition Parameters Panel ............. 172 Access Definitions ................................. 45–173 BROWSE command ................................ 168 CANCEL command................................... 70 Choose an Access Definition panel ............ 46 Column data type ............................................... 78 name..................................................... 74 selection criteria ............................. 73–74

User Manual

sort criteria ........................................... 76 specification.......................................... 72 status indicated ..................................... 82 Commands line ....................................................... 69 primary ........................................... 68–69 Components .............................................. 45 diagram of ............................................ 53 CREATE RELATIONSHIPS command...... 65 Creator ID ................................................. 55 Date modified............................................ 50 Delete tables from ..................................... 67 Duplicate tables....................................... 173 Dynamic definition of .............................. 168 Error handling ........................................... 70 Every Nth.................................................. 60 Export Process................................... 276–83 output file format .........................292–296 Extract Process, specify for ...............306–307 GET TABLES RELATED command.............. ............................................28–30, 63–64 GROUP field............................................. 47 Group name............................................... 50 Group Selection processing indicator ........................................................ 55 Group Selection Processing ............. 138, 140 Impact of data base changes............. 169, 170 Import Process................................... 283–86 INDENT command.............................. 65, 67 Line commands ......................................... 69 LIST TABLES command ........................... 61 LIST TABLES RELATED command ......... 63 Modified By .............................................. 50 Modify table names ................................... 68 Name ........................................................ 50 NAME field .............................................. 47 Name format ............................................. 14 Naming conventions ............................ 17–19 Overview....................................... 11, 14, 45 Parameters panel ..................................... 171 Parameters Panel ..................................... 172 POINT command................................. 30, 85 Point-and-shoot sample session ................................ 31–32

509

Index Point-and-Shoot................................. 84–136 Primary commands .............................. 68–69 REL command............................32, 141, 150 Relationship selection.................32, 141, 144 Relationships specification ...................... 150 Row Limit ................................................. 60 Row List indicator ..................................... 56 SAVE command ........................................ 70 Select primary key values .................. 84–136 selection criteria ........................................ 81 Selection criteria ................................. 71–75 Selection list........................................ 48–52 Export Process .................................... 279 Extract Process ................................... 307 Specify Relationship Usage panel ...... 32, 141 Specify Selection Criteria panel ........... 74–75 Specifying relationships........................... 141 SQL command..................................... 79–80 SQL WHERE Clause panel ................. 79–83 Start Table ................................................ 55 Stored specifications.................................. 14 Table names ................................................... 58 selecting ............................................... 54 USER field................................................ 47 User name ................................................. 50 AGE function CLR to delete .......................................... 246 Column Maps.......................................... 242 Convert Process....................................... 429 Insert Process .......................................... 342 Load Process ........................................... 369 LOADPLUS ............................................ 375 Aging data Century Pivot Window............................. 347 Column Maps for..............................242–248 Convert Process information ............ 362, 434 Default Aging Rule.................................. 347 Default Aging Rule Table ........................ 347 Insert Process information........................ 362 Output Rows with Invalid Dates .............. 348 Output Rows with Skipped Dates ............ 349 Report Invalid Dates................................ 348 Report Skipped Dates .............................. 348 Aging Rule * for selection list .................................... 347 Column Maps.......................................... 244 default for Aging data .............................. 347 Aging Rule Table default for Aging data .............................. 347 Aging Specifications aging amounts ......................................... 245 business rules .......................................... 245 Pivot Year ............................................... 245 prompts for Column Maps ............... 243, 246 Alias Creator ID defaults, Create Process.. 403, 404 Type indicator ........................................... 59 ALL Command Select Tables/Views panel......................... 68

510

Pending Process List................................ 438 Selection criteria specification ................... 72 Allocating external files ........................489–493 APPLY command Sample session .......................................... 41 Create Process ......................................... 406 Table Map............................................... 267 APPLY Command, Table Map ..................... 268 Insert Process .......................................... 338 ARChive line command ............................................ 56 primary command...................................... 68 table status ................................................ 57 Arithmetic calculations Column Maps.......................................... 252 Asterisk, Creator ID Primary keys, generic .............................. 188 Relationships, generic.............................. 217 AT line command Access Definition list....................... 183, 226 ATTRIBUTES command Access Definition ............................ 228, 261 Primary Key ............................................ 187 Sidelabels................................................ 107 Attributes, display column.............................. 92 Authorization ID ..........................See Creator ID AutoSwitch Mode option.............................. 458

B Batch Convert Process....................................... 432 DB2 LOAD Process Delete Process ..................................386–387 Extract Process ........................................ 318 JCL..................................................... 321 option ..........................................312–385 overrides............................................. 322 Report................................................. 330 Insert Process .......................................... 355 JCL............................................. 355, 361 option ................................................. 344 overrides............................................. 355 LOADPLUS Process................................ 376 Batch Export Utility ..............................481–483 Control statements................................... 482 EXPORT statement ................................. 482 sample JCL ............................................. 481 SUBDEF statement ................................. 482 Batch Import Utility ..................................... 483 Control statements................................... 484 IMPORT statement.................................. 484 sample JCL ............................................. 483 Batch Maintenance Utilities ..................463–486 categories ................................................ 463 Control statements description syntax ............................... 466 guidelines ........................................... 465 COPY statement

Move for DB2

Index PST objects..................................476–478 DELETE statement PST objects......................................... 474 DIRECTORY statement .......................... 467 PST objects..................................467–473 Error Codes ............................................. 464 ERROR statement ............................485–486 general control statements ................485–486 Object maintenance statements .........481–484 PAGESIZE statement .............................. 485 RENAME statement PST objects..................................478–480 sample JCL ............................................. 464 Batch Utilities Archive entry maintenance statements ..... 474 Delete PST objects ...........................474–476 PST object maintenance statements ......... 474 Bottom, scroll direction .................................. 95 Browse Control File ......................................440–446 conversion error ...........................445–446 example .......................................443–446 LIST TABLES command .................... 442 output data set .................................... 442 parameters ...................................440–442 row status ....................................441–446 Extract File ......................................440–446 LIST TABLES command .................... 442 output data set .................................... 442 parameters ...................................440–442 row status ....................................441–446 BROWSE command..................................... 168 Business rules, Column Map........................ 245

C CANCEL command Access Definitions, while defining....... 69–70 DB2 LOAD Process, batch execution....... 379 Extract Process, batch execution .............. 322 Insert Process, batch execution ................ 355 Relationships........................................... 211 Row List processing .................................. 86 Caps Mode, User option............................... 448 Cascade delete, Delete Process..................... 389 Century Pivot Window ................................. 347 Character data, converting............................ 237 Child Limit, Specify Relationship Usage panel ...................................................... 143 Choose a Column Map panel........................ 224 Choose a Definition Option panel................. 175 Choose a Primary Key panel......................... 180 Choose a Relationship panel......................... 193 Choose a Table Map panel ........................... 256 Choose an Access Definition panel................. 46 CLEAR command ........................................ 254 CLR line command, delete AGE function ..... 246 COLUMN command Describe Columns panel ...................... 75–76

User Manual

Select Tables/Views panel......................... 68 Column Map Copy........................................................ 228 Description.............................................. 227 Rename ................................................... 229 Column Maps .......................................222–255 AGE function .......................................... 242 Aging specifications removing............................................. 254 Aging Specifications.........................243–246 arithmetic calculations............................. 252 business rules .......................................... 245 Choose a Column Map panel ................... 224 CLEAR command.................................... 254 CLR line command.......................... 246, 254 Column compatibility................................237–239 concatenation ...............................251–252 data type compatibality...........................237–239 validating ................ 232–233, 237–239 destination ...................................233–237 display .........................................233–237 matching source and desintation.......... 233 selection list...............................239241 source ........................................233237 status ...........................................235–237 validating..................... 232–233, 237–239 Concatenating columns .....................251–252 Data conversion....................................... 239 Data Conversion ...................................... 237 Data type compatibility................................237–239 validation..................... 232–233, 237–239 Default mapping...............................233–234 Defining ...........................................222–255 description............................................... 237 Destination columns .......................................233–237 table, specifying.................................. 230 EQUAL column status............................. 235 ERROR column status ............................. 236 EXIT column status ................................. 236 Exit Routines.................... 253–254, 495–498 EXPAND command................................. 253 Explicit name .......................................... 225 Export Process................................... 276–83 output file format ................................ 289 EXPR column status................................ 236 Expressions ......................................251–252 Extract File, source table specification..... 230 Functions..........................................242–251 FUTURE_YEAR..............................246–248 Import Process................................... 283–86 LIST MAPS command............................. 271 LIST UNUSED command.................239–240 LITERAL column status .......................... 236 Literal values........................................... 252 Map display......................................229–233

511

Index MAP ID................................................... 224 MAP NAME ........................................... 224 MAPPED column status .......................... 235 MAPS command...................................... 273 Matching columns ............................233–237 Naming conventions................................... 17, 223 explicit values, using .......................... 225 NOT_INS column status.......................... 237 NOTUSED column status ........................ 235 NULL column status................................ 236 Overview............................................. 11, 17 POPULATE command name considerations............................ 272 PROP function..................................248–250 Purpose ................................................... 223 REQUIRD column status......................... 236 SAVE command .............................. 255, 274 SELECT command .................................. 229 Selecting ......................................... 224, 225 Selection list.....................................225–229 columns, when specifying ............239–241 SELECT command ............................. 229 Table Map, from ..........................270–271 tables, when specifying ....................... 233 source explicit value .............................. 241, 254 Source columns .......................................233–237 Extract File DSN ................................ 230 table ................................................... 230 table, specifying...........................230–233 SPC_REG column status ......................... 236 Specifying tables ..............................230–237 SRC line command.................................. 246 Table Maps ............................................. 269 Tables respecifying ........................................ 237 specifying ....................................230–233 UNKNOWN column status...................... 236 Using ...................................................... 255 Validation ........................................232–239 rules specification ............................... 225 VALIDATION command ......................... 238 Columnar format Max Disp Width option ........................... 456 Point-and-Shoot......................................... 89 Columns Attributes display option ..................................... 455 Point-and-Shoot display ........................ 92 Compatibility Column Maps ..............................237–239 relationships ................................. 507–12 Concatenating Column Maps ..................................... 252 relationships ................................... 207–8 Display, specifying .................................... 75 Impact of data base changes..................... 169

512

Mapping............................ See Column Maps Matching ................................................. 235 Matching in Column Maps ...............233–237 Name primary keys ....................................... 186 relationships ............................... 202, 214 restrictions ..................................... 214 Naming conventions ............................ 17–19 Selection list, relationships, defining ....... 207 Specification indicators.............................. 57 Substringing in relationship ............... 208–10 Truncated display ...................................... 99 Validating for Column Map ..............232–237 Commands Access Definition selection list.......................................... 52 when defining ................................. 68–69 Column Map selection list........................................ 229 when defining ..................................... 237 CREATE Object List ............................... 407 Describe Columns for AD panel ................ 78 Export Process object selection list ............................. 281 Report................................................. 283 Import Process......................................... 286 Point-and-Shoot......................................... 93 Primary key selection list........................................ 185 when defining ..............................186–188 Relationship selection list........................................ 196 when defining ..............................212–214 Row List processing ............................ 85–86 Select Tables/Views for AD panel ............. 60 Specify Relationship Usage panel ............ 144 Specify Selection Criteria panel ................. 75 SQL WHERE Clause panel ....................... 81 Table Map selection list.................................259–262 when defining ..................................... 269 Commit points Delete Process ......................................... 384 Insert Process .......................................... 343 Compatible Columns Columns.................................................. 237 Column Maps.......................................... 239 Relationships..................................... 507–12 CONCAT operator Column Maps.......................................... 252 Relationships....................................... 207–8 Concatenating columns Column Maps.......................................... 252 Relationships....................................... 207–8 Confirm on Deletes, User option .................. 448 Control File Allocating.........................................489–493 Browsing..........................................440–446 Convert Process....................................... 429

Move for DB2

Index DB2 LOAD Process................................. 365 Naming conventions .................................. 19 Overview..........................................332–333 Printing ........................................... 503, 504 Retry/Restart Process............................... 437 Control File DSN Delete Process ......................................... 383 Insert Process .......................................... 341 Convert Process ................................... 428, 435 Batch execution ....................................... 432 Control File DSN ................................................... 429 selection list........................................ 431 Destination Extract File DSN .................. 429 Discard limit ........................................... 430 Discarded rows........................................ 435 Extract File destination DSN.................................. 429 selection list........................................ 431 source DSN......................................... 429 Modifying dates at destination ................. 429 Overview................................................. 428 Parameters .......................................428–431 propagating primary key values................ 430 Report ..............................................433–435 Review JCL............................................. 430 Selection list for Extract File/Control File ................................. 431 Sort using cluster index ........................... 430 Source Extract File DSN.......................... 429 Status .............................................. 431, 432 Table Map............................................... 429 Convert Process Report Aging information ........................... 362, 434 Convert with Extract ...................................... 35 Converting Data .................................................237–435 Primary key to generic ............................. 190 Relationship to generic .....................219–220 COPY statement Batch Maintenance Utilities PST objects..................................476–478 Correlation name............................................ 80 COUNT Command......................................... 91 CR/CRA line commands Create Process ..................................407–412 Insert Process .......................................... 353 CREATE command Create Process ..................................407–412 Insert Process .......................................... 353 Synonyms, Create Process ....................... 426 CREATE Object List Create Process ..................................407–416 Insert Process .......................................... 352 Line commands ................................407–408 Modifying................................................ 412 Primary commands .................................. 416 Review SQL............................................ 410 SQL line command.................................. 415 Status ...............................................411–412

User Manual

Create Process.......................................390–427 CONFLICT object status ..................411–412 CR/CRA line commands... 407–408, 411–412 CREATE command .......... 407–411, 412–426 CREATE Object List ........................407–416 line commands.............................407–408 modifying ........................................... 412 primary commands.............................. 416 review SQL......................................... 410 status ...........................................408–412 CREATED object status .......................... 412 DB2 line command...........................408–413 DB2 output.............................................. 415 Defaults............................................391–404 Creator ID............................392, 403–404 index ...........................................392–400 table ............................................392–395 tablespace ............................392, 395–399 DEFAULTS command............................. 413 Destination table type .............................. 406 DR line command.............................408–412 Drop objects .....................................408–412 EXISTS object status............................... 411 Extract File DSN ..................................... 391 Grant privileges................................421–424 Menu....................................................... 390 Object status.....................................408–412 Output SQL......................................426–427 Output, DB2............................................ 415 Overview................................................. 390 PENDING object status ........................... 412 Perform ............................................407–416 PST line command ...........................408–413 Relationships....................................413–414 Review SQL.....................................410–415 Save SQL .........................................426–427 SELECT object status.............................. 411 SHOW command..................................... 414 SQL output ..........................................426–427 review..........................................410–415 save .............................................426–427 SQL line command.................................. 415 Synonyms.........................................424–426 Table Map........................................404–407 CREATE RELATIONSHIP command ...192–193 Access Definition ...................................... 65 Select Tables/Views panel......................... 65 Specify Relationship Usage panel ............ 144 Creating relationships ...........................200–201 Creator ID Batch override Extract Process ................................... 323 Batch Override Extract Process ................................... 323 Insert Process...................................... 355 Column Map destination table.................................. 230 source table......................................... 230 Create Process defaults.....................403–404

513

Index Default in Access Definition ...................... 55 Generic primary keys........................188–191 Generic relationships........................217–220 impact on relationships............................ 149 Naming conventions ............................ 17–19 Criteria Sample session example ...................... 30–32 Selection begin display with option .................... 172 Begin display with option.................... 172 Extract Process batch override............. 323 Modify option ..................................... 171 specifying ............................71, 73, 74, 75 Sort, specifying.......................................... 76 Specifying selection ......................................... 71–75 sort ....................................................... 76 SQL WHERE Clause ............................ 81 SQL WHERE clause Extract Process batch override......324–325 specifying ............................................. 79 Cycles Browsing................................................. 111 Insert Process commit points.................... 352 Referential .......................................161–167 Traversal ................................................. 160

D DA field......................................................... 60 Data conversion Column Maps...................................237–239 Convert Process................................428–435 Error identification ...........................445–446 Data Migration Destination ...........299. See also DB2 LOAD. See also Insert Functions................................................. 299 Menu................................................300–302 Source ...........................299. See also Extract Data set prefix default, User option .............. 450 Data type Compatibility for Column Maps............... 237 Describe Columns panel ...................... 77–78 Point-and-Shoot display ............................. 92 Values for Column Map functions ........... 251 DATE, Aging DB2 column........................... 246 Date Aging, Insert Process batch overrides ... 356 Date Formats character set ............................................ 511 examples ................................................. 512 overview.................................................. 511 Dates, modifying at destination Column Maps.......................................... 242 Convert Process....................................... 429 Insert Process ...................................342–344 Load Process ........................................... 369 LOADLUS .............................................. 375

514

DB2 Aging DATE and TIMESTAMP columns................................................... 246 DB2 Catalog Create Process ..................................413–414 Directory ................................................. 177 Referential Integrity................................... 15 Relationship source ................................... 63 Relationship source identifier .................. 144 Relationships....................................192–200 Used by MOVE......................................... 15 DB2 Common Server Extract File usage.................................... 301 DB2 delimited identifiers............................... 18 DB2 LIKE character Access Definition selection...........47–48, 307 Column Map selection............................. 224 DSN selection ......................................... 126 POPULATE Command............................ 272 Primary key selection............................... 180 Relationship selection.............................. 195 Table Map selection .........................257–258 Using ........................................................ 18 DB2 LIKE syntax......... See DB2 LIKE character DB2 line command, Create Process .......408–413 DB2 LOAD Process ..............................363–382 Check Pending status........................380–381 Control File DSN .................................... 365 COPY ..............................................368–369 Discard limit ........................................... 371 Enforce RI constraints.............................. 368 Extract File DSN ..................................... 365 Image Copy ......................................368–369 JCL review .............................................. 377 Job processing ..................................377–382 Job steps...........................................379–380 LOADPLUS utility .................................. 372 LOG........................................................ 367 Menu....................................................... 364 Overview................................................. 363 Parameters .............................................. 366 Perform ................................................... 364 propagating primary key values................ 371 REPAIR .................................................. 367 RESUME ................................................ 366 Review JCL............................................. 371 RUNSTATS ............................................ 369 Table Map............................................... 364 DB2 Output, Create Process......................... 415 DB2 RI, impact on Delete Process................ 389 DB2 subsystem display, User option............. 449 DB2DATE ................................................... 246 DEFAULTS command Create Process ......................................... 413 Insert Process .......................................... 353 Defaults, Create Process........................391–404 Creator ID ............................................... 392 Index................................................392–400 Table................................................392–395

Move for DB2

Index Tablespace .......................................392–399 DEFCID Extract Process batch override ................. 323 Insert Process batch override.................... 355 Definitions ............................................175–298 Column Maps...................................222–255 Exporting .........................................275–283 Importing..........................................275–298 Primary keys.....................................179–191 Relationships....................................192–221 Table Maps ............................................. 256 Delete Table Maps ............................................. 262 Delete confirmation, User option.................. 448 Delete Process.......................................383–389 Batch....................................................... 387 Batch execution ....................................... 386 Cascade delete......................................... 389 Commit points......................................... 384 Control File DSN .................................... 383 Discard limit ........................................... 384 Discarded Rows....................................... 387 Extract File DSN ..................................... 383 Handling updates..................................... 389 Locking tables ......................................... 384 Non-unique keys...................................... 388 Overview................................................. 383 Parameters .............................................. 383 Report ............................................. 388, 389 Review JCL............................................. 385 Specifying ............................................... 388 Status ...................................................... 386 DELETE statement Batch Maintenance Utilities PST objects......................................... 474 Deleting tables from Access Definition .............................. 67 From data base, impact............................ 170 Delimited identifiers ...................................... 18 Delimiter character option............................ 454 Describe Columns for AD panel ..................... 72 SEL command ........................................... 72 SQL command..................................... 79, 80 Describe Columns panel................................. 76 Commands ................................................ 78 Data type................................................... 78 Sort criteria ............................................... 76 Unzoom display......................................... 78 Zoom display............................................. 79 Description Access Definition ...................................... 52 Column Map ................................... 227, 237 Primary Key ............................................ 182 Relationship ............................................ 202 Table Map............................................... 266 Directory Access Definition stored ............................ 70 Create Process ................................. 413, 414 Migrating to another subsystem ............... 275 Overview................................................... 15

User Manual

Primary Keys........................................... 179 PST Relationship source identifier.............. 144 Relationship type identifier...................... 144 Relationships................................... 192, 200 Table Maps ............................................. 269 updating .................................................. 178 DIRECTORY statement Batch Maintenance Utilities .................... 467 PST objects................................. 467, 473 Discarded rows Delete Process ......................................... 387 Insert Process .................................. 343, 351 Displaying data, length exceeds column width 99 Displaying selection lists Choose an Access Definition...................... 46 Displaying SQL............................................ 124 Down, scroll direction .................................... 95 DR line command, Create Process........ 408, 412 Dropping objects, Create Process ......... 408, 412

E Editing displaying SQL........................................ 124 Editor Display Format option ....................... 456 Editor Options AutoSwitch Mode.................................... 458 Specifying ........................................454–458 END command Row List processing .................................. 86 END Command.............................................. 20 EQUAL, Column Map status........................ 235 Error conditions Extract Process Access Definition.....319–321 Error Handling Table selection .......................................... 70 Table Selection.......................................... 70 ERROR statement Batch Maintenance Utilities .............485–486 ERROR, Column Map status........................ 236 Every Nth....................................................... 60 EXCLUDE Command .............................. 97–98 Exclude line command ................................... 97 Excluded lines showing..................................................... 99 Exit Routines Column Map .................... 253–254, 495–498 Parameters .............................................. 496 Requirements .......................................... 495 Return Codes........................................... 497 Samples................................................... 498 Sets destination ....................................... 496 Special Registers ..................................... 497 Termination call ...................................... 498 EXIT, Column Map status............................ 236 Expand Sidelabels, Scrolling................................ 106 EXPand

515

Index line command ............................................ 56 EXPAND command ..............................100–101 Column Maps.......................................... 253 Relationships........................................... 210 Sidelabels display.................................... 105 Expand data Sidelabels................................................ 104 Export Process APPEND to build output ......................... 281 Choose objects......................................... 279 Definition Type ....................................... 276 Deleting objects....................................... 278 Output DSN ............................................ 277 Output file APPEND ............................................ 281 Disposition ......................................... 278 Output file format.............................286–298 Access Definitions .......................292–296 Column Maps ..................................... 289 primary keys ....................................... 288 relationships ....................................... 288 Table Maps..................................290–292 Overview................................................. 275 Report ..................................................... 283 REPORT command ................................. 283 Report DSN............................................. 278 Selecting object definitions...................... 280 Selection Lists of objects ......................... 280 Subordinate objects ................................. 277 Types of definitions ................................. 276 Using ................................................ 276–83 Export Summary .......................................... 282 EXPR, Column Map status........................... 236 Expressions Column Map ........................................... 252 Expressions for Column Map ....................... 251 Extended relationship, overview................... 192 Extract File Allocating.........................................489–493 Browsing..........................................440–446 Convert Process destination .......................................... 429 source ................................................. 429 DB2 LOAD Process................................. 365 Definition................................................ 304 definition of............................................... 10 from DB2 Common Server ...................... 301 Name for Column Map source ................. 230 Naming conventions .................................. 19 Object definitions .................................... 308 Object Definitions ................................... 309 Overview................................................... 15 Printing ............................................503–504 Purpose ................................................... 332 Sample session .......................................... 35 Selection list............................................ 313 Specifying DSN....................................... 310 Extract File DSN Create Process ......................................... 391 Delete Process ......................................... 383

516

Extract Process ........................................ 310 Insert Process ...................................335–341 Extract process Group selection ....................................... 138 Extract Process......................................304–331 Access Definition create.................................................. 306 Create................................................. 306 error conditions............................319–321 NEW Relationship .............................. 320 Permanent........................................... 306 selection list........................................ 307 specification........................................ 306 Temporary .......................................... 306 UNKNOWN Relationship................... 320 Validated ............................................ 319 warnings ......................................320–321 Warnings ............................................ 320 Aliases .................................................... 309 Batch execution ....................................... 318 JCL..................................................... 321 Batch overrides........................................ 322 Error conditions................................319–321 Execution ................................................ 318 Batch .................................................. 318 Online ................................................ 318 EXTRACT Errors & Warnings Panel....... 321 Extract File DSN ..................................... 310 Group Selection....................................... 140 Limit Number of Rows ............................ 311 Menu................................................305–307 Object Type............................................. 308 Online execution ..............................318–329 Online status ........................................... 329 Overview......................................10–11, 304 Parameters ...............................307, 310–312 Perform Convert with Extract .................. 312 Point-and-Shoot................................. 84, 135 Validation........................................... 321 Report ..............................................330–331 Printing............................................... 331 Review JCL............................................. 312 Select Start Table Rows by ...................... 311 SHOW STEPS......................................... 321 Specify relationships................................ 141 Specify Relationships .............................. 167 UNLOAD PLUS...................................... 328 UNLOAD PLUS utility.....................313–315 Views...................................................... 309 Warnings..........................................320–321

F FIND command.............................................. 98 Hexadecimal data .................................... 102 Primary keys selection list ....................... 185 Foreign keys............................ See Relationships Function keys................................................. 20 FUTURE_YEAR function.....................246–248

Move for DB2

Index Column Maps.......................................... 242 Convert Process....................................... 429 Insert Process .......................................... 342 Load Process ........................................... 369 LOADPLUS ............................................ 375

G Generic Primary keys...................................... 188–91 Relationships..................................... 216–21 GENERIC command Primary keys............................................ 190 Relationships....................................219–220 GET TABLES RELATED Example .............................................. 28–30 Select Tables/Views panel......................... 68 GR line command .......................................... 64 Grant privileges Create Process ......................................... 424 output...................................................... 424 Review SQL............................................ 423 Selection list of objects............................ 423 SQL ........................................................ 424 Grant privileges, Create Process................... 421 GROUP Access Definition name ............................. 14 Access Definition specification .................. 47 Profiled ..................................................... 48 GROUP command........................................ 138 Select Tables/Views panel......................... 68 Group Selection processing Indicator.................................................... 55 Group Selection Processing .......................... 138 Indicated ................................................. 140 Start Table Options field ......................... 140

H HELP Command ............................................ 20 function key............................................... 20 HEX command............................................. 102 Hex display option ....................................... 455 Hexadecimal display HEX command ........................................ 102

I Import Process Definition Type ....................................... 284 Error handling ......................................... 284 Existing definitions ................................. 284 Input DSN ............................................... 284 Overview................................................. 275 Report ..................................................... 286 Report DSN............................................. 285 Types of definitions ................................. 284 Using ................................................ 283–86 Import Summary .......................................... 285

User Manual

INDENT command Multi-way join......................................... 121 Select Tables/Views panel......................... 69 INDENT Command.................................. 65–67 Multi-way join......................................... 123 Indented Table Display ............................ 65–67 Multi-way join......................................... 123 Index defaults, Create Process ...............392–400 Indexes, selection list ................................... 187 Information Relationship using Info command............................ 145 Table Map............................................... 260 Information Retrieval Utilities sample JCL ............................................. 464 Input DSN Import Process......................................... 284 Point-and-Shoot................................. 85–135 Insert Process ............................................... 334 Batch................................................354–355 Batch execution ....................................... 361 Batch Execution ...................................... 355 Batch overrides.................................355–359 Batch/online execution ............................ 344 Commit points......................................... 343 CR/CRA line commands.......................... 353 CREATE command ................................. 353 CREATE Object List ............................... 352 Create objects.................................. 352, 353 DEFAULTS command............................. 353 Destination table Type ................................................... 338 Destination Table Type ................................................... 339 Discard limit ........................................... 343 Discarded rows........................................ 351 Extract File DSN ..................................... 335 Insert vs Update...............................339– 340 Menu................................................334–335 Modify dates at destination...................... 344 Modifying dates at destination ................. 342 Online status ........................................... 354 Online/Batch execution ........................... 344 Overview......................................11–12, 334 Parameters .............................................. 341 Perform Insert Option ................................................ 335 Perform Update Option ................................................ 335 propagating primary key values.........343–344 Report ..................................................... 361 Print ................................................... 362 Review JCL............................................. 344 Review SQL............................................ 353 Sample session .................................... 39–42 Selection list............................................ 336 SQL, review ............................................ 353 Table Map Column Map Name............................. 338 Dest CID............................................. 336

517

Index destination tables ................................ 337 extract tables ...................................... 337 specifying ........................................... 336 Specifying................................... 338, 339 Src CID............................................... 336 Table names ....................................... 339 Type ................................................... 337 UNKNOWN ....................................... 337 Insert Process Report.................................... 362 Invalid Dates, specify handling..................... 348

J JCL Convert Process....................................... 432 execution ............................................ 432 Delete Process ..................................386–387 Extract Process ........................................ 321 Insert Process ...................................355–361 Review DB2 LOAD Process ............................ 377 LOADPLUS utility ............................. 377 Job Card, Specifying .................................... 460 Job Card and Print Options, Description....... 460 Job Card review, User option ....................... 451 Join First displayed table ................................ 114 impact on display..................................... 114 INDENT command.......................... 121, 123 multiple relationships .............................. 112 Multi-table display .................................. 113 Multi-way.........................................117–124 Example ......................................119–120 no related tables ...................................... 112 no table specified..................................... 111 one related table ...................................... 108 overview...........................................108–112 requirements ........................................... 108 Scrolling display...................................... 114 sidelabels restriction................................ 107 Stack ....................................................... 118 SWITCH command.................................. 120 Table selection list .................................. 111 UNJOIN command impact on stack ................................... 124 Multi-way join .............................123–124 unjoining ................................................. 117 zooming display................................115–116 JOIN command assign to PF key....................................... 110 NEW operand.......................................... 168 using ....................................................... 108

L Left, scroll direction ....................................... 95 Line Characters Editing .................................................... 453 option to modify ...................................... 450

518

Line commands Editing Table List...................................... 67 for scrolling expanded data ...................... 101 Get Related tables ..................................... 64 Point-and-Shoot......................................... 93 Relationship editing........................... 212–13 Select tables .............................................. 63 Select Tables/Views panel......................... 69 SQL WHERE Clause panel ....................... 81 table list .................................................... 56 LIST COLUMNS command ......................... 207 primary keys............................................ 187 Relationships........................................... 211 SQL WHERE Clause panel ....................... 81 LIST Command Column Maps.......................................... 239 Create Process Table Map ....................... 406 Insert Process Table Map......................... 338 Table Maps ............................................. 266 using for Column Map......................240–241 LIST MAPS command Column Maps for Table Maps ................. 269 Column Maps from Table Map ................ 271 LIST TABLES command Access Definition ...................................... 63 Browse Control File ................................ 442 Browse Extract File ................................. 442 Insert Process .......................................... 337 LIST TABLES Command Example .............................................. 61–62 LIST TABLES RELATED command Example .................................................... 63 LIST UNIQUE INDEX command................. 187 LIST UNUSED, Table Maps ........................ 266 LITERAL, Column Map status..................... 236 Load Process, Modifying dates at destination 369 Load Utility, specifying ................................ 448 LOADPLUS, Modifying dates at destination ................. 375 RESUME ................................................ 373 LOADPLUS Process propagating primary key values................ 376 Review JCL............................................. 376 LOADPLUS utility Batch execution ....................................... 379 Discard limit ........................................... 376 Image copy .............................................. 374 JCL review .............................................. 377 Job processing ..................................377–382 Job steps...........................................379–380 Parameters .............................................. 372 REDEFINE ............................................. 373 REPAIR .................................................. 373 RESUME ................................................ 372 RUNSTATS ............................................ 374 UNIQUECHECK..................................... 375 LOADPLUS utility....................................... 372 LOCAL Column Map, Insert Process .................... 338 LOCATION

Move for DB2

Index Choose a Definition Option panel ............ 177 Choose an Access Definition...................... 47 Migration Menu ...................................... 303 LOCK command ............................................ 95 LOCK Command Sidelabels format..................................... 104 Locking, Sidelabels format ........................... 104 Locking columns ............................................ 95 Locking tables, Delete Process ..................... 384 LR line command......................................... 197

M Main Menu .................................................... 24 MOVE Only............................................ 487 Maintain Relationships panel ................. 193–95 Maintenance Utilities Batch................................................463–486 categories ................................................ 463 MAP command, Column Maps..................... 223 MAP ID Column Map ........................................... 224 Table Maps ............................................. 257 MAP NAME Column Map ........................................... 224 Table Maps ............................................. 257 MAPPED, Column Map status ..................... 235 MAPS command .......................................... 273 MAX ROWS Command........................... 91–92 Maximum Fetch Rows option....................... 455 Maximum Fetch Rows options COUNT Command.................................... 91 Maximum Rows Limit by Table........................................... 60 MODEL command, for relationships ...... 215–16 Modify DATEs and TIMESTAMPs Insert Process .......................................... 344 Modifying table names in Access Definition .................................. 68 MORE, scroll indicator .................................. 95 MOVE Naming conventions .................................. 18 Overview................................................... 14 Move for DB2 Main Menu ............................................... 24 Session overview ....................................... 23

N NAME Access Definition name ............................. 14 Access Definition specification .................. 47 Profiled ..................................................... 48 Naming conventions................................. 17–19 Creator ID ................................................. 55 DB2 LIKE syntax ...................................... 18 DSN.......................................................... 19 NEW, Relationship status ............................ 142 NONE, as aging rule .................................... 244

User Manual

NOT_INS, Column Map status..................... 237 NOTUSED, Column Map status................... 235 NULL attribute, Point-and-Shoot display........ 92 NULL Value option...................................... 454 NULL, Column Map status .......................... 236 Numeric data, converting ............................. 238

O Object definitions Create Process ......................................... 416 Export Process................................... 276–83 Exporting subordinate objects.................. 277 Extract Process ........................................ 307 extracting ................................................ 308 Import Process................................... 283–86 Insert Process ...................................352–353 Overview................................................... 17 Sample session .......................................... 33 Selecting for extract................................. 308 Status for Extract Process ........................ 308 Object Definitions Create Process ......................................... 390 Dropping, Create Process..................408–412 Extract Process ........................................ 309 Extract Process Report............................. 331 Option for Extract Process ....................... 311 Selecting for extract................................. 309 OBJECTS, Extract Process option see also Object definitions ....................... 306 ONLY Command ........................................... 99 Options Editor ...............................................454–458 Job Card and Print................................... 460 Line Characters ....................................... 452 menu ....................................................... 447 User .................................................448–452 Output Create Process ......................................... 415 OUTPUT command Convert Process Report............................ 435 Delete Process Report.............................. 389 from SHOW STEPS display .................... 151 Relationship Usage Report ...................... 152 Specify Relationship Usage panel ............ 150 OUTPUT Command..................................... 126 Extract Process Report............................. 331 Insert Process Report ............................... 362 Output Date Format, Column Maps.............. 244 Output DSN Export Process......................................... 277 File Layout .......................................499–502 Point-and-Shoot....................................... 135 Output file Allocating.........................................489–493 Export Process format.............................. 286 Output Rows with Invalid Dates................... 348 Output Rows with Skipped Dates ................. 349 Output SQL, Create Process ..................426–427

519

Index

P PAGESIZE statement Batch Maintenance Utilities .................... 485 Parameters Browse Control File .........................440–442 Browse Extract File ..........................440–442 Convert Process................................428–431 DB2 LOAD Process................................. 366 Delete Process ......................................... 383 Extract Process .................................307–312 Insert Process .......................................... 341 LOADPLUS ............................................ 376 LOADPLUS utility .................................. 372 Retry/Restart ........................................... 439 Update Process ........................................ 341 PARAMETERS command.....................146–171 Access Definitions............................171–172 Select Tables/Views panel......................... 69 PARAMETERS Command........................... 172 Partial Primary Key...............................501–502 Password, specifying .................................... 450 PATHS, Extract Process Option see also Relationships.............................. 306 Pending Process, Parameters ........................ 439 Pending Process List ALL Command........................................ 438 Process attributes..................................... 438 Pending Process List, Retry/Restart Process . 436 Pending Process Parameters ......................... 439 Perform Convert with Extract Extract Process ........................................ 316 POINT command ..................................... 30, 85 Select Tables/Views panel......................... 69 POINT Command Subsequent requests ................................ 136 Point-and-Shoot ..................................... 84–136 Change Start Table .................................. 136 Column display specifications.................... 75 Columnar display ...................................... 89 Commands ................................................ 93 confirmation from Extract Process ........... 135 Display column attributes .......................... 92 Display SQL............................................ 124 Example .............................................. 30–32 excluding rows .......................................... 97 Expanding columns ................................... 99 Scrolling ............................................. 101 File Layout .......................................499–502 FIND command ......................................... 99 finding specific rows.................................. 98 Handling multiple tables...................113–117 Hexadecimal display................................ 102 Initial display ............................................ 87 Input DSN ......................................... 85–135 intervening changes .............................. 86 Join ..................................................108–112 Locking columns ................................. 95–97 Multiple table display.......................113–114 ONLY command ....................................... 99

520

Output DSN ............................................ 135 POINT Command...................................... 85 Row List file Allocating ....................................489–493 Row List indicated................................... 137 Screen elements................................... 89–91 Screen size considerations ......................... 91 Scrolling.............................................. 95–99 Scrolling multiple tables.......................... 114 SELECT RELATED command .................. 94 Select Related line commands ................... 31 Select Related line commands ................... 31 Selecting rows ........................................... 94 selection criteria prompt ............................ 87 Selection criteria prompt............................ 87 session basics ............................................ 88 showing excluded rows.............................. 99 Sidelabels................................................ 107 considerations ..................................... 106 Sidelabels display...................................... 89 sidelabels format ..................................... 103 Start Table Options field ......................... 137 Terminate session.............................135–136 terminating session.................................. 135 Unjoin ..................................................... 117 Unjoining ................................................ 117 UNSELECT RELATED command............. 94 Unselecting rows ....................................... 94 Using Row List and Criteria .................... 311 Validation ............................................... 321 ZOOM .................................................... 115 POPULATE command ..........................271–272 Pop-up window Table selection list .................................... 62 Pop-up Window ............................................. 19 Precision attribute, Point-and-Shoot display.... 92 Primary keys .........................................179–191 Column name .......................................... 186 Commands .............................................. 188 converting to generic ............................... 190 Copy........................................................ 184 Create Process ......................................... 413 Defining ...........................................179–191 deleting ................................................... 188 Description.......................................182–187 Export Process................................... 276–83 output file format ................................ 288 Generic ............................................. 188–91 Import Process................................... 283–86 Line commands ....................................... 186 modifying .........................................186–188 Overview................................................... 15 propagating Cpmvert Process ................................. 430 DB2 LOAD Process ............................ 371 Insert Process...............................343–344 LOADPLUS Process ........................... 376 Propagating Key Set(s) panel............349–350 propagate value ................................248–250 Rename ................................................... 184

Move for DB2

Index Specify partial ..................................501–502 specifying values for extract............... 84–136 Selection list commands........................................... 185 selection list of ........................................ 182 Princeton Softech Directory See Directory ............................................. 15 Printing Extract File/Control File ......... 503, 504 Privot Year Column Maps.......................................... 245 PROP function ......................................248–250 example of use ........................................ 349 for aging.................................................. 246 Propagate, primary key value.................248–250 Propagating Key Set(s) panel ................349–350 PST line command, Create Process........408–413

Q Q1 examples ..........................................154–159 Specify Relationship Usage panel ............ 142 value for referential cycle .................163–167 value for traversal cycle ........................... 160 Q2 and selection criteria................................ 156 examples ..........................................155–159 Specify Relationship Usage panel ............ 142 value for referential cycle .................163–167 value for traversal cycle ........................... 160

R RAND function ............................................ 251 Random Selection Specifying ................................................. 60 Random Selection .......................................... 60 REF Command............................................... 30 Ref Tbl .......................................................... 59 Reference tables............................................. 59 Referential Cycles .................................161–167 Referential Integrity Access Definition use of ............................ 15 Delete Process ......................................... 389 REL Primary command .................................. 32 REL Primary Command ............................... 144 Relationship Alter traversal paths ................................ 161 description............................................... 202 Display tables in context...................... 65–67 Display tables in join context................... 123 Handling RI rules .................................... 161 Impact of changes .................................... 215 Information.............................................. 145 NEW status ......................................146–148 PARAMETERS....................................... 146 Referential Cycles ............................161–167 Specify Relationship Usage Child Limit ......................................... 143

User Manual

Child .................................................. 143 Name.................................................. 143 Parent ................................................. 143 Q1 to extract parents........................... 142 Q2 to extract children of parents ......... 142 Type ................................................... 144 Status affected by changes ......................147–148 Creator ID, changing........................... 149 example .............................................. 148 NEW .................................................. 150 specifying ....................................146–147 UNKNOWN ....................................... 149 UNKNWN.......................................... 149 Traversal Cycles ...............................159–161 UNKNOWN Extract Process Warning ..................... 320 UNSELECT ............................................ 150 USE command......................................... 148 Use New Relationship Prompt ................. 146 Using ...............................................153–161 RELATIONSHIP command Select Tables/Views panel......................... 69 Relationship Usage, report ........................... 152 Relationships ........................................192–221 Alter traversal paths ................................ 153 Column compatibility ........................ 507–12 Column names..................................202–214 Concatenating columns ........................ 207–8 Create Process ..................................413–414 CREATE RELATIONSHIP command .............................144, 192, 193 creating ............................................200–201 Defining ...........................................192–221 editing..............................................201–214 Expanding protected columns .................. 210 Export Process................................... 276–83 output file format ................................ 288 Extract Process, selecting for ................... 152 Generic ............................................. 216–21 Impact of data base changes..................... 170 Import Process................................... 283–86 Line commands for editing ................ 212–13 listing columns while defining ................. 207 Maintain Relationships panel ............ 193–95 modeling ................................................. 215 NEW, Extract Process Warning ............... 320 Overview................................................... 16 Primary Keys........................................... 179 propagating key values .....................349–350 Referential Cycles ................................... 161 REL command........................................... 32 selecting ...........................................141–152 Selection list, commands ..................196–200 Selection List for joining ......................... 112 selection list of .................................. 196–97 SHOW STEPS command............33, 150–151 example .............................................. 150 Specify Relationship Usage Panel ............ 144 Status ...................................................... 142

521

Index substringing columns ......................... 208–10 using as a model for others ................ 215–16 REMOTE, on Select Tables/Views................. 57 RENAME statement Batch Maintenance Utilities PST objects..................................478–480 Report Convert Process................................433–435 Delete Process ..................................388–389 Extract Process .................................330–331 Insert Process ...................................361–362 REPORT command Export Process......................................... 283 Import Process......................................... 286 Report DSN, Export Process ........................ 278 Report Invalid Dates .................................... 348 Report Skipped Dates................................... 348 Reports, Default JCL.................................... 460 REQUIRD, Column Map status.................... 236 Restart process overview.................................................. 332 Parameters .............................................. 439 Retry process overview.................................................. 332 Parameters .............................................. 439 Retry/Restart Control File ............................................. 437 Retry/Restart Process ............................436–439 Menu Option ........................................... 436 Parameters .............................................. 439 Pending process attributes ....................... 438 Pending Process List................................ 436 RF field ......................................................... 59 Right, scroll direction..................................... 95 Row Limit by table......................................... 60 Row List Create File .......................................499–502 Indicator.................................................... 56 option for Extract Process ........................ 311 RUNSTATS DB2 LOAD Process................................. 382

S Sample session............................................... 23 Browse Extract File ................................... 38 Data Migration menu................................. 27 Destination, specify ................................... 38 Extract Parameters .................................... 35 Extract Process Menu ................................ 28 Extract Process Report............................... 37 GET TABLES RELATED ......................... 30 GET TABLES RELATED command.......... 28 Insert Process Control File .................................... 38, 39 Extract File........................................... 38 limit discarded inserts........................... 42 menu .............................................. 38, 39

522

online/batch .......................................... 42 Options................................................. 39 perform................................................. 42 Table Map ............................................ 39 Update/Insert ........................................ 39 Object definitions, specify ......................... 33 Perform Extract Process............................. 35 POINT command....................................... 30 Point-and-Shoot................................... 31, 32 REL command........................................... 32 SHOW STEPS........................................... 33 specify criteria........................................... 30 Specify destination .................................... 42 Specify source ........................................... 27 Temporary specifications ........................... 28 SAVE command Access Definition ...................................... 70 Column Map for Table Maps................... 274 Column Maps.......................................... 255 Relationship definition ............................ 214 Table Maps ............................................. 268 Saving batch JCL ......................................... 327 DB2 LOAD process................................. 378 Insert Process .......................................... 360 Screen elements ....................................... 89–91 Screen format................................................. 19 Scrolling columnar format, Point-and-Shoot.............. 95 ISPF function....................................... 20–21 joined display .......................................... 114 locking columns......................................... 95 Point-and-Shoot Expanding columns............................. 101 Select Tables/Views .................................. 67 sidelabels format ..................................... 103 Tables selection list ................................... 62 Zoomed Describe Columns/Specify Selection Criteria ................................................. 79 Security status Access Definition .............................228–261 SEL Command Example......................................................... 72 Extract Process batch override...................... 323 Select Access Definition panel SELECT Primary Command Column Map selection list ....................... 229 Export Process......................................... 280 Table Maps ............................................. 262 Select Primary Keys panel............................ 182 SELECT RELATED command....................... 94 Select Related line commands ........................ 94 Select Tables, selection list ............................ 63 Select Tables/Views Access rights ............................................. 58 ALL Command.......................................... 72 Commands ................................................ 68 line ....................................................... 69 CREATE RELATIONSHIP command........ 65 Delete tables from ..................................... 67 Every Nth.................................................. 60

Move for DB2

Index GET TABLES RELATED command.... 63–64 INDENT.................................................... 65 Line commands ......................................... 67 LIST command .......................................... 61 LIST TABLES RELATED command ......... 63 Modify table names ................................... 68 Row Limit ................................................. 60 Scrolling.................................................... 67 selection list .............................................. 62 Status indicator.......................................... 83 table criteria indicator................................ 57 Table criteria indicators............................. 57 Type indicator .......................................... 59 Table name................................................ 58 Selection criteria ...................................... 71–75 Defining .................................................... 80 specifying............................................ 72–81 Selection Criteria ALL Command.......................................... 72 Defining ...................................73–74, 79–81 Extract Process batch override ................. 323 Group selection processing ...................... 140 Group Selection Processing ..................... 138 Random factor ........................................... 71 Row limit .................................................. 71 Valid operators.......................................... 74 SELECTION CRITERIA command Point-and-Shoot......................................... 87 Select Tables/Views panel......................... 69 Selection list Access Definition ...................................... 48 Column Maps.......................................... 226 for Table Maps ................................... 269 Column Maps from Table Map .........270–271 columns in primary key............................ 187 Convert Process, Extract File/Control File431 Column Map Copy........................................... 228, 261 Rename ...................................... 229, 262 Copy........................................................ 182 Export Process Object Definitions ........... 280 Extract File ............................................. 313 Extract Process, Access Definition........... 307 Grant privileges objects ........................... 423 indexes, primary keys .............................. 187 Insert Process, Extract File/Control File... 336 Pending Process List................................ 436 POPULATE command............................. 272 Primary Keys........................................... 182 Relationships, for joining......................... 112 Rename ................................................... 183 Table browse Control File ............................ 442 browse Extract File ............................. 442 Column Map specification .................. 233 related .................................................. 63 Table Maps ............................................. 259 Tables when joining ................................ 111 Selection lists of columns for group selection ..................... 138

User Manual

columns when defining relationship......... 206 relationships...................................... 196–97 SEQ function ............................................... 251 Session options .............................447, 448, 455 Editor .............................................. 454, 458 Job Card and Print................................... 460 User ................................................ 448, 452 Severing a join ............................................. 117 Short name, Tn .............................................. 90 SHOW command Column Map status.................................. 239 CREATE Object List ............................... 414 Primary keys selection list ....................... 185 SHOW SQL command saving the output ..................................... 126 SHOW STEPS Command Extract Process ........................................ 321 example........................................... 150, 151 overview.................................................... 33 SHOW STEPS display, OUTPUT command. 151 SID line command........................................ 103 Sidelabels considerations.......................................... 106 Display column attributes ........................ 107 expanding data ........................................ 105 Expanding data........................................ 104 Joining during ......................................... 107 Line commands during ............................ 107 Max Disp Width option ........................... 456 Zoom....................................................... 107 SIDELABELS command .............................. 103 Sidelabels format Point-and-Shoot................................. 89–103 scrolling .................................................. 103 Single View Mode option............................. 458 Site and User Options .................................. 447 Skipped Dates DATE and TIMESTAMP ........................ 246 identifying ............................................... 509 specify handling ...................................... 348 Sort, using LOADPLUS to ........................... 363 SORT command Primary keys selection list ....................... 185 Sort criteria.................................................... 76 Source 2, Table type, Table Map .................. 268 Source name, Table Map...................... 264, 336 Source Types Specify for Table Maps............................ 263 Table Map Objects .................................. 265 SPC_REG, Column Map status .................... 236 Special Registers Colum Maps............................................ 242 Column Map ........................................... 238 Column Map functions ............................ 251 Column Maps...................................236–238 Specify Relationship Usage Panel..........141–144 Commands .............................................. 144 CREATE RELATIONSHIP command...... 144 Specify Selection Criteria panel...................... 73 Column name ............................................ 74

523

Index Commands ................................................ 75 Selection Criteria field............................... 74 Specifying Options....................................... 447 User ........................................................ 448 SQL Data type................................................... 78 displaying................................................ 124 Extract Process batch override ..........324–325 Grant privileges....................................... 424 Indicator, Select Tables/Views panel ......... 57 Output, Create Process .....................426–427 Review Create Process ............................ 410, 415 grant privileges ................................... 423 Insert Process...................................... 353 Synonyms, Create Process................... 426 valid syntax ............................................... 74 WHERE Clause panel ......................... 79–82 Available commands ............................. 81 Correlation Name.................................. 80 deleting clause ...................................... 81 LIST COLUMNS.................................. 81 SQLEDIT command.............................. 81 Status identified.................................... 83 SQL command, Select Tables/Views panel..... 69 SQL line command, Create Process .......408–415 SQL WHERE Clause Extract Process batch override ..........324–325 Line commands ......................................... 81 SQLEDIT command....................................... 81 SQLID Choose a Definition Option panel ............ 177 Choose an Access Definition...................... 46 Migration Menu ...................................... 302 SQLID ........................................................... 26 SRC line command, insert source column..... 246 Stack for join .................................................... 118 Unjoining ................................................ 124 START command......................................... 114 Start Table, Specification of ........................... 55 Start Table Options Group selection processing ...................... 140 Point-and-Shoot....................................... 137 Status Column Map columns.......................235–237 Submit jobs with END, User option ............. 449 SUBSTR function ...........................208–10, 250 Substringing columns in relationships .... 208–10 SUBSYS Choose a Definition Option panel ............ 177 Choose an Access Definition...................... 46 Display option ......................................... 449 Main Menu ............................................... 26 Migration Menu ...................................... 303 Subsystem, Export/Import Processes............. 275 SWITCH command ...................................... 120 Synonym Create Process ..................................424–426 Type indicator ........................................... 59

524

SYSIBM.SYSINDEX................................... 188

T Table Column Map source................................. 230 column specifications indicator .................. 57 definition................................................... 14 displaying multiple .................................. 113 Duplicate names ...................................... 173 Impact of data base changes..................... 170 join availability option............................. 171 Levels ....................................................... 14 maximum display levels .......................... 114 Naming conventions ........................... 17– 19 Selecting ................................................... 55 error handling ....................................... 70 Error handling....................................... 70 Selection list browse Control File ............................ 442 browse Extract File ............................. 442 Table Map ...................................337–338 Create Process................................ 406 Tn identifier .............................................. 90 Type indicator ........................................... 59 Table defaults, Create Process...............392–395 Description .................................................. 260 Table Map Convert Process....................................... 429 Copy........................................................ 261 Create Process ......................................... 404 DB2 LOAD process................................. 364 DB2 LOAD Process................................. 364 Defining .................................................. 264 Grant Privileges....................................... 421 Insert Process .......................................... 336 option ................................................. 335 Rename ................................................... 262 Sample session .......................................... 39 Sample Session ......................................... 41 Source 1 Table Name Field...................... 265 Table Maps.................................................. 256 APPLY command .............................267–268 Choose a Table Map panel....................... 256 Column Map ID Field.............................. 264 Column Map Name ................................. 265 Column Maps.......................................... 274 Column Maps, including.......................... 269 Create Process ......................................... 407 Defining ...........................................256–265 Deleting .................................................. 262 description............................................... 266 Description.............................................. 260 Display Information................................. 260 Export Process................................... 276–83 output file format .........................290–292 Import Process................................... 283–86 LIST MAPS............................................. 269 LIST TABLES......................................... 266

Move for DB2

Index LIST UNUSED example.......................... 266 MAP ID................................................... 257 MAP NAME ........................................... 257 MAPS command...................................... 273 Name, explicit values .............................. 258 Naming conventions .................................. 17 Object Type............................................. 265 Object Types ........................................... 265 Overview............................................. 11–16 POPULATE Command.....................271–272 Saving ..................................................... 268 SELECT Primary Command .................... 262 Selection List .......................................... 259 Source 2 Table Name Field...................... 265 Specify Source Types............................... 263 Src 1 CID ................................................ 264 Src 2 CID ................................................ 264 Validation rules............................... 257, 258 Tables creating relationships........................200–201 Name specification .................................... 58 Selecting for Access Definition .................. 54 Selection List, for joining ........................ 111 Tables Map, UNKNOWN ............................ 265 TABLES, Extract Process Option see also Select Tables/Views ................... 305 Tablespace defaults, Create Process ......395–399 Tablespace defaults, Create Process ............. 392 Temporary Table, TEMPTABLE.................... 58 TEMPTABLE, Access Definition status ......... 58 Terminating, Point-and-Shoot....................... 135 Terminology................................................... 14 TIMESTAMP, Aging DB2 column............... 246 Tn, table identifier ......................................... 90 Top, scroll direction ....................................... 95 Tutorial.......................................................... 20 Help key.................................................... 20

UNSELECT command, Export Process ........ 280 UNSELECT RELATED command ................. 94 Unselect Related line commands .................... 94 Unzoom Describe Columns/Specify Selection Criteria ............................................................. 78 Up, scroll direction......................................... 95 Update Process Insert vs Update................................339–340 overview.................................................. 340 Parameters .............................................. 341 USE command ............................................. 148 USER Access Definition name ............................. 14 Access Definition specification .................. 47 Profiled ..................................................... 48

U

YEAR, Insert Process batch override ............ 355

UNJOIN command Multi-way join..................................123–124 Unjoining tables........................................... 117 UNKNOWN batch override Extract Process ................................... 325 Insert Process...................................... 359 Column Map status.................................. 236 Extract Process Warnings ........................ 320 Relationship status ...........................142–149 Table Map Table type.............................. 265 Table Map, Type value ............................ 337 UNKNWN, Relationship status .................... 149 UNLOAD PLUS .......................................... 328 UNLOAD PLUS utility Extract Process .................................313–315 UNLOCK Command...................................... 97 Sidelabels format..................................... 104 UNSEL, Relationship status ......................... 142

Z

User Manual

V VALIDATION command.............................. 238 Validation rules Column Maps.......................................... 225 Table Maps ............................................. 257 View Creator ID defaults, Create Process...403–404 Name specification .................................... 58 Single Mode option ................................. 458 Type indicator ........................................... 59 View identifier (Vn)....................................... 90 VIEWERR ..................................................... 57 Vn, view identifier ......................................... 90

W Warnings, Extract Process.....................320–321

Y

Zoom Describe Columns/Specify Selection Criteria ............................................................. 79 joined tables .................................... 115, 116 ZOOM command Describe Columns ..................................... 79 Joined tables............................................ 115 Specify Selection Criteria panel...................... 79

525

Index

526

Move for DB2

Related Documents

User Guide For Linux
May 2020 10
Db2 V8 Administration Guide
October 2019 26
Cics-db2 Interface Guide
November 2019 11
User Guide
April 2020 41
Cics Db2 Guide
November 2019 4