Regarding RCP Enabled Job

Post questions here relative to DataStage Enterprise/PX Edition for such areas as Parallel job design, Parallel datasets, BuildOps, Wrappers, etc.

Moderators: chulett, rschirm, roy

Post Reply
manojbh31
Premium Member
Premium Member
Posts: 83
Joined: Thu Jun 21, 2007 6:41 am

Regarding RCP Enabled Job

Post by manojbh31 »

I have multi instance job which is RCP Enabled. Source query is parameterized as below
Select #Parameter#
From #Parameter A#,
#Parameter B#
where
A.column=b.column

Select has one column and is derived after joining 2 tables and the data of this column is stored in Dataset. I need to use this dataset to delete the data from table.

I read couple of posts where it says the column on which i need to delete should be as parameter and use modify stage to get.

Can it possible to use the data which is present in dataset to delete the data from table?
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

I must presume that your selection was of the form

Code: Select all

Select #Parameter#
From #Parameter# A,
#Parameter# B
Where
A.column=B.column 
rather than what you provided.

You can use the data from the Data Set, materialized via the Modify stage, to delete, provided that the column is identified as Key in DataStage metadata, since that is what drives putting the column into the WHERE clause of the generated DELETE statement.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
manojbh31
Premium Member
Premium Member
Posts: 83
Joined: Thu Jun 21, 2007 6:41 am

Post by manojbh31 »

Hi Ray,

The data of column in the select statement (which is passed as parameter) is stored in dataset. How can i use this column from dataset and delete the data from a particular table.
Thomas.B
Participant
Posts: 63
Joined: Thu Apr 09, 2015 6:40 am
Location: France - Nantes

Post by Thomas.B »

If you have to extract the data you want to delete to a DataSet, you can simply use the database connector as output: on the usage menu, set the "Write mode" value to "Delete"
If the column you store in the DataSet is defined as a key, the data will be deleted.
manojbh31
Premium Member
Premium Member
Posts: 83
Joined: Thu Jun 21, 2007 6:41 am

Post by manojbh31 »

I cannot use DB2 Connector as output in same job, because i am selecting the data from same table by joining with one table. So i need to store this data in dataset and in next job i need to use this dataset and delete the data. As the job is RCP Enabled i cannot make this column as key in dataset
Thomas.B
Participant
Posts: 63
Joined: Thu Apr 09, 2015 6:40 am
Location: France - Nantes

Post by Thomas.B »

Did you try to delete the rows using a request like this?

DELETE FROM #Parameter A#
WHERE #Parameter# IN
(
SELECT #Parameter#
FROM #Parameter A#,#Parameter B#
WHERE A.column=B.column
)

Or if that's not too restrictive:

DELETE A FROM #Parameter A# A,#Parameter B# B
WHERE A.column=B.column

Using a Teradata database, the rows are deleted
If you have to execute that requests on a DataStage job, you can create a job with that design:

Row Generator ---> DB2 Connector

On the Row Generator, set the "number of records" value to "0", on the DB2 Connector set the "Write mode" value to "User-defined SQL" and use one of the 2 the requests above as a statement
Amin
Premium Member
Premium Member
Posts: 27
Joined: Fri Oct 24, 2014 10:02 am

Re: Regarding RCP Enabled Job

Post by Amin »

In connector use Before SQL and do following;
CREATE TABLE T1
(
Column_Name Type PRIMARY KEY
)
;
INSERT INTO T1
SELECT Column
FROM Table_1 , Table_2
WHERE Table_1.column = Table_2.column;

Then extract data to Data Set
Post Reply