90 lines
4.4 KiB
HTML
90 lines
4.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: Wait up to two hours to receive data from data queue" />
|
|
<meta name="abstract" content="This example shows a program waiting up to two hours to receive an entry from a data queue." />
|
|
<meta name="description" content="This example shows a program waiting up to two hours to receive an entry from a data queue." />
|
|
<meta name="DC.subject" content="data queue, example, data queue, using" />
|
|
<meta name="keywords" content="data queue, example, data queue, using" />
|
|
<meta name="DC.Relation" scheme="URI" content="explq.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="dqex1" />
|
|
<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: Wait up to two hours to receive data from data queue</title>
|
|
</head>
|
|
<body id="dqex1"><a name="dqex1"><!-- --></a>
|
|
<!-- Java sync-link --><script language="Javascript" src="../rzahg/synch.js" type="text/javascript"></script>
|
|
<h1 class="topictitle1">Example: Wait up to two hours to receive data from data queue</h1>
|
|
<div><p>This example shows a program waiting up to two hours to receive
|
|
an entry from a data queue.</p>
|
|
<div class="section"><p>In the following example, program B specifies to wait up to two
|
|
hours (7200 seconds) to receive an entry from the data queue. Program A sends
|
|
an entry to data queue DTAQ1 in library QGPL. If program A sends an entry
|
|
within two hours, program B receives the entries from this data queue. Processing
|
|
begins immediately. If two hours elapse without procedure A sending an entry,
|
|
program B processes the time-out condition because the field length returned
|
|
is 0. Program B continues receiving entries until this time-out condition
|
|
occurs. The programs are written in CL; however, either program could be written
|
|
in any high-level language.</p>
|
|
</div>
|
|
<div class="section"><p>The data queue is created with the following command: </p>
|
|
<pre>CRTDTAQ DTAQ(QGPL/DTAQ1) MAXLEN(80)</pre>
|
|
</div>
|
|
<div class="section"><p>In this example, all data queue entries are 80 bytes long.</p>
|
|
</div>
|
|
<div class="section"><p>In program A, the following statements relate to the data queue:
|
|
</p>
|
|
<pre>PGM
|
|
DCL &FLDLEN *DEC LEN(5 0) VALUE(80)
|
|
DCL &FIELD *CHAR LEN(80)
|
|
.
|
|
.(determine data to be sent to the queue)
|
|
.
|
|
CALL QSNDDTAQ PARM(DTAQ1 QGPL &FLDLEN &FIELD)
|
|
.
|
|
.
|
|
.</pre>
|
|
</div>
|
|
<div class="section"><p>In program B, the following statements relate to the data queue:
|
|
</p>
|
|
<pre> PGM
|
|
DCL &FLDLEN *DEC LEN(5 0) VALUE(80)
|
|
DCL &FIELD *CHAR LEN(80)
|
|
DCL &WAIT *DEC LEN(5 0) VALUE(7200) /* 2 hours */
|
|
.
|
|
.
|
|
.
|
|
LOOP: CALL QRCVDTAQ PARM(DTAQ1 QGPL &FLDLEN &FIELD &WAIT)
|
|
IF (&FLDLEN *NE 0) DO /* Entry received */
|
|
.
|
|
. (process data from data queue)
|
|
.
|
|
GOTO LOOP /* Get next entry from data queue */
|
|
ENDDO
|
|
.
|
|
. (no entries received for 2 hours; process time-out condition)
|
|
.</pre>
|
|
</div>
|
|
</div>
|
|
<div>
|
|
<div class="familylinks">
|
|
<div class="parentlink"><strong>Parent topic:</strong> <a href="explq.htm" title="This includes examples of three methods for processing data queue files.">Examples: Use a data queue</a></div>
|
|
</div>
|
|
</div>
|
|
</body>
|
|
</html> |