If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > DB2 > help needed with db2reorg api

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 02-07-07, 15:20
chavadb2 chavadb2 is offline
Registered User
 
Join Date: Aug 2004
Posts: 138
help needed with db2reorg api

AIX5.3 UDB ESE 8.2.5

I am trying the following C code ..I was able to compile the routine with bldrtn command successfully..but when I call the stored proc, its running successfully without doing any reorg..can some tell me where its going wrong in the C code below?

#include <sql.h>
#include <sqludf.h>
#include <db2ApiDf.h>

int SQL_API_FN reorg_proc(
SQLUDF_VARCHAR *tableName)
{
SQL_API_RC rc = SQL_RC_OK;
db2ReorgStruct data;
struct sqlca sqlca;


/* initialize data structures */
data.reorgType = DB2REORG_OBJ_INDEXESALL;
data.reorgFlags = DB2REORG_OPTION_NONE;
data.nodeListFlag = DB2_ALL_NODES;
data.numNodes = 0;
data.pNodeList = 0;
data.reorgObject.indexesAllStruct.pTableName = tableName;
memset(&sqlca, 0x00, sizeof sqlca);

rc = db2Reorg(db2Version820, &data, &sqlca);
if (rc != SQL_RC_OK || SQLCODE != SQL_RC_OK) {
memcpy(SQLUDF_STATE, "38RS1", SQLUDF_SQLSTATE_LEN);
sprintf(SQLUDF_MSGTX, "Error %d returned by db2Reorg.",
(int)(rc == SQL_RC_OK ? SQLCODE : rc));
goto cleanup;
}

cleanup:
return SQLZ_DISCONNECT_PROC;
}


CREATE PROCEDURE reorgt(IN tableName VARCHAR(256))
SPECIFIC reorgt
DYNAMIC RESULT SETS 0
MODIFIES SQL DATA
NOT DETERMINISTIC
CALLED ON NULL INPUT
LANGUAGE C
EXTERNAL NAME 'db2_api!reorg_proc'
FENCED THREADSAFE
NO EXTERNAL ACTION
PARAMETER STYLE SQL@

$ db2 "call reorgt('xxxx.TABNAME')"

Return Status = 0

I am following the doc in this link

http://www-128.ibm.com/developerwork...lze/index.html
Reply With Quote
  #2 (permalink)  
Old 02-08-07, 15:56
chavadb2 chavadb2 is offline
Registered User
 
Join Date: Aug 2004
Posts: 138
I just tested the same code in other env and it works fine..may be there is an issue with C compiler or some AIX settings in this env
Reply With Quote
  #3 (permalink)  
Old 02-08-07, 16:56
stolze stolze is offline
Registered User
 
Join Date: Jan 2007
Location: Jena, Germany
Posts: 2,662
How exactly do you tell that no REORG is being performed?
__________________
Knut Stolze
IBM DB2 Analytics Accelerator
IBM Germany Research & Development
Reply With Quote
  #4 (permalink)  
Old 02-08-07, 17:20
chavadb2 chavadb2 is offline
Registered User
 
Join Date: Aug 2004
Posts: 138
I am trying reorg only on tables with overflow records and indexes with psuedo-key deleted ids.. after the reorg , they should be cleaned up from the pages..I can see it with reorgchk update statistics on table
Reply With Quote
  #5 (permalink)  
Old 02-12-07, 07:55
stolze stolze is offline
Registered User
 
Join Date: Jan 2007
Location: Jena, Germany
Posts: 2,662
If you don't provide any specific details regarding the various statements and their output, it will be pretty hard to say anything...
__________________
Knut Stolze
IBM DB2 Analytics Accelerator
IBM Germany Research & Development
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On