home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
OS/2 Shareware BBS: 18 REXX
/
18-REXX.zip
/
rxhll.zip
/
MSGQUE.REX
< prev
next >
Wrap
OS/2 REXX Batch file
|
1993-12-27
|
2KB
|
99 lines
/* #include <msgque.rex> */
QueCreate: procedure expose MsgQ.
/**
*** This will create the REXX queues for the interprocess communications
*** with the front-end code.
**/
arg server_, client_, sleep_
if server_ = '' then
return 16
if client_ = '' then
return 16
/* Establish the defaults */
if sleep_ = '' then
sleep_ = 1
MsgQ. = ''
MsgQ.Server = server_ /* Name of the server rexx queue */
MsgQ.Client = client_ /* Name of the client rexx queue */
MsgQ.Sleep = sleep_ /* Number of seconds to sleep before next poll */
code = RxQueue('Create',MsgQ.Client)
code = RxQueue('Create',MsgQ.Server)
/* Make sure there is no garbage in the queues */
code = RxQueue('Set',MsgQ.Client)
do i = 1 to queued()
pull .
end
MsgQ.Original = RxQueue('Set',MsgQ.Server)
do i = 1 to queued()
pull .
end
return 0
QueProcess: procedure expose MsgQ. State.
/**
*** This will handle the message queue processing
**/
Count = 1
say 'Waiting for first message...'
Quit = 'NO'
do while Quit = 'NO'
request = linein("QUEUE:")
parse var request msg param
call charout ,"Processing #"left(Count,7) left(msg,20,'.')
Count = Count + 1
call Methods msg param
say "Done."
end
return
QueDelete: procedure expose MsgQ.
/**
*** This will delete the message queues that were created for this
*** session and restore the original queue back
**/
code = RxQueue('Delete',MsgQ.Server)
code = RxQueue('Delete',MsgQ.Client)
MsgQ.Original = RxQueue('Set' ,MsgQ.Original)
return
QueWaitForResponse: procedure expose MsgQ.
/**
*** This will poll the REXX queue for any information coming in
**/
parse arg Queue
SaveQue = RxQueue('Set',Queue)
do while queued() = 0
call SysSleep MsgQ.Sleep
end
return
Post: procedure
/**
*** This will send the message back to the client REXX queue
**/
parse arg q msg params
SaveQue = RxQueue('Set',q)
queue msg params
code = RxQueue('Set',SaveQue)
return