I would use WAIT/POST on a "wait-for-work" ECB for each subtask, although 
SUSPEND/RESUME is also a valid approach (if slightly trickier to code).

I would also have another *single* TCB that does all of the output processing 
for the file and the subtasks just add to the tail of the "output pending" 
queue for the dataset and POST the queue ECB. This output TCB will just pop 
output request elements from the queue head and write the records to the 
dataset. The use of a single TCB for the output removes the requirement to 
provide additional serialization for the I/O.

The "PLO" instruction with either "CSDST" or "CSTST" functions is fantastic for 
queue management.

Usage of CPOOL obviously comes into play when doing this sort of thing as does 
designing some sort of generic structure (DSECT) for your TCBs and you probably 
need the ability for the mother to monitor the status of each subtask handler 
task.

Rob Scott
Lead Developer
Rocket Software
275 Grove Street * Newton, MA 02466-2272 * USA
Tel: +1.617.614.2305
Email: [email protected]
Web: www.rocketsoftware.com


-----Original Message-----
From: IBM Mainframe Assembler List [mailto:[email protected]] On 
Behalf Of Joe Owens
Sent: 10 April 2011 11:23
To: [email protected]
Subject: Subtasking program

After such a great response to my last post, I thought I would try here
again for some useful advice on the best design for a program I am about to
write.
I have a mainline program that reads an input file and will then pass a
record to a subtask to process.
The subtask has a work cycle
MQPUT messsage
MQGET message (with wait option, by corellid, gets the response message)
write message to preopened output file.
When the mainline program wishes to send another message, it must choose a
non-busy subtask, or attach another. The whole point is to drive a certain
message rate, so I do not wish to queue more than 1 piece of work to any
subtask at a time
The subtask cycle will take about 150ms. I would like to be able to process
up to 300 messages per second, although normal rates would be much lower.
So questions;
Use pause/release or wait/post?
For the output file write, what would be the best way of serialising the
file writes?
each subtask wraps an enq/deq around the put?
Another subtask has a work queue of records to be written which is added to
by the other tasks? In this case what is the best scheme for dispatch of
this task, when many others may wish to give him work?
Any other comments or suggestions would be appreciated too.

Thanks, Joe

Reply via email to