Reorganized April 2024
xcall MIAMEX, MX_READJCB, jobno, buffer {,lokflg}
xcall MIAMEX, MX_WRITEJCB, jobno, buffer {,lokflg}
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. It should be mapped per the JCB'REC map statement in JOBTBL.MAP in SOSLIB:[907,16].
The jcb’jobtyp field values are defined by the JOBTYP symbols in JOBTBL.DEF in SOSLIB:[907,16].
The jcb’jobsts field values are defined by the JCBSTS symbols in JOBTBL.DEF.
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 Function 74, and also specifying the same lokflg=1.
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