This document covers the following topics:
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.
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 |
|
||
| 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. | ||
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:
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 |
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 |
|
||
| Update database |
|
||
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=*
Database-ID: EXAM-DATABASE
CREATE DATABASE EXAMDB
STOGROUP EXAM001
BUFFERPOOL BP1;
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:
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 |
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:
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 |
||
| Add procedure/function |
|
||
| Replace procedure/function |
|
||
| Update procedure/function |
|
||
| 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.
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=*
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:
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 |
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. |
||||||||||||||||||
| Add table/view |
|
||||||||||||||||||
| Replace view |
|
||||||||||||||||||
| 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 |
|
||||||||||||||||||
| Update index |
|
||||||||||||||||||
| Purge index |
|
||||||||||||||||||
| Column masks |
|
||||||||||||||||||
| Row permissions | Options for row permissions. Possible values: See Column masks option above. | ||||||||||||||||||
| Defer option for indexes |
|
||||||||||||||||||
| Label on |
|
||||||||||||||||||
| Comment on |
|
||||||||||||||||||
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.
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 |
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=*
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 ***
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
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:
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 |
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 |
|
||
| Update storagegroup |
|
||
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 |
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=*
Storagespace-ID: EXAM-STORAGEGROUP
CREATE STOGROUP EXAM001
VOLUMES (VOL05 )
VCAT DB2;
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:
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 |
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 |
|
||||
| Update tablespace |
|
||||
| Define |
|
||||
| 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.
|
||||
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 |
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=*
Dataspace-ID: EXAM-TABLESPACE
CREATE TABLESPACE EXAMTS IN EXAMDB
NUMPARTS 4
BUFFERPOOL BP0
LOCKSIZE ANY
CLOSE NO;