Detailed Descriptions > MIAMEX

MIAMEX 73: Read job control block

xcall MIAMEX, MX_READJCB, jobno, buffer {,lokflg}

This function reads a job control block or record from JOBTBL.SYS.

jobno (Num) is 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 is the record buffer to receive the data. It should be mapped as:

MAP1 JCB'REC

! JCB Record

 

MAP2 JCB'PID,i,4

! Process id

 

MAP2 JCB'PPID,i,4

! Parent's Process id

 

MAP2 JCB'TIMELOGGEDIN,i,4

! Time when we logged in

 

MAP2 JCB'TOTREADS,i,4

! Total disk reads

 

MAP2 JCB'TOTWRITES,i,4

! Total writes

 

MAP2 JCB'TOTQLOCKS,i,4

! Total qlocks

 

MAP2 JCB'TOTINSTR,i,4

! Total BASIC instructions

 

MAP2 JCB'TOTCMDS,i,4

! Total LIT commands

 

MAP2 JCB'TOTKEYS,i,4

! Total keystrokes

 

MAP2 JCB'JOBTYP,b,2

! Job type (see JOBTYP'xxx)

 

MAP2 JCB'JOBSTS,b,2

! Job status (see JOBSTS'xxx)

 

MAP2 JCB'JOBNAM,s,8

! Job name

 

MAP2 JCB'TRMTDV,s,8

! Terminal driver

 

MAP2 JCB'PRGNAM,s,8

! Program name

 

MAP2 JCB'DRIVE,s,8

! DSKn:

 

MAP2 JCB'PROJ,b,1

! Project

 

MAP2 JCB'PRGN,b,1

! Programmer #

 

MAP2 JCB'JOBLVL,b,1

! Job experience level

 

MAP2 JCB'JOBCLS,b,1

! Job class

 

MAP2 JCB'CONDEV,s,20

! Machine or device

 

MAP2 JCB'USRNAM,s,20

! User login name

 

MAP2 JCB'MEMK,b,2

! Memory in K

 

MAP2 JCB'JOBNO,b,2

! Our job # (1 is first)

 

MAP2 JCB'IJCCMD,b,1

! Inter-job Comm command

 

MAP2 JCB'IJCSTS,b,1

! Inter-job Comm status

 

MAP2 JCB'IJCMSG,b,1

! Inter-job Comm msg type/fmt

 

MAP2 JCB'IJCBUF,s,110

! Inter-job Comm msg buf

 

MAP2 JCB'IP(4),b,1

! IP address

 

MAP2 JCB'LASTOP,b,1

! Last BASIC opcode

 

MAP2 JCB'LASTLNO,b,2

! Last BASIC line #

 

MAP2 JCB'LASTSBR

! Last sbr (rad50)

 

 

MAP3 JCB'LASTSBR1,b,2

 

 

 

MAP3 JCB'LASTSBR2,b,2

 

 

MAP2 JCB'JOBFIL,x,12

! Future expansion

 

The jcb’jobtyp field values are defined as follows:

MAP1 JOBTYP'SYMBOLS

! see JCB'JOBTYP

 

MAP2 JOBTYP'FREE,b,2,0

! free rec

 

MAP2 JOBTYP'ACTIVE,b,2,1

! active job

 

MAP2 JOBTYP'ALLOC,b,2,2

! allocated via trmdef

 

MAP2 JOBTYP'HEX,b,2,16

! hex mode

 

MAP2 JOBTYP'SLAVE,b,2,512

! background task

 

MAP2 JOBTYP'PSHELL,b,2,1024

! pshell controller

 

MAP2 JOBTYP'DISCON,b,2,2048

! job disconnected

 

MAP2 JOBTYP'EOF,b,2,32768

! eof

 

The jcb’jobsts field values are defined as follows:

MAP1 JOBSTS'SYMBOLS

! see JCB'JOBSTS

 

MAP2 JOBSTS'MON,b,2,1

! job at monitor level

 

MAP2 JOBSTS'SUS,b,2,2

! job suspended

 

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.

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.