At run time, the Data Warehouse Center generates a command-line parameter list that it passes as input to your program. Whenever possible, test your program from the command line before using it in a step.
Example: The Data Warehouse Center program VW 5.2 DB2 load replace (VWPLOADR) selects data from a file and loads the data into a database. It uses the following parameters:
The program gets the parameters as shown in Figure 75:
Figure 75. Reading parameters from the command line
char * sourceFile;
sourceFile = argv[1]:
char * dbName;
dbName = argv[2];
char * dbUser;
dbUser = argv[3];
char * dbPassword
dbPassword = argv[4];
char * dbTable;
dbTable = argv[5]
char * fileMod;
if(argc>6) fileMod = argv[6];
else fileMod = NULL;
|
The program uses the target parameters to connect to the target database, as shown in Figure 76:
Figure 76. Connecting to the target database
rc = SQLConnect (hdbc, (SQLCHAR *)dbName, SQL_NTS,
(SQLCHAR *)dbUser, SQL_NTS, /* UID */
(SQLCHAR *)dbPassword, SQL_NTS); /* Password */
|
The program then uses the DB2 load utility to load data into the database.