Generate for DB2

This document covers the following topics:

Prerequisites

Generation of DB2 objects is subject to DB2 security mechanisms. See the section DB2 and SQL/DS in the Predict and Other Systems documentation for more information.


Common Parameters for All DB2 Types

The following parameters can be set in all DB2 object types.

Parameters
SQL Server The SQL server, the object will be implemented in. The value is preset with the value specified in the user or system profile.
Use SQLID To switch from the logon user ID to a group ID in DB2, you can enter a different SQL ID in this field. The statement SET CURRENT SQLID will then be submitted.
List DB2 statement
Y List the generated DB2 SQL statements.
Protocol saved in member SQL statements generated for the implementation of the database can be saved in a Natural source member (protocol) on the FDIC file. A member name for the protocol is only required when the DB2 object is generated for the first time. SQL statements generated in subsequent generation runs are concatenated to the protocol. The protocol can be displayed using the Display function of the Administration Implemented object-type menu.
Protocol saved in library Library where the protocol is to be saved.

DB2 Database

A DB2 database can be implemented with Predict by generating the necessary SQL statements. An additional confirmation is requested before the DB2 database is actually implemented. The generated SQL statements can be saved in a generation protocol.

Note:
This function is only available if DB2 is installed in your environment. The function is not applicable to SQL/DS.

The following topics are covered below:

Calling the Function

The Generate DB2 Database screen is displayed with function code G and object code D2 in a Predict main menu, or with the command GENERATE DB2-DATABASE.

 13:23:54              *****  P R E D I C T  *****             2007-05-31
 Plan   0                   - Generate DB2 Database -                           
                                                                                
                                                                                
                                                                                
                                                                                
 Database ID ..............*                                                    
 SQL Server ...............*                                  <Default Server>  
                                                                                
 Add database .............. Y  (Y,N)                                           
 Update database ........... N  (Y,N)                                           
                                                                                
 Use SQLID .................                                                  
 List DB2 statement ........ Y  (Y,N)                                           
                                                                                
 Protocol saved in member .. *                                                  
                in library . DB2LIB                                             
                                                                                
                                                                                
                                                                                
 Command ===>                                                                   
 Enter-PF1---PF2---PF3---PF4---PF5---PF6---PF7---PF8---PF9---PF10--PF11--PF12---
       Help  Next  Stop  Last  LnkEl Flip  Print Impl  AdmFi SelFi Prof  Main   

Parameters

Values for fields which have been locked by your data dictionary administrator cannot be overwritten. These fields are skipped when positioning the cursor with the TAB key. See Generation Defaults.

Common parameters which are not included in the table below are described under Common Parameters for All DB2 Types.

Presetting
The parameter below can be changed in the Modify DB2 Database Defaults screen. See Generation Defaults.
Count of saved actions Number (0-99) of generation actions which are stored in the protocol specified under Protocol saved in member/library. If 99 is entered, all generation actions are stored. This is the default setting at installation.
Parameters
Database ID ID of the Predict database object from which the DB2 database is to be generated. Enter an asterisk to display a selection screen. Alternatively, use an asterisk as a wildcard. For example, enter "A*" to display IDs beginning with A only.
Add database
Y A new DB2 database is created. If the DB2 database already exists, this parameter must be set to N.
Update database
Y If the database is already implemented, the differences of the implemented database and the Database object in Predict are determined and update commands are generated to modify the implemented database according to the Predict object.

Generate DB2 Database in Batch Mode

Command: GENERATE DB2-DATABASE

Enter parameters on next line in positional or keyword form. Database ID is obligatory, all other parameters are optional.

Field Keyword Position
Database ID DB 1
List DB2 statement LIST 2
Protocol saved in member MEM 3
Protocol saved in library LIB 4
Add database ADD-DB 5
Update database UPD-DB 6
Use SQLID SQLID 7
SQL Server SQL-SERVER 8

If a parameter is not specified, the default value is taken.

If you explicitly set SQL-SERVER to blank in order to use the default server, another keyword must be specified after the SQL-SERVER keyword. If it is not possible to specify another keyword, the SQL-SERVER keyword must be followed by "D1=*" as shown below:

SQL-SERVER= ,D1=*

Sample Output

Database-ID: EXAM-DATABASE

CREATE DATABASE EXAMDB
    STOGROUP EXAM001
    BUFFERPOOL BP1;

DB2 Procedure/Function

A DB2 procedure or function requires an object of type Program as input, from which then either a procedure or a function is generated.

Note:
This function is only available if DB2 is installed in your environment. The function is not applicable to SQL/DS.

The following topics are covered below:

Calling the Function

The Generate DB2 Proc/Function screen is displayed with function code G and object code P2 in a Predict main menu, or with the command GENERATE DB2-PROCEDURE.

 13:39:51             *****  P R E D I C T  *****              2007-05-31
 Plan                   - Generate DB2 Proc/Function -                          
                                                                                
                                                                                
                                                                                
 Program ID ...............*                                                    
 SQL Server ...............*                                  <Default Server>  
                                                                                
 Add procedure/function .... Y (Y,N)      Replace procedure/function .. N (Y,N) 
 Update procedure/function . N (Y,N)      Comment on .................. N (Y,N) 
                                                                                
 Use SQLID .................                                                  
 List DB2 statements ....... Y (Y,N)                                            
                                                                                
 Protocol saved in member .. *                                                  
                in library . DB2LIB                                             
                                                                                
                                                                                
                                                                                
                                                                                
 Command ===>                                                                   
 Enter-PF1---PF2---PF3---PF4---PF5---PF6---PF7---PF8---PF9---PF10--PF11--PF12---
       Help  Next  Stop  Last  LnkEl Flip  Print Impl  AdmFi SelFi Prof  Main   

Parameters

Values for fields which have been locked by your data dictionary administrator cannot be overwritten. These fields are skipped when positioning the cursor with the TAB key. See Generation Defaults.

Common parameters which are not included in the table below are described under Common Parameters for All DB2 Types.

Presetting
The parameter below can be changed in the Modify DB2 Proc/Function Defaults screen. See Generation Defaults.
Count of saved actions Number (0-99) of generation actions which are stored in the protocol specified under Protocol saved in member/library. If 99 is entered, all generation actions are stored. This is the default setting at installation.
Parameters
Program ID

ID of the Predict program object from which the DB2 procedure/function is to be generated.

The procedure name or function name is unique in Predict. However, in DB2, there can be several objects with the same name in different schemata. Therefore the object type Program has been extended by the attribute Schema. If no schema is given for a program, the correlation of the documentation and an implementation can be driven by the user, that is:

  • If there is no object with the specified name in DB2, a CREATE statement is generated.

  • If an object already exists in DB2, you are asked whether the specified object is the correct one, or if you want to create a new object. If you want to create a new object, a CREATE statement is generated, otherwise an ALTER statement is generated.

Enter an asterisk to display a selection screen. Alternatively, use an asterisk as a wildcard. For example, enter "A*" to display IDs beginning with A only.

Note:
The option Use SQLID can be set to choose a specific SQLID before the generation. It influences the allocation of the schema to which an object belongs. If no schema was given for an object of type Program, the documentation is supplemented by the SQLID after successful generation.

Add procedure/function
Y A new DB2 procedure/function is created. If the DB2 procedure/function already exists, this parameter must be set to N.
Replace procedure/function
Y An existing procedure/function in DB2 is dropped and created newly.
Update procedure/function
Y If the procedure/function is already implemented, the differences of the implemented procedure/function and the program object in Predict are determined and update commands are generated to modify the implemented procedure/function according to the Predict object.
Comment on
Y The first eight abstract lines of Predict field and file objects are used as DB2 comments for the columns and the table (SQL statement COMMENT ON).

Note:
Links concerning the associations IN (Input FI) and RE (Returns FI) define the input and output parameters of the procedure or function.

Generate DB2 Procedure/Function in Batch Mode

Command: GENERATE DB2-PROCEDURE

Enter parameters on next line in positional or keyword form. Program ID is obligatory, all other parameters are optional.

Field Keyword Position
Program ID PROGRAM-ID 1
Add procedure/function ADD-PROCEDURE 2
Update procedure/function UPD-PROCEDURE 3
Replace procedure/function REPLACE 4
Comment on COMMENT 5
List DB2 statement LIST 6
Protocol saved in member MEM 7
Protocol saved in library LIB 8
Use SQLID SQLID 9
SQL Server SQL-SERVER 10

If a parameter is not specified, the default value is taken.

If you explicitly set SQL-SERVER to blank in order to use the default server, another keyword must be specified after the SQL-SERVER keyword. If it is not possible to specify another keyword, the SQL-SERVER keyword must be followed by "D1=*" as shown below:

SQL-SERVER= ,D1=*

DB2 Table/View

The Generate DB2 Table / View function:

  • Generates DB2 and SQL/DS Table/View/Indexes. If a table contains a LOB column, the function generates a SET CURRENT RULE='STD' statement which allows DB2 to create the necessary auxiliary tablespaces, tables and indexes for these objects.

  • Generates distinct types.

  • Generates check expressions. A check expression that differs from the documentation in Predict is dropped and recreated.

  • Generates triggers. If a trigger is linked to a DB2 view, an INSTEAD OF trigger is generated. A trigger that differs from the documentation in Predict is dropped and recreated.

  • Modifies existing DB2 and SQL/DS Table/Indexes, replaces DB2 and SQL/DS Views/Indexes or

  • Purges indexes from DB2 or SQL/DS tables if no longer documented with a corresponding Predict file object of file type D (DB2 Table).

  • Purges masks or permissions from DB2 tables if no longer documented with a corresponding Predict file object of file type D (DB2 Table).

Note:
If an XML column (Field format LO and Character Set X) is added for the first time to a DB2 table, you are recommended to run the function Compare DB2 table after the generation of the DB2 table. The function Compare DB2 table must be executed with the update options Add fields and Field attributes set to Y.

The following topics are covered below:

Calling the Function

The Generate DB2 Table/View screen is displayed with function code G and object code T2 in a Predict main menu, or with the command GENERATE TABLE.

17:08:57                *****  P R E D I C T  *****                  2011-11-16
Plan   0               - Generate DB2 Table / View -                           
                                                                               
                                                                               
                                                                               
File ID ..................*                                                    
SQL Server ...............*                                  <Default Server>  
                                                                               
Add table / view .......... N (Y,N)      Replace view .............. Y (Y,N)   
Add index ................. Y (Y,N)      Defer option for indexes .* N         
Update table .............. Y (Y,N)      Label on .................. N (Y,N)   
Update index .............. Y (Y,N)      Comment on ................ N (Y,N)   
Purge index ............... Y (Y,N)      Column masks .............* E         
                                         Row permissions ..........* X         
Use SQLID .................                                                    
List DB2 statements ....... Y (Y,N)                                            
                                                                               
Protocol saved in member .. *                                                  
               in library . DB2LIB                                             
                                                                               
Command ===>                                                                   
Enter-PF1---PF2---PF3---PF4---PF5---PF6---PF7---PF8---PF9---PF10--PF11--PF12---
      Help  Next  Stop  Last  LnkEl Flip  Print Impl  AdmFi SelFi Prof  Main   

Parameters

Values for fields which have been locked by your data dictionary administrator cannot be overwritten. These fields are skipped when positioning the cursor with the TAB key. See Generation Defaults.

Common parameters which are not included in the table below are described under Common Parameters for All DB2 Types.

Presetting
The parameter below can be changed in the Modify DB2 Table/View Defaults screen. See Generation Defaults.
Count of saved actions Number (0-99) of generation actions which are stored in the protocol specified under Protocol saved in member/library. If 99 is entered, all generation actions are stored. This is the default setting at installation.
Parameters
File ID

ID of the Predict file object from which the DB2 table/view is to be generated. Enter an asterisk to display a selection screen. Alternatively, use an asterisk as a wildcard. For example, enter "A*" to display IDs beginning with A only.

Only Files of type D, E or MT can be used.

Add table/view
Y A new DB2 table/view is created. If the DB2 table already exists, this parameter must be N.
Replace view
Y If the DB2 view already exists, the DB2 statements DROP VIEW and COMMIT are generated first, followed by the CREATE VIEW statement.
Add index If DB2 indexes are defined for the DB2 table in Predict, set this option to Y to generate the CREATE INDEX statements.
Update table
Y If the DB2 table/view is already implemented, commands are generated to adapt the DB2 table/view to the documentation (if differences were found). This includes the generation of necessary ALTER TABLE DROP COLUMN statements for fields that are no longer documented.
Update index
Y

If the DB2 index is already implemented, update commands are generated to adapt the DB2 index to the documentation (if differences were found).

Updating DB2 indexes is only possible for differences of the following attributes: buffer pool, close, freepage, pctfree, VSAM catalog, storage group, primary allocation, secondary allocation, erase, index type, GBPCACHE, piece size.

If any other attributes differ, Update index and Purge index must be set to Y. Predict will then update the index by issuing the statements DROP INDEX, COMMIT and CREATE INDEX.

Purge index
Y A DROP INDEX and a COMMIT statement are generated if a DB2 index exists and no corresponding index is defined in Predict.

Note:
Partitioned indexes cannot be purged.

Column masks
Options for column masks. Possible values:
E Enable
D Disable
A Activate
X Deactivate
EA Enable & Activate
EX Enable & Deactivate
DA Disable & Activate
DX Disable & Deactivate
Row permissions Options for row permissions. Possible values: See Column masks option above.
Defer option for indexes
Y The SQL statement CREATE INDEX is generated with the option DEFER YES.
N The SQL statement CREATE INDEX is generated without the option DEFER YES.
S A list containing all indexes is displayed. Enter Y for indexes which you would like to generate with the option. If you enter N or leave the field blank, the CREATE INDEX statement is generated without this option.
Label on
Y The string specified in the Predict field attribute Header1 is used as DB2 label for the columns (SQL statement LABEL ON).

Note:
If Label on is set to Y, existing labels are generally overwritten even if Header1 is not specified in Predict for each column in the table.

Comment on
Y The first eight abstract lines of Predict field and file objects are used as DB2 comments for the columns and the table (SQL statement COMMENT ON).

Note:
Comment on is set to Y, existing comments are generally overwritten even if no abstract is specified in Predict.

Special Considerations for Temporal Tables and Archive-Enabled Tables

When generating temporal tables, Predict only requires the name of the history or archive table to be used. This history or archive table is then automatically generated and connected to the base table. The history or archive table name can be provided when documenting a temporal table in Predict.

If you want to use a history or archive table with an index of its own then this history or archive table must be documented separately in Predict. Indexes can then be defined manually where required.

Such a separate history or archive table must then also be generated separately. The connection between the base table and the history or archive table, that is normally maintained automatically in Predict, will then be dropped. You will have to manually and individually apply changes made to the base table also in the history or archive table.

After the changes have been applied, you will have to generate both, the base table and the history or archive table, individually in order for the changes to take effect.

A third generation process is then required to reestablish the connection between the base table and the history or archive table.

Generate DB2 Table/View in Batch Mode

Command: GENERATE TABLE

Enter parameters on next line in positional or keyword form. File ID is obligatory, all other parameters are optional.

Field Keyword Position
File ID FILE-ID 1
Add table/view ADD-TABLE 2
Add index ADD-INDEX 3
Update table UPD-TABLE 4
Update index UPD-INDEX 5
Purge index PURGE-INDEX 6
Replace view REPLACE 7

Note:
For compatibility reasons only

PSW 8
List DB2 statements LIST 9
Protocol saved in member MEM 10
Protocol saved in library LIB 11
Label on LABEL 12
Comment on COMMENT 13
Defer option for indexes DEFER 14
Use SQLID SQLID 15
SQL Server SQL-SERVER 16
Column masks MASK 17
Row permissions PERMISSION 18

If a parameter is not specified, the default value is taken.

If you explicitly set SQL-SERVER to blank in order to use the default server, another keyword must be specified after the SQL-SERVER keyword. If it is not possible to specify another keyword, the SQL-SERVER keyword must be followed by "D1=*" as shown below:

SQL-SERVER= ,D1=*

Sample File Definition

The following file definition was used for generating the sample output:

File ID ............ EXAM-GEN_TABLE
-------------------------------------------------------------------------------

DB2 attributes
  Number of partitions ..
  Edit program .......... PROGDB
  Validation program ....
  Audit ................. N Audit none
  OBid .................. 0
  Data capture ..........
  Max. length ........... 4056

Abstract
  this are comments for table
  exam-gen_table

Cnt  Ty L Field ID                         F  Cs  Length D DB N Df

   1    1 EMPNO                            A        6.0  P AA R N
          Field is defined as unique
          Source field(s)                     Order
          EMPNO                               ascending
   2    1 FIRSTNME                         AV      12.0  N AB R N
   3    1 MIDINIT                          A        1.0  N AC R N
   4    1 LASTNAME                         AV      15.0  N AD R N
   5    1 WORKDEPT                         A        3.0  F AE R Y
          Source field(s)                     Order
          WORKDEPT                            ascending
   6    1 PHONENO                          A        4.0  N AF R Y
   7    1 HIREDATE                         D             N AG R Y
   8    1 JOB                              A        8.0  N AH R Y
   9    1 EDLEVEL                          I        2.0  N AI R Y
  10    1 SEX                              A        1.0  N AJ R Y
  11    1 BIRTHDATE                        D             N AK R Y
  12    1 SALARY                           PS       7.2  N AL R Y
  13    1 BONUS                            PS       7.2  N AM R Y
  14    1 COMM                             PS       7.2  N AN R Y
*** End of report ***

Sample Output

File-ID: EXAM-GEN_TABLE
CREATE TABLE EXAM.GEN_TABLE
   (EMPNO                    CHAR(6)          NOT NULL,
    FIRSTNME                 VARCHAR(12)      NOT NULL,
    MIDINIT                  CHAR(1)          NOT NULL,
    LASTNAME                 VARCHAR(15)      NOT NULL,
    WORKDEPT                 CHAR(3)          NOT NULL WITH DEFAULT,
    PHONENO                  CHAR(4)          NOT NULL WITH DEFAULT,
    HIREDATE                 DATE             NOT NULL WITH DEFAULT,
    JOB                      CHAR(8)          NOT NULL WITH DEFAULT,
    EDLEVEL                  SMALLINT         NOT NULL WITH DEFAULT,
    SEX                      CHAR(1)          NOT NULL WITH DEFAULT,
    BIRTHDATE                DATE             NOT NULL WITH DEFAULT,
    SALARY                   DECIMAL(9, 2)    NOT NULL WITH DEFAULT,
    BONUS                    DECIMAL(9, 2)    NOT NULL WITH DEFAULT,
    COMM                     DECIMAL(9, 2)    NOT NULL WITH DEFAULT,
    PRIMARY KEY (EMPNO))
   IN DATABASE EXAMDB
   EDITPROC PROGDB
   AUDIT NONE;
CREATE UNIQUE INDEX PRDDBA.EMPNO
   ON EXAM.GEN_TABLE
      (EMPNO                       ASC)
   SUBPAGES 4
   BUFFERPOOL BP0
   CLOSE YES;
CREATE INDEX DSN8210.XEMP2
   ON EXAM.GEN_TABLE
      (WORKDEPT                    ASC)
   SUBPAGES 4
   BUFFERPOOL BP0
   CLOSE YES;

DIC1880 SUMMARY:     14 FIELD(S) PROCESSED

DB2 Storagegroup

A DB2 storagegroup can be implemented with Predict by generating the necessary SQL statements. An additional confirmation is requested before the DB2 storagegroup is actually implemented. The generated SQL statements can be saved in a generation protocol.

The following topics are covered below:

Calling the Function

The Generate DB2 Storagegroup screen is displayed with function code G and object code SG in a Predict main menu, or with the command GENERATE STORAGEGROUP.

 13:43:43             *****  P R E D I C T  *****              2007-05-31
 Plan                    - Generate DB2 Storagegroup -                          
                                                                                
                                                                                
                                                                                
 Storagespace ID ..........*                                                    
 SQL Server ...............*                                  <Default Server>  
                                                                                
 Add storagegroup .......... Y  (Y,N)                                           
 Update storagegroup ....... N  (Y,N)                                           
                                                                                
 Use SQLID .................                                                  
 List DB2 statements ....... Y  (Y,N)                                           
                                                                                
 Protocol saved in member .. *                                                  
                in library . DB2LIB                                             
                                                                                
                                                                                
                                                                                
                                                                                
 Command ===>                                                                   
 Enter-PF1---PF2---PF3---PF4---PF5---PF6---PF7---PF8---PF9---PF10--PF11--PF12---
       Help  Next  Stop  Last  LnkEl Flip  Print Impl  AdmFi SelFi Prof  Main   

Parameters

Values for fields which have been locked by your data dictionary administrator cannot be overwritten. These fields are skipped when positioning the cursor with the TAB key. See Generation Defaults.

Common parameters which are not included in the table below are described under Common Parameters for All DB2 Types.

Presetting
The parameter below can be changed in the Modify DB2 Storagegroup Defaults screen. See Generation Defaults.
Count of saved actions Number (0-99) of generation actions which are stored in the protocol specified under Protocol saved in member/library. If 99 is entered, all generation actions are stored. This is the default setting at installation.
Parameters
Storagespace ID ID of the Predict storagespace object from which the DB2 storagegroup is to be generated. Enter an asterisk to display a selection screen. Alternatively, use an asterisk as a wildcard. For example, enter A* to display IDs beginning with A only.
Add storagegroup
Y A new DB2 storagegroup is created. If the DB2 storagegroup already exists, this parameter must be set to N.
Update storagegroup
Y If the DB2 storagegroup is already implemented, commands are generated to adapt the DB2 storagegroup to the documentation (if differences were found).

Generate DB2 Storagegroup in Batch Mode

Command: GENERATE STORAGEGROUP

Enter parameters on next line in positional or keyword form. Storagespace ID is obligatory, all other parameters are optional.

Field Keyword Position
Storagespace ID STORAGESPACE-ID 1
Add Storagegroup ADD-STORAGEGROUP 2
Update Storagegroup UPD-STORAGEGROUP 3
List DB2 statements LIST 4
Protocol saved in member MEM 5
Protocol saved in library LIB 6

Note:
For compatibility reasons only.

PASSWORD 7
Use SQLID SQLID 8
SQL Server SQL-SERVER 9

If a parameter is not specified, the default value is taken.

If you explicitly set SQL-SERVER to blank in order to use the default server, another keyword must be specified after the SQL-SERVER keyword. If it is not possible to specify another keyword, the SQL-SERVER keyword must be followed by "D1=*" as shown below:

SQL-SERVER= ,D1=*

Sample Output

Storagespace-ID: EXAM-STORAGEGROUP

CREATE STOGROUP EXAM001
       VOLUMES (VOL05 )
       VCAT DB2;

DB2 Tablespace

A DB2 tablespace can be implemented with Predict by generating the necessary SQL statements. Additional confirmation is requested before the DB2 tablespace is actually implemented. The generated SQL statements can be saved in a generation protocol.

The following topics are covered below:

Calling the Function

Display the Generate DB2 Tablespace screen with code G and object code TS in a Predict main menu, or with the command GENERATE TABLESPACE.

18:18:13                *****  P R E D I C T  *****                  2011-11-16
Plan                    - Generate DB2 Tablespace -                            
                                                                               
                                                                               
                                                                               
Dataspace ID .............* HNO-DC                                             
SQL Server ...............*                                  <Default Server>  
                                                                               
Add tablespace ............ Y  (Y,N)                                           
Update tablespace ......... N  (Y,N)                                           
                                                                               
Define .................... Y  (Y,N)     Partitions initialized ....           
                                                                               
Use SQLID .................                                                    
List DB2 statements ....... Y  (Y,N)                                           
                                                                               
Protocol saved in member .. *                                                  
               in library . DB2LIB                                             
                                                                               
                                                                               
Command ===>                                                                   
Enter-PF1---PF2---PF3---PF4---PF5---PF6---PF7---PF8---PF9---PF10--PF11--PF12---
      Help  Next  Stop  Last  LnkEl Flip  Print Impl  AdmFi SelFi Prof  Main   

Parameters

Values for fields which have been locked by your data dictionary administrator cannot be overwritten. These fields are skipped when positioning the cursor with the TAB key. See Generation Defaults.

Common parameters which are not included in the table below are described under Common Parameters for All DB2 Types.

Presetting
The parameter below can be changed in the Modify DB2 Tablespace Defaults screen. See Generation Defaults.
Count of saved actions Number (0-99) of generation actions which are stored in the protocol specified under Protocol saved in member/library. If 99 is entered, all generation actions are stored. This is the default setting at installation.
Parameters
Dataspace ID ID of the Predict dataspace object from which the DB2 tablespace is to be generated. Enter an asterisk to display a selection screen. Alternatively, use an asterisk as a wildcard. For example, enter A* to display IDs beginning with A only.
Add tablespace
Y A new DB2 tablespace is created. If the DB2 tablespace already exists, this parameter must be set to N.
Update tablespace
Y If the tablespace is already implemented, the differences of the implemented tablespace and the documented dataspace are determined and update commands are generated to modify the implemented tablespace according to the documented dataspace.

Note:
Certain parameters may be modified with the ALTER TABLESPACE statement only when the database is active, other parameters only when the database is stopped. For this reason it may be necessary to submit the generation job twice.

Define
N A DEFINE NO clause is generated
Partitions initialized Only for tablespaces with type G (Partition by growth). Specifies the number of partitions to be initialized (corresponds to the NUMPARTS option in DB2) and must not exceed the total number of partitions defined for that tablespace.

Generate DB2 Tablespace in Batch Mode

Command: GENERATE TABLESPACE.

Enter parameters on next line in positional or keyword form. Dataspace ID is obligatory, all other parameters are optional.

Field Keyword Position
Dataspace ID DATASPACE-ID 1
Add tablespace ADD-TABLESPACE 2
Update tablespace UPD-TABLESPACE 3
List DB2 statements LIST 4
Protocol saved in member MEM 5
Protocol saved in library LIB 6

Note:
For compatibilty reasons only.

PASSWORD 7
Define DEFINE 8
Use SQLID SQLID 9
SQL Server SQL-SERVER 10
Partitions initialized NUMPARTS 11

If a parameter is not specified, the default value is taken.

If you explicitly set SQL-SERVER to blank in order to use the default server, another keyword must be specified after the SQL-SERVER keyword. If it is not possible to specify another keyword, the SQL-SERVER keyword must be followed by "D1=*" as shown below:

SQL-SERVER= ,D1=*

Sample Output

Dataspace-ID: EXAM-TABLESPACE

CREATE TABLESPACE EXAMTS IN EXAMDB
       NUMPARTS 4
       BUFFERPOOL BP0
       LOCKSIZE ANY
       CLOSE NO;