On 24/06/2022 3:17 pm, David Crayford wrote:
There's a more complete example here
https://github.com/zsystems/java-samples/blob/master/MvsConsoleInteraction.java.
Using Object.wait()/notify() is a bit hairy. A more modern
implementation would use Condition.await()/signal() but it's fine for
this use case.
I cut as much as possible out of my example so there was less code to
wade through to see the logic of the stop/modify etc.
There are some significant differences between the IBM example and mine:
- The IBM example does nothing until it receives the MODIFY command. My
example does something (sleep), and responds to STOP and MODIFY
commands. In a real implementation the sleep would be replaced with the
actual function of the STC. I think this is more realistic, most STCs
have a function they perform until they are stopped - they don't just
respond to modify commands.
- The IBM example returns true from handleStop which results in an
immediate System.exit(0). I think this will result in an ugly abend if
there is a dataset being processed at the time because it is not
properly closed. My example is designed for a clean shutdown.
Object.wait/notify is probably a reasonable approximation of an ECB. I
would be more inclined to use higher level constructs.
--
Andrew Rowley
Black Hill Software
----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to [email protected] with the message: INFO IBM-MAIN