Inserting Into BD2 Table

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
yksjosh
Participant
Posts: 16
Joined: Wed Aug 17, 2005 11:26 pm
Location: UK

Inserting Into BD2 Table

Post by yksjosh »

Hello All,

I am developing a job in which i have 3 output links.

The first link writes into a Table (Client)

The other two links are writing into files depending upon the success or the failure of the write into the above table.

for the first file the link constrain is
L_Create_Client.REJECTEDCODE = 0

and for the second file the link constraint is
L_Create_Client.REJECTEDCODE <> 0

When I execute this program on the main frame, and when the write fails in the client table due to primary key voilation, the code just abend giving the -801 error instead of writing into the second file.

Please let me know if somebody has an idea about this and if i am using the correct constraints.

Thanks and Regards
YKS
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

I fear - without being able to check - that that's the way that mainframe jobs work. Try re-designing the job to check for the existence of the primary key, and directing your links accordingly. Only attempt an insert if the primary key does not exist; otherwise either perform an update or discard the row, whichever is appropriate in your application.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
kumar_s
Charter Member
Charter Member
Posts: 5245
Joined: Thu Jun 16, 2005 11:00 pm

Post by kumar_s »

Has you Arry Size property been set to 1?
Impossible doesn't mean 'it is not possible' actually means... 'NOBODY HAS DONE IT SO FAR'
yksjosh
Participant
Posts: 16
Joined: Wed Aug 17, 2005 11:26 pm
Location: UK

Post by yksjosh »

Hello Kumar_s,

I couldn't get where do you set the arry size property in mainframe job.
More over i have set the row per commit as 1.

How does arry size matter while insertion fails into the table.
Would definatly like to know about this if this can be of any help to me.

my job is something like this

input file
|
|
|
Tx------------------------>DB2
| L_Client
|
|-------------------------->File1
| if(L_Client.rejectcode =0)
|
|---------------------------->File 2
if(L_Client.rejectcode<>0)


The moment the insert fails into the DB2, my job reports shows the -803 error.
though input file has more than one record but it shows
Record read 01
That means its, the job stops just after the insertion fails.

But the job finishes with the MAX code of 04(which is due to the Date mask).

I can give more insiget on this errors on monday when I am in office.
But any help on this would be appreciated

According to Ray Sir, the solution is working fine of checking if the key is already existing in the table but i am just trying to figure out the scenerio where an insert by other process into the same table might be possible during the time between the look up(to find if the key already exists) and Insert (if key doesn't exist).
Because we might be running more than one instances of this program on similar input files.And all these process try to access this common client table.



Thanks and Regards
YKS
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

yksjosh wrote:i am just trying to figure out the scenerio where an insert by other process into the same table might be possible during the time between the look up(to find if the key already exists) and Insert (if key doesn't exist).
Because we might be running more than one instances of this program on similar input files.And all these process try to access this common client table.
I can't think of a way to accomplish this with DS 390; there is no mechanism of which I am aware for taking a record level lock when the lookup is performed, which is technically what you need to be able to do.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Post Reply