Error running RUNSTATS from DB2 API stage

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
koolnitz
Participant
Posts: 138
Joined: Wed Sep 07, 2005 5:39 am

Error running RUNSTATS from DB2 API stage

Post by koolnitz »

Hello All

I'm trying to fire the following RUNSTATS command from SQL>After in DB2 API stage:

RUNSTATS on BKH.CNTAC with distribution and sampled detailed indexes all allow write access;

Same command executes successfully when fired from DB2 client. But it's throwing warnings when run from DataStage:

db2_SALES_CNTAC_TRAN_ins,0: Warning: djp_SALES_CNTAC_TRAN.db2_SALES_CNTAC_TRAN_ins: SQLExecDirect: Error executing statement '
RUNSTATS on table BKH.CNTAC with distribution and sampled detailed indexes all allow write access'. See following DB2 message for details.

db2_SALES_CNTAC_TRAN_ins,0: Warning: djp_SALES_CNTAC_TRAN.db2_SALES_CNTAC_TRAN_ins: [IBM][CLI Driver][DB2/AIX64] SQL0104N An unexpected token "table" was found following "RUNSTATS on ". Expected tokens may include: "JOIN". SQLSTATE=42601



I don't think anything wrong with the command syntax since I'm able to run it from DB2 client.

Any help would be appreciated. Thanks!
Nitin Jain | India

If everything seems to be going well, you have obviously overlooked something.
stefanfrost1
Premium Member
Premium Member
Posts: 99
Joined: Mon Sep 03, 2007 7:49 am
Location: Stockholm, Sweden

Post by stefanfrost1 »

You can only issue commands from DB2 API stage that is valid SQL and can be run from any SQL-editor. RUNSTATS in DB2 is a database command and therefore it cannot be run in db2 api stage.

Use db2 enterprise stage open and close command instead. It can issue sql and databse commands.
-------------------------------------
http://it.toolbox.com/blogs/bi-aj
my blog on delivering business intelligence using agile principles
stefanfrost1
Premium Member
Premium Member
Posts: 99
Joined: Mon Sep 03, 2007 7:49 am
Location: Stockholm, Sweden

Post by stefanfrost1 »

You can only issue commands from DB2 API stage that is valid SQL and can be run from any SQL-editor. RUNSTATS in DB2 is a database command and therefore it cannot be run in db2 api stage.

Use db2 enterprise stage open and close command instead. It can issue sql and databse commands.
-------------------------------------
http://it.toolbox.com/blogs/bi-aj
my blog on delivering business intelligence using agile principles
koolnitz
Participant
Posts: 138
Joined: Wed Sep 07, 2005 5:39 am

Post by koolnitz »

Thanks stefanfrost1 for your response.
Is it a limitation of DB2 API stage or it is supposed to behave this way?
Nitin Jain | India

If everything seems to be going well, you have obviously overlooked something.
ogmios
Participant
Posts: 659
Joined: Tue Mar 11, 2003 3:40 pm

Post by ogmios »

koolnitz wrote:Thanks stefanfrost1 for your response.
Is it a limitation of DB2 API stage or it is supposed to behave this way?
It's supposed to behave like that... runstats is not SQL. It's similar to Oracle and SQL*Plus, you can execute things in SQL*Plus which will throw errors at you in the Oracle Stage.
In theory there's no difference between theory and practice. In practice there is.
koolnitz
Participant
Posts: 138
Joined: Wed Sep 07, 2005 5:39 am

Post by koolnitz »

Hmm, so as a workaround I have written a small script that fires RUNSTATS statements, and calling this script from Execute Command in job sequence.

Thanks for the info, anyway!
Nitin Jain | India

If everything seems to be going well, you have obviously overlooked something.
Post Reply