This trap sets a new owner of an open channel. SMSQ Only.
|Call Parameters||Return Parameters
|D1.L||New owner job's ID||D1.L||Preserved
|ERR_NO||Channel not found.
|ERR_NJ||Invalid job (but see Notes).
All registers not mentioned above are unused and preserved.
The job ID in D1.L is not checked in the current version of this routine in SMSQE v3.13. Whatever job number is entered in D1.W is set in the channel block. Furthermore, if the channel is owned by an S*BASIC and so is given a basic channel number, this is still available to S*BASIC. So the ownership does not seem to be completely transferred. Perhaps this will be corrected in later versions.
DO NOT use -1 as the current job. This results in -1 being set in the channel as the owner.
Because the job ID is not checked, the error ERR_NJ, invalid job, cannot occur.
This example shows the channel whose ID is in A0 being set to the current job.
New_owner move.l a0,-(a7) ; Keep channel ID
moveq #MT_INF,d0 ; To get system information
trap #1 ; D1.L contains the current job ID
moveq #5,d0 ; IOA_SOWN
movea.l (a7)+,a0 ; Restore channel ID
trap #2 ; Alter owner to me
tst.l d0 ; OK? . .
bne oops ; . . no!
; Now I own the channel