Page 1 of 1

Problem combining 2 inputs

Posted: Mon Nov 28, 2005 2:40 pm
by btaylor
I am new to DataStage and I am having a problem combining 2 inputs.

I have a sequential file which I need to load into a DB2 table. The table contains a serial number which is obtained from a sequence. The next sequence number is obtained by entering the following custom SQL satement:

select next value for alerts.seq_sn_log from sysibm.sysdummy1;

I need to load the DB2 table with the data from the sequential file and the sequence number from the database however I cannot combine the 2 inputs into one file to load into the database.

What is the best way to handle with this problem?

Posted: Mon Nov 28, 2005 5:11 pm
by vmcburney
We retrieve the DB2 sequence numbers during the insert by using NEXT VAL as the insert value via user-defined SQL:

Code: Select all

INSERT INTO CUSTOMER
CUSTOMER_ID, CUSTOMER_NAME, CUSTOMER_ODOR
(NEXT VAL FOR #DB_SCH#.CUSTOMER_SEQ, ?, ?)

This statement will retrieve the next sequence number from the CUSTOMER_SEQ each time an insert statement is run.