system("CRTLIB LIB(QUEUELIB)"); /\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\/

/\ Create a data queue called EXAMPLEQ in

library QUEUELIB.￿ The

\/

/\

queue will have a maximum entry length

set at 1ð, and will ￿be

\/

/\

FIFO (first-in first-out).

 

\/

/\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\/

system("CRTDTAQ DTAQ(QUEUELIB/EXAMPLEQ) MAXLEN(1ð)");

/\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\/

/\ 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: %.1ðs\n", QueueData);

/\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\/

/\ Delete the data queue.\/ /\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\/

system("DLTDTAQ DTAQ(QUEUELIB/EXAMPLEQ)");

/\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\/

/\ Delete the library.\/ /\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\/

system("DLTLIB LIB(QUEUELIB)");

}

Note: For examples of the data queue program in additional languages, Queue—Examples” on page B-165.

User Queue—ILE C Example

The following program illustrates how to use APIs to create and manipu queue.

/\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\/

/\

\/

/\Program Name: UQUEUEX

\/

/\

\/

/\Program Language: ILE C

\/

Appendix A. Performing Tasks Using

APIs—ExamplesA-17

Page 273
Image 273
IBM Version 4 manual User Queue-ILE C Example, Queuelib