&queuelib_sysptr,

/\

sysptr to

library

\/

&rslvsp_template.Auth);

/\

authority

to set in sysptr

\/

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

/\ Enqueue the entry.\/ /\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\/

enq_msg_prefix.Msg_Len = 1ð;

 

 

enq_msg_prefix.Msg[ð] = '\ð';

/\ Only used for keyed queues\/

memcpy(enq_msg, "EXAMPLE

", 1ð);

 

 

_ENQ(&user_queue_obj_sysptr,

/\ system pointer to user queue \/

&enq_msg_prefix,

 

/\ message prefix

\/

(_SPCPTR)enq_msg);

 

/\ message text

\/

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

/\ Dequeue the entry.\/ /\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\/

success = _DEQI(&deq_msg_prefix,

/\

message

prefix

\/

(_SPCPTR)deq_msg,

/\

message

text

\/

&user_queue_obj_sysptr); /\ sys ptr to user queue

\/

if(success)

{

printf("Queue entry information: %.1ðs\n", deq_msg);

}

else

{

printf("Entry not dequeued\n");

}

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

/\ Delete the user queue.\/ /\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\/

QUSDLTUQ("EXAMPLEQ QUEUELIB

", /\

Qualified user queue name

\/

&error_code);

/\

Error code

\/

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

/\ If an

exception

occurred,

the API would

have returned the￿

\/

/\ exception

in

the error code parameter.

The bytes available

\/

/\

field

will be set to zero

if no exception occurred and gre￿ater

\/

/\

than zero

if

an

exception

did occur.

 

\/

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

if (error_code.ec_fields.Bytes_Available > ð)

{

printf("ATTEMPT TO DELETE A USER QUEUE FAILED WITH EXCEPT￿ION:%.7s", error_code.ec_fields.Exception_Id);

exit(1);

}

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

/\ Delete the library created for this example.\/ /\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\/

system("DLTLIB LIB(QUEUELIB)");

}

Appendix A. Performing Tasks Using APIs—ExamplesA-21

Page 277
Image 277
IBM Version 4 manual Appendix A. Performing Tasks Using APIs-ExamplesA-21