Using Data Queues versus

User

Queues

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Data queues and user queues both provide a means for one or more

communicate

asynchronously. The

queues

can be processed FIFO (first-in

first-out), LIFO (last-in first-out),

or

by

key. If user queues and

 

the same function, which one should

 

you

choose

for

your

implementatio

following is a comparison of the two

and

an

insight

into

when

you sho

queue rather than the other.

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

First, your programming experience is

an

important

consideration

in

sele

queue type. If you are skilled in

C or MI programming, you may want

user

queue. C

and

MI

are

the

only

languages

that

can

use MI instru

as discussed later, has a

bearing

on performance. If your expertis

RPG, then you should choose the data

queue. You

cannot

implement

a

u

queue in COBOL or RPG because neither of these languages can use M

instructions.

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Next,

performance

plays

an

important

part

in determining what type of

use. As

stated

in

Chapter 1,

“Application

Programming

Interface—Overview”

page 1-1, APIs generally give better performance than CL commands. Also,

instructions perform better than an external

call

to

an API

because

 

head associated with them. User queues use

MI

instructions

to

manip

data queues use APIs. Therefore, the user

queue

 

has

better

perfo

data

queue.

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Last,

you

need

to consider

 

how

the

 

queue entries are manipulated. F

you need a way to perform enqueue

 

and dequeue operations on entri

queue. As stated earlier, user queues use MI instructions to manipula

Specifically,

you

use

the

ENQ

MI

instruction

to

 

enqueue

a

message,

a

MI instruction to dequeue a message. If you are running at securit

greater,

 

you

must

ensure that the

 

user

queue is created in the u

to directly manipulate a user queue

 

using MI instructions. Because d

entries

are

manipulated

by

APIs,

the

security

 

level

of

the

machine

 

use

of

the

API.

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

You cannot create a user queue object in a library that does not domain objects, which is determined by the QALWUSRDMN system value. ( “Domain Concepts” on page 2-26 for more information on QALWUSRDMN.) Data queues are always created in the system domain, so there is no pr data queue being created into a specific library.

The

following

is

a

summary

to

help you

select the type of queue

t

your

program:

 

 

 

 

 

 

 

Ÿ

Use user

queues when:

 

 

 

 

You

have

a

programming background

in or prefer to program in

C

 

– You

need the additional

performance of an API for creating

an

 

 

and

MI

instructions

for

manipulating

entries.

 

You do not need to create a user-domain queue into a library QALWUSRDMN system value does not permit user-domain user objects

when

at

security level 40 or 50.

 

 

Ÿ Use data

queues when:

 

 

– You

have

a programming background in

or

prefer to program in COB

RPG.

 

 

 

 

 

 

Appendix A. Performing

Tasks

Using APIs—ExamplesA-15

Page 271
Image 271
IBM Version 4 manual Using Data Queues versus, User, Queue entries are manipulated. F