ibm-information-center/dist/eclipse/plugins/i5OS.ic.rzahx_5.4.0.1/rzahxcolluserdefexreg.htm

117 lines
6.2 KiB
HTML

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html lang="en-us" xml:lang="en-us">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="security" content="public" />
<meta name="Robots" content="index,follow" />
<meta http-equiv="PICS-Label" content='(PICS-1.1 "http://www.icra.org/ratingsv02.html" l gen true r (cz 1 lz 1 nz 1 oz 1 vz 1) "http://www.rsac.org/ratingsv01.html" l gen true r (n 0 s 0 v 0 l 0) "http://www.classify.org/safesurf/" l gen true r (SS~~000 1))' />
<meta name="DC.Type" content="reference" />
<meta name="DC.Title" content="Example: Program to register the data collection program" />
<meta name="abstract" content="This sample program registers the data collection program from the previous example with Collection Services. After running, Collection Services displays the data collection program in the list of data collection categories." />
<meta name="description" content="This sample program registers the data collection program from the previous example with Collection Services. After running, Collection Services displays the data collection program in the list of data collection categories." />
<meta name="DC.Relation" scheme="URI" content="rzahxcollservuserdefexample.htm" />
<meta name="copyright" content="(C) Copyright IBM Corporation 1998, 2006" />
<meta name="DC.Rights.Owner" content="(C) Copyright IBM Corporation 1998, 2006" />
<meta name="DC.Format" content="XHTML" />
<meta name="DC.Identifier" content="rzahxcolluserdefexreg" />
<meta name="DC.Language" content="en-us" />
<!-- All rights reserved. Licensed Materials Property of IBM -->
<!-- US Government Users Restricted Rights -->
<!-- Use, duplication or disclosure restricted by -->
<!-- GSA ADP Schedule Contract with IBM Corp. -->
<link rel="stylesheet" type="text/css" href="./ibmdita.css" />
<link rel="stylesheet" type="text/css" href="./ic.css" />
<title>Example: Program to register the data collection program</title>
</head>
<body id="rzahxcolluserdefexreg"><a name="rzahxcolluserdefexreg"><!-- --></a>
<!-- Java sync-link --><script language="Javascript" src="../rzahg/synch.js" type="text/javascript"></script>
<h1 class="topictitle1">Example: Program to register the data collection program</h1>
<div><p>This sample program registers the data collection program from
the previous example with Collection Services. After running, Collection Services
displays the data collection program in the list of data collection categories.</p>
<div class="section"><div class="note"><span class="notetitle">Note:</span> By using the code examples, you agree to the terms of the <a href="codedisclaimer.htm">Code license and disclaimer information</a>.</div>
</div>
<div class="section"><h4 class="sectiontitle">C++ sample code</h4><pre>#include "stdlib.h"
#include "stdio.h"
#include "string.h"
#include "qypscoll.cleinc"
int main( int argc, char *argv[] )
{
int CCSID = 0;
int RC = 0;
Qyps_USER_CAT_PROGRAM_ATTR *pgmAttr;
Qyps_USER_CAT_ATTR catAttr;
char collectorName[11] = "*PFR ";
char categoryName[11] = "TESTCAT ";
char collectorDefn[11] = "*CUSTOM "; /* Register to *CUSTOM profile only */
if ( argc &gt; 2 )
{
int len = strlen( argv[2] );
if ( len &gt; 10 ) len = 10;
memset( categoryName, ' ', 10 );
memcpy( categoryName, argv[2], len );
}
if ( argc &lt; 2 || *argv[1] == 'R' )
{
pgmAttr = (Qyps_USER_CAT_PROGRAM_ATTR *)malloc( 4096 );
memset( pgmAttr, 0x00, sizeof(pgmAttr) );
pgmAttr-&gt;fixedPortionSize = sizeof( Qyps_USER_CAT_PROGRAM_ATTR );
memcpy( pgmAttr-&gt;programType, "*SRVPGM ", 10 );
memcpy( pgmAttr-&gt;parameterFormat, "PMDC0100", 8 );
memcpy( pgmAttr-&gt;ownerUserId, "USERID ", 10 );
memcpy( pgmAttr-&gt;jobDescription, "QPMUSRCAT QGPL ", 20 );
memcpy( pgmAttr-&gt;qualPgmSrvpgmName, "DCPTEST LIBRARY ", 20 );
pgmAttr-&gt;workAreaSize = 123;
pgmAttr-&gt;srvpgmEntrypointOffset = pgmAttr-&gt;fixedPortionSize;
pgmAttr-&gt;srvpgmEntrypointLength = 8;
pgmAttr-&gt;categoryParameterOffset = pgmAttr-&gt;srvpgmEntrypointOffset +
pgmAttr-&gt;srvpgmEntrypointLength;
pgmAttr-&gt;categoryParameterLength = 10;
/* Set entry point name */
memcpy( (char *)(pgmAttr) + pgmAttr-&gt;srvpgmEntrypointOffset,
"DCPentry", pgmAttr-&gt;srvpgmEntrypointLength ); /* Set parameter string */
memcpy( (char *)(pgmAttr) + pgmAttr-&gt;categoryParameterOffset,
"1234567890", pgmAttr-&gt;categoryParameterLength );
memset( &amp;catAttr, 0x00, sizeof(catAttr) );
catAttr.structureSize = sizeof( Qyps_USER_CAT_ATTR );
catAttr.minCollectionInterval = 0;
catAttr.maxCollectionInterval = 0;
catAttr.defaultCollectionInterval = 30; /* Collect at 30 second interval */
memset( catAttr.qualifiedMsgId, ' ', sizeof(catAttr.qualifiedMsgId) );
memcpy( catAttr.categoryDesc,
"12345678901234567890123456789012345678901234567890", sizeof(catAttr.categoryDesc) );
QypsRegCollectorDataCategory( collectorName,
categoryName,
collectorDefn,
&amp;CCSID,
(char*)pgmAttr,
(char*)&amp;catAttr,
&amp;RC
);
}
else
if( argc &gt;= 2 &amp;&amp; *argv[1] == 'D' )
QypsDeregCollectorDataCategory( collectorName, categoryName, &amp;RC );
else
printf("Unrecognized option\n");
}/* main() */
</pre>
</div>
</div>
<div>
<div class="familylinks">
<div class="parentlink"><strong>Parent topic:</strong> <a href="rzahxcollservuserdefexample.htm" title="Look here for sample programs that illustrate how you can use the provided APIs to integrate customized data collections into Collection Services.">Example: Implementing user-defined categories</a></div>
</div>
</div>
</body>
</html>