OWNJOB
                                 ======


* Compatible with QDOS, Minerva and SMSQ/E (in theory)


* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
*
*               Set a job to be "owned" by another job
*
* Usage:
*
*               er = OWNJOB(<target_job_ID>[, <owner_ID>])
* where
*
* er = return error code, eg
*        invalid job:    either of the IDs given is invalid, or target = 0
*        already exists: the job is already owned by another job than 0!
*        not complete:   cant own owner!
*        in use:         both jobs have the same ID
*
*      target_job_ID is the target job's ID in full or -1
*
*      owner_ID (optional, default is me) ID of proposed owner job or -1
*
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
*                                                                         *
*       Use with extreme care! as this is not an "authorised" action!     *
*                                                                         *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *


This command was developed as a workaround to the limitation of the EXEP/FEP
and ET/FET commands on systems that dont have the _M option, as EX/FEX do.
Other uses for this command have not been thoroughly tested! They may work..


Example:
========

Two jobs, Owner and Owned. Perhaps Owner has some memory it wishes to share
with Owned, but it doesnt want to hang around while Owned uses that memory
so it cant use EW to invoke it. Since SMSQ/E V3.22 one can use EX_M or
FEX_M, and since V3.39 the equivalent Thing versions EXEP_M/FEP_M can also
be used. But for earlier versions of SMSQ/E and for Qdos/Minerva one needs
a workaround:

Owner:

10 JOB_NAME 'Owner'
20 REMark EW 'dev4_job_own_Owned_bas'; HEX$(JOBID, 32): QUIT
30 EX 'dev4_job_own_Owned_bas'; HEX$(JOBID, 32)
40 SUSJB -1, 150

Owned:

10 JOB_NAME 'Owned'
20 REMark LRESPR 'dev4_job_own_OWNJOB_BIN':     rem Toolkit must be loaded
30 ID = HEX(CMD$):                              rem ID passed as hex
40 er = OWNJOB(JOBID, ID):                      rem Own me, please!
50 PRINT 'My name is  "'; JOB$(-1); '"'
60 PRINT 'My owner is "'; JOB$(OJOB(-1)); '"':  rem Confession..
70 PRINT 'Code ='! er:                          rem Pre-owned?
80 PAUSE: QUIT:                                 rem Press a key to quit

Ensure both programs are in the right location or make the necessary
changes to the code. Then LOAD and RUN Owner from an SBASIC daughter job
for best effect. You can check the running jobs list to see that Owned is
owned by Owner.

If you swap the REMark from line 20 to line 30 in Owner then, of course,
the system will ensure that Owner is the owner of Owned. But Owner is
stuck waiting for Owned to complete. Owned will then report error -8
(already exists). This does no harm here and can be ignored.


Program Status
==============

* V0.01, pjw, 2022 Jan 03
* V0.01, pjw, 2024 Oct 09, This text updated and examples added to zip.

               Conditions of use and DISCLAIMER as per Knoware.no

Generated by QuickHTM, 2024 Oct 09