On 10/5/05, Elvis Budimlic <ebudimlic@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote:
>
> So many things that could have gone wrong and so little information
> provided....


Here is the code and exactly what I did:

/*
This method will be called from DB2

*/
#include <stdio.h>
#include <string.h>
#include <qwcrssts.h>
#include <qusec.h>

void CPU(
char* returnMessage,
short* inind,
short* outind,
char* sqlstate,
char* funcname,
char* specname,
char* msgtext )
{
Qwc_SSTS0200_t info;
Qus_EC_t errcode;
double cpupct;

memset(&errcode, 0, sizeof(errcode) );

QWCRSSTS(&info, sizeof(info), "SSTS0200", "*NO ", &errcode);

cpupct = info.Pct_Processing_Unit_Used / 10;
sprintf(returnMessage, "CPU PCT = %2.1f", cpupct);

*outind = 0;
}

CRTCMOD MODULE(SQLUTIL/CPU) SRCFILE(SQLUTIL/CSRC) OUTPUT(*PRINT)
DBGVIEW(*SOURCE)

CRTSRVPGM SRVPGM(SQLUTIL/CPU) EXPORT(*ALL) ACTGRP(*CALLER)


CREATE FUNCTION SQLUTIL/CPU()
RETURNS VARCHAR(50)
EXTERNAL NAME 'SQLUTIL/CPU(CPU)'
LANGUAGE C
NO SQL
PARAMETER STYLE SQL
DETERMINISTIC;



select cpu() from sysibm/sysdummy1

Query cannot be run. See lower level messages.

dspjoblog

CONNECT to relational database TESTTEST completed.
Current connection is to relational database TESTTEST.
Current connection is to relational database TESTTEST.
Unable to retrieve query options file.
**** Starting optimizer debug message for query .
Unable to retrieve query options file.
File SYSDUMMY1 processed in join position 1.
**** Ending debug message for query .
ODP created.
Blocking used for query.
Connection to relational database TESTTEST ended.
SQL cursors closed.

If there is more information I need to provide, can you instruct me on how
to get that information ?

-Thanks
Steve More

This thread ...

Follow-Ups:
Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2019 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available here. If you have questions about this, please contact [javascript protected email address].