× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



Awesome ! Thanks !

I was using 10 bytes in the reset field, it looks like by changing
"&errcode" to "\0\0\0\0\0\0\0\0" is what fixed the problem.

-Steve More

On 10/5/05, Elvis Budimlic <ebudimlic@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote:
>
> Steve,
>
> Thanks for the source code, without it I would have never picked up on the
> culprit in this particular problem.
>
> Looks like problem is with "reset statistics" literal passed to QWCRSSTS
> being 4 bytes in length when it should be 10 bytes long padded with
> blanks.
> I have recreated your UDF on my V5R1 box and it runs just fine.
> Here is slightly modified code.
>
> #include <stdio.h>
>
> #include <string.h>
>
> #include <qwcrssts.h>
>
>
>
> void CPU(
>
> char* out,
>
> short* outind,
>
> char* sqlstate,
>
> char* funcname,
>
> char* specname,
>
> char* msgtext )
>
> {
>
> Qwc_SSTS0200_t info;
>
> double cpupct;
>
>
>
> QWCRSSTS(&info, sizeof(info), "SSTS0200", "*NO ",
> "\0\0\0\0\0\0\0\0");
>
>
> cpupct = info.Pct_Processing_Unit_Used / 10;
>
> sprintf(out, "CPU PCT = %2.1f", cpupct);
>
> *outind = 0;
> }
>
> CREATE FUNCTION elvis/CPU()
> RETURNS varCHAR(50)
> EXTERNAL NAME 'ELVIS/CPU(CPU)'
> LANGUAGE C
> NO SQL
> PARAMETER STYLE DB2SQL
> NO EXTERNAL ACTION
>
>
> Elvis
>
> -----Original Message-----
> From: c400-l-bounces+ebudimlic=centerfieldtechnology.com@xxxxxxxxxxxx
> [mailto:c400-l-bounces+ebudimlic=centerfieldtechnology.com@xxxxxxxxxxxx]
> On
> Behalf Of Stephen More
> Sent: Wednesday, October 05, 2005 2:28 PM
> To: C programming iSeries / AS400
> Subject: Re: [C400-L] ILEC and QWCRSSTS
>
> 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 is the C programming iSeries / AS400 (C400-L) mailing list
> To post a message email: C400-L@xxxxxxxxxxxx
> To subscribe, unsubscribe, or change list options,
> visit: http://lists.midrange.com/mailman/listinfo/c400-l
> or email: C400-L-request@xxxxxxxxxxxx
> Before posting, please take a moment to review the archives
> at http://archive.midrange.com/c400-l.
>
>
>
>
> --
> This is the C programming iSeries / AS400 (C400-L) mailing list
> To post a message email: C400-L@xxxxxxxxxxxx
> To subscribe, unsubscribe, or change list options,
> visit: http://lists.midrange.com/mailman/listinfo/c400-l
> or email: C400-L-request@xxxxxxxxxxxx
> Before posting, please take a moment to review the archives
> at http://archive.midrange.com/c400-l.
>
>

As an Amazon Associate we earn from qualifying purchases.

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-2024 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 on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.