/******************************************************************************* ** ** Source File Name = setrundg.c ** ** Licensed Materials - Property of IBM ** ** (C) COPYRIGHT International Business Machines Corp. 1999, 2000 ** All Rights Reserved. ** ** US Government Users Restricted Rights - Use, duplication or ** disclosure restricted by GSA ADP Schedule Contract with IBM Corp. ** ** ** PURPOSE : ** This sample program is an example of how to use the ** Set Runtime Degree API (sqlesdeg). ** ** APIs USED : ** Attach to Instance (sqleatin) ** Set Runtime Degree (sqlesdeg) ** ** ** STRUCTURES USED : ** sqlca ** ** OTHER FUNCTIONS USED : ** 'C' COMPILER LIBRARY : ** stdio.h - printf ** ** external : ** check_error : Checks for SQLCODE error, and prints out any ** [in UTIL.C] related information available. ** This procedure is located in the UTIL.C file. ** ** ** EXTERNAL DEPENDENCIES : ** - Compiling and linking with the IBM Cset++ compiler (AIX and OS/2) ** or the Microsoft Visual C++ compiler (Windows) ** or the compiler supported on your platform. ** ** For more information about these samples see the README file. ** ** For more information on programming in C, see the: ** - "Programming in C and C++" section of the Application Development Guide ** For more information on Building C Applications, see the: ** - "Building C Applications" section of the Application Building Guide. ** ** For more information on the SQL language see the SQL Reference. ** *******************************************************************************/ #include <stdio.h> #include <stdlib.h> #include <sqlda.h> #include <sqlca.h> #include <sqlcodes.h> #include <sqlenv.h> #include "utilapi.h" int main ( int argc, char **argv) { struct sqlca sqlca; int rc = 0; sqluint32 *agentidarray; sqlint32 degree; agentidarray = NULL; degree = 4; /********************************************* the first argument is the instance name the second argument is the user name the thirs argument is the password *********************************************/ if (argc == 4) { printf ("\nATTACH TO INSTANCE API called.\n"); /*******************************\ * ATTACH TO INSTANCE API called * \*******************************/ sqleatin (argv[1], argv[2], argv[3], &sqlca); API_SQL_CHECK("attach to instance"); } else if (argc != 1) { printf ("\nUSAGE: setrundg [instance/nodename userid password]\n\n"); return 1; } printf("Setting the RUNTIME DEGREE to 4\n"); /* Call SET RUNTIME DEGREE api */ rc = sqlesdeg(SQL_ALL_USERS, agentidarray, degree, &sqlca); if (rc != 0) { printf("Error returned from API\n"); printf("rc = %d\n",rc); goto exit; } if (sqlca.sqlcode != 0) { printf("Error calling API\n"); printf("sqlcode = %d\n",sqlca.sqlcode); goto exit; } else printf("Call successful.\n"); exit: return(rc); } /* end of main () */