Problem combining 2 inputs

Post questions here relative to DataStage Server Edition for such areas as Server job design, DS Basic, Routines, Job Sequences, etc.

Moderators: chulett, rschirm, roy

Post Reply
btaylor
Participant
Posts: 2
Joined: Mon Nov 28, 2005 9:02 am

Problem combining 2 inputs

Post 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?
vmcburney
Participant
Posts: 3593
Joined: Thu Jan 23, 2003 5:25 pm
Location: Australia, Melbourne
Contact:

Post 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.
Post Reply