D2G (Data Generate) batch command

Purpose

To load a Db2® object with test data.

Usage

The FM/Db2 Data Create utility function can:

  • Limit the number of rows to be created.
  • Specify how, on a column-by-column basis, each row is be initialized.

1  D2G
1  OBJOUT=? ? location. owner. name
1 ? ? OBJOLOCN=location OBJOOWNR=owner OBJONAME=name
1! TOUTPUT=TDDOUT
1 TOUTPUT=ddname?TOUTMEM=member
1 TMOUT=template_data_set_name(member)
3 ROWS=num
OBJOUT location.owner.object
The optional name of the Db2® remote server (location) where the object is located; the optional name of the owner of the object (owner) and the object name (name).

When location is not specified the current (local) Db2® server is used. When the owner is not specified the object name is qualified using the current SQLID. When FM/Db2 generates the utility control statements, the owner value is non-blank.

OBJOUT should be used when the fully qualified name fits on a single line in the JCL deck. The last usable column is column 71. When the fully qualified name does not fit on a single line in the JCL deck, use one or more of the OBJOLOCN, OBJOOWNR, OBJONAME keywords to specify the object.

OBJOLOCN=location
The optional name of the Db2® remote server (location) where the object is located. See Specifying a Db2 object name.
OBJOOWNR=owner
The optional name of the owner of the object (owner). See Specifying a Db2 object name.
OBJONAME=name
The object name (name) for the object. See Specifying a Db2 object name.
TMOUT=template_data_set_name(member)
The PDS (template_data_set_name) and member name (member) of the FM/Db2 template that describes the Db2® object where the data is to be created. See Specifying the template for a Db2 object. The JCL generated by FM/Db2 always specifies TMOUT.
TOUTPUT=ddname
Defines a reference to a DD statement for the data sets which contain the template member that describes the record structure of your output data. The default is TDDOUT.
TOUTMEM=member
The name of the template member in the dataset(s) identified by the TOUTPUT parameter, if it has not been specified on the DD statement. This parameter must not be specified if the TCOUT parameter is specified.
ROWS=num
The number of rows to be created. Valid range 1-99999999.

Examples

Example 1: Create 1000 rows of test data in table "ID1"."TABLE1". The initialization information for each column of the table are defined in template EMPDG.

//D2G JOB (acct),'name'
//* Create rows in table ID2.TABLE1.
//*
//FMNDB2   EXEC PGM=FMNDB2,PARM=('SSID=DSN1,SQID=ID1')
//STEPLIB  DD DSN=FMN.SFMNMOD1,DISP=SHR
//         DD DSN=DB2V810.DSN1.SDSNEXIT,DISP=SHR
//         DD DSN=DB2.V810.SDSNLOAD,DISP=SHR
//SYSPRINT DD SYSOUT=*
//FMNTSPRT DD SYSOUT=*
//SYSTERM  DD SYSOUT=*
//SYSIN    DD *
$$FILEM D2G OBJOUT="ID1"."TABLE1",
$$FILEM TMOUT=ID1.FM.TEMPLATE(EMPDG),
$$FILEM ROWS=1000
/*

Return codes

The return codes from the D2G function:

0
The function completed successfully
16
A serious error was encountered

Related functions

DBC
Copy data from one Db2® object to another (DBC (Copy) batch command)
DBI
Import data from a sequential or VSAM file into a Db2® table (DBI (Import) batch command)
DBX
Export data from a Db2® object to a sequential or VSAM file (DBX (Export) batch command)
D2G
Create (generate) Db2® data (D2G (Data Generate) batch command)