Reorganized April 2024
xcall MIAMEX, MX_READJCB, jobno, buffer {,lokflg {,status}}
xcall MIAMEX, MX_WRITEJCB, jobno, buffer {,lokflg {,status}}
MX_READJDB (MIAMEX 73) reads a job control block or record from jobtbl.sys, and MX_WRITEJCB (MIAMEX 74) writes a jobtbl record.
Parameters
jobno (Num)
the job number of the block to read. This is equivalent to the record number, starting at 1 for the first job. jobno 0 refers to the control record, which should not be accessed.
buffer
the record buffer to receive the data. For jobno 0 (header), the buffer should be mapped per the JCB'HDR map statements in JOBTBL.MAP in SOSLIB:[907,16] or as an instance of the ST_JCBHDR defstruct in JOBTBL.SDF in SOSLIB:[907,16]. For all other jobno values (individual job table records), buffer should be mapped per the JCB'REC map statements in JOBTBL.MAP in SOSLIB:[907,16] or as an instance of the ST_JCBREC defstruct in JOBTBL.SDF in SOSLIB:[907,16].
For relevant symbol definitions, see JOBTBL.DEF in SOSLIB:[907,16].
lokflg (Num)
may optionally be set to 1 to lock the record prior to reading it (leaving it locked thereafter). To unlock it you would then need to write the record back, using MX_WRITEJCB, and also specifying the same lokflg=1.
status (Num) [out]
returns 0 for success, else an error code
Comments
To scan all of the job table records, start at JOBNO=1 and keep incrementing it, skipping records with JCB'JOBTYP = JOBTYP'FREE, and quitting when you hit a record with JCB'JOBTYP = JOBTYP'EOF.
As is hopefully obvious, MX_READJDB should used with extreme caution, since writing invalid information to jobtbl.sys could cause undesirable results.
History
2023 December, A-Shell 1753: Add current SBX name to the job control block, taking the last ten bytes from the end of the message field