116 lines
4.2 KiB
HTML
116 lines
4.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: Using Data Queues APIs" />
|
|
<meta name="abstract" content="The following example illustrates using Data Queues APIs." />
|
|
<meta name="description" content="The following example illustrates using Data Queues APIs." />
|
|
<meta name="DC.Relation" scheme="URI" content="rzaikappdq.htm" />
|
|
<meta name="copyright" content="(C) Copyright IBM Corporation 1999, 2006" />
|
|
<meta name="DC.Rights.Owner" content="(C) Copyright IBM Corporation 1999, 2006" />
|
|
<meta name="DC.Format" content="XHTML" />
|
|
<meta name="DC.Identifier" content="dqapiex" />
|
|
<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: Using Data Queues APIs</title>
|
|
</head>
|
|
<body id="dqapiex"><a name="dqapiex"><!-- --></a>
|
|
<!-- Java sync-link --><script language="Javascript" src="../rzahg/synch.js" type="text/javascript"></script>
|
|
<h1 class="topictitle1">Example: Using Data Queues APIs</h1>
|
|
<div><p>The following example illustrates using Data Queues APIs.</p>
|
|
<div class="example"> <pre>// Sample Data Queues application
|
|
|
|
#ifdef UNICODE
|
|
#define _UNICODE
|
|
#endif
|
|
#include <windows.h>
|
|
|
|
// Include the necessary DQ Classes
|
|
#include <stdlib.h>
|
|
#include <iostream.h>
|
|
#include "cwbdq.h"
|
|
|
|
/**********************************************************************/
|
|
|
|
void main()
|
|
{
|
|
|
|
cwbDQ_Attr queueAttributes;
|
|
cwbDQ_QueueHandle queueHandle;
|
|
cwbDQ_Data queueData;
|
|
|
|
// Create an attribute object
|
|
if ( (queueAttributes = cwbDQ_CreateAttr()) == 0 )
|
|
return;
|
|
|
|
// Set the maximum record length to 100
|
|
if ( cwbDQ_SetMaxRecLen(queueAttributes,
|
|
100) != 0 )
|
|
return;
|
|
|
|
// Set the order to First-In-First-Out
|
|
if (cwbDQ_SetOrder(queueAttributes, CWBDQ_SEQ_FIFO) != 0 )
|
|
return;
|
|
|
|
// Create the data queue DTAQ in library QGPL on system SYS1
|
|
if ( cwbDQ_Create(_TEXT("DTAQ"),
|
|
_TEXT("QGPL"),
|
|
_TEXT("SYSNAMEXXX"),
|
|
queueAttributes,
|
|
NULL) != 0 )
|
|
return;
|
|
|
|
// Delete the attributes
|
|
if ( cwbDQ_DeleteAttr( queueAttributes ) != 0 )
|
|
return;
|
|
|
|
// Open the data queue
|
|
if ( cwbDQ_Open(_TEXT("DTAQ"),
|
|
_TEXT("QGPL"),
|
|
_TEXT("SYSNAMEXXX"),
|
|
&queueHandle,
|
|
NULL) != 0 )
|
|
|
|
return;
|
|
|
|
// Create a data object
|
|
if ( (queueData = cwbDQ_CreateData()) == 0 )
|
|
return;
|
|
|
|
// Set the data length and the data
|
|
if ( cwbDQ_SetData(queueData, (unsigned char*)"Test Data!", 10) != 0 )
|
|
return;
|
|
|
|
// Write the data to the data queue
|
|
if ( cwbDQ_Write(queueHandle, queueData, CWB_TRUE, NULL) != 0 )
|
|
return;
|
|
|
|
// Delete the data object
|
|
if ( cwbDQ_DeleteData(queueData) != 0 )
|
|
return;
|
|
|
|
// Close the data queue
|
|
if ( cwbDQ_Close(queueHandle) != 0 )
|
|
return;
|
|
|
|
}</pre>
|
|
</div>
|
|
</div>
|
|
<div>
|
|
<div class="familylinks">
|
|
<div class="parentlink"><strong>Parent topic:</strong> <a href="rzaikappdq.htm" title="Use iSeries Access for Windows Data Queues application programming interfaces (APIs) to provide easy access to iSeries data queues. Data queues allow you to create client/server applications that do not require the use of communications APIs.">iSeries Access for Windows Data Queues APIs</a></div>
|
|
</div>
|
|
</div>
|
|
</body>
|
|
</html> |