Have to call a DB2 stored procedure

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
Amarpreet
Participant
Posts: 20
Joined: Tue Apr 04, 2006 11:45 pm
Location: India
Contact:

Have to call a DB2 stored procedure

Post by Amarpreet »

I have a scenario, where in I am using a loop to execute a job 20 times with some different variable each time. I want to execute/call a DB2 stored procedure after end of the loop. How can I achieve this in parallel jobs?
kumar_s
Charter Member
Charter Member
Posts: 5245
Joined: Thu Jun 16, 2005 11:00 pm

Post by kumar_s »

Just execute it after the loop.
You can do this from the job sequence, by using ExecuteCommandActivity to call the SP from OS level. Or use a JobControl which has the db2 api stage (in the before/after sql tab) to call SP.
Impossible doesn't mean 'it is not possible' actually means... 'NOBODY HAS DONE IT SO FAR'
Amarpreet
Participant
Posts: 20
Joined: Tue Apr 04, 2006 11:45 pm
Location: India
Contact:

Post by Amarpreet »

Thanks for the answer. But I have no idea that how to execute db2 stored procedure from command line. what has to be written in executecommandactivity to execute db2 stored procedure from command line.
kumar_s
Charter Member
Charter Member
Posts: 5245
Joined: Thu Jun 16, 2005 11:00 pm

Post by kumar_s »

Using commnad line interface.

Code: Select all

db2 "call StoredProcedure(100, ?)" 
Where "?" can be used for IN type.
Impossible doesn't mean 'it is not possible' actually means... 'NOBODY HAS DONE IT SO FAR'
ArndW
Participant
Posts: 16318
Joined: Tue Nov 16, 2004 9:08 am
Location: Germany
Contact:

Post by ArndW »

Don't forget that you also need to execute a "db2 connect ..." statement as well!
Amarpreet
Participant
Posts: 20
Joined: Tue Apr 04, 2006 11:45 pm
Location: India
Contact:

Post by Amarpreet »

I am calling procedure using syntax---db2 "call test_proc()". But its giving following error:
TEST_PROC..JobControl (@Execute_Command_0): Executed: db2 "call svsods.test_proc()"
Reply=255
Output from command ====>
exec(): 0509-036 Cannot load program db2 because of the following errors:
0509-022 Cannot load module /db2home/db2inst3/sqllib/lib/libdb2.a(shr_64.o).
0509-150 Dependent module /usr/opt/db2_08_01/lib/libdb2osse.a(shr_64.o) could not be loaded.
0509-152 Member shr_64.o is not found in archive
0509-022 Cannot load module db2.
0509-150 Dependent module /db2home/db2inst3/sqllib/lib/libdb2.a(shr_64.o) could not be loaded.
0509-022 Cannot load module .
ArndW
Participant
Posts: 16318
Joined: Tue Nov 16, 2004 9:08 am
Location: Germany
Contact:

Post by ArndW »

The error message is telling you that the object
db2home/db2inst3/sqllib/lib/libdb2.a(shr_64.o).
is either not there, has too little permissions for your user or for some other reason isn't accessible. Have you checked your UNIX permissions?
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

You need to be using the 32-bit libraries. DataStage is a 32-bit application. Make sure that, at least for your DataStage processes, the 32-bit libraries precede the 64-bit libraries in your shared library search path.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Amarpreet
Participant
Posts: 20
Joined: Tue Apr 04, 2006 11:45 pm
Location: India
Contact:

Post by Amarpreet »

Could you please explain this in detail, as how to change the shared library from 64 bit to 32 bit?
kumar_s
Charter Member
Charter Member
Posts: 5245
Joined: Thu Jun 16, 2005 11:00 pm

Post by kumar_s »

You can check with this example given by Craig on Oracle Shared library.
Impossible doesn't mean 'it is not possible' actually means... 'NOBODY HAS DONE IT SO FAR'
Post Reply