136 lines
7.4 KiB
HTML
136 lines
7.4 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 in ILE C: Data queue" />
|
|
<meta name="abstract" content="This program illustrates how to use APIs to create and manipulate a data queue." />
|
|
<meta name="description" content="This program illustrates how to use APIs to create and manipulate a data queue." />
|
|
<meta name="DC.Relation" scheme="URI" content="ExTaskDataque.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="exdqilec" />
|
|
<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 in ILE C: Data queue</title>
|
|
</head>
|
|
<body id="exdqilec"><a name="exdqilec"><!-- --></a>
|
|
<!-- Java sync-link --><script language="Javascript" src="../rzahg/synch.js" type="text/javascript"></script>
|
|
<h1 class="topictitle1">Example in ILE C: Data queue</h1>
|
|
<div><p>This program illustrates how to use APIs to create and manipulate
|
|
a data queue.</p>
|
|
<div class="section"><div class="note"><span class="notetitle">Note:</span> Read the <a href="codedisclaimer.htm">Code license and disclaimer information</a> for important
|
|
legal information.</div>
|
|
<pre>/*********************************************************************/
|
|
/* */
|
|
/*Program Name: DQUEUEX */
|
|
/* */
|
|
/*Program Language: ILE C */
|
|
/* */
|
|
/*Description: This program illustrates how to use APIs to create */
|
|
/* and manipulate a data queue. */
|
|
/* */
|
|
/* */
|
|
/*Header Files Included: <stdio.h> */
|
|
/* <string.h> */
|
|
/* <stdlib.h> */
|
|
/* <decimal.h> */
|
|
/* <qrcvdtaq.h> */
|
|
/* <qsnddtaq.h> */
|
|
/* */
|
|
/*APIs Used: QSNDDTAQ - Send data queue */
|
|
/* QRCVDTAQ - Receive data queue */
|
|
/* */
|
|
/*********************************************************************/
|
|
/*********************************************************************/
|
|
/*********************************************************************/
|
|
/* Includes */
|
|
/*********************************************************************/
|
|
|
|
#include <stdio.h>
|
|
#include <string.h>
|
|
#include <stdlib.h>
|
|
#include <decimal.h>
|
|
#include <qsnddtaq.h> /* from QSYSINC/h */
|
|
#include <qrcvdtaq.h> /* from QSYSINC/h */
|
|
|
|
/*********************************************************************/
|
|
/* */
|
|
/* Main */
|
|
/* */
|
|
/*********************************************************************/
|
|
|
|
void main()
|
|
{
|
|
decimal(5,0) DataLength = 10.0d,
|
|
WaitTime = 0.0d;
|
|
char QueueData[10];
|
|
|
|
/*******************************************************************/
|
|
/* Create library QUEUELIB. */
|
|
/*******************************************************************/
|
|
|
|
system("CRTLIB LIB(QUEUELIB)");
|
|
|
|
/*******************************************************************/
|
|
/* Create a data queue called EXAMPLEQ in library QUEUELIB. The */
|
|
/* queue will have a maximum entry length set at 10, and will be */
|
|
/* FIFO (first-in first-out). */
|
|
/*******************************************************************/
|
|
|
|
system("CRTDTAQ DTAQ(QUEUELIB/EXAMPLEQ) MAXLEN(10)");
|
|
|
|
/*******************************************************************/
|
|
/* Send information to the data queue. */
|
|
/*******************************************************************/
|
|
|
|
QSNDDTAQ("EXAMPLEQ ", /* Data queue name */
|
|
"QUEUELIB ", /* Queue library name */
|
|
DataLength, /* Length of queue entry */
|
|
"EXAMPLE "); /* Data sent to queue */
|
|
|
|
/*******************************************************************/
|
|
/* Receive information from the data queue. */
|
|
/*******************************************************************/
|
|
|
|
QRCVDTAQ("EXAMPLEQ ", /* Data queue name */
|
|
"QUEUELIB ", /* Queue library name */
|
|
&DataLength, /* Length of queue entry */
|
|
&QueueData, /* Data received from queue */
|
|
WaitTime); /* Wait time */
|
|
|
|
printf("Queue entry information: %.10s\n", QueueData);
|
|
|
|
/*******************************************************************/
|
|
/* Delete the data queue. */
|
|
/*******************************************************************/
|
|
|
|
system("DLTDTAQ DTAQ(QUEUELIB/EXAMPLEQ)");
|
|
|
|
/*******************************************************************/
|
|
/* Delete the library. */
|
|
/*******************************************************************/
|
|
|
|
system("DLTLIB LIB(QUEUELIB)");
|
|
|
|
}</pre>
|
|
</div>
|
|
</div>
|
|
<div>
|
|
<div class="familylinks">
|
|
<div class="parentlink"><strong>Parent topic:</strong> <a href="ExTaskDataque.htm" title="Data queues and user queues both provide a means for one or more processes to communicate asynchronously. The queues can be processed FIFO (first-in first-out), LIFO (last-in first-out), or by key.">Examples: Using data queues or user queues</a></div>
|
|
</div>
|
|
</div>
|
|
</body>
|
|
</html> |