xcall GETJTB, job-table-variable
There are innumerable subroutines which have been written in order to return the current PPN, terminal name, job name, and so on. Although many of the more common subroutines are implemented in A-Shell, it is clearly not possible to cater to all possibilities. A-Shell therefore also contains this subroutine, GETJTB and its counterpart SETJTB to return into a structure, everything that is likely to be needed from the job control block, within an application.
The structure of the job-table-variable is:
MAP1 JOB'TABLE ! 130+ byte area
MAP2 JOBNAM,s,6 ! Job name
MAP2 JOBNO,f,6 ! Entry in job table
MAP2 JOBDEV,s,5 ! Current device
MAP2 JOB'FIL1,x,1
MAP2 PPN ! Current PPN
MAP3 P,b,1 ! Project number
MAP3 PN,b,1 ! Programmer number
MAP2 JOBPRV,f,6 ! Job privilege word
MAP2 JOBPRG,s,6 ! Current program name
MAP2 USRNAM,s,20,"" ! Current user name
MAP2 TRMNAM,s,6 ! Terminal name
MAP2 DRVNAM,s,6 ! Terminal driver name
MAP2 TRMBAUD,f,6 ! Terminal baud rate
MAP2 JOBDFP,x,6 ! Default file protection
MAP2 JOBLVL,f,6 ! Class of user (level)
MAP2 JOBEXP,f,6 ! Experience of user
MAP2 SYSDOS,s,14 ! Operating system name
MAP2 JOBATT,s,6 ! Parent job name
MAP2 SYSVER,s,4 ! Operating sys. version (to 9.9N)
MAP2 JOBSTS,f,6 ! Job status word
MAP2 PRJ'STR,s,3 ! Project no. string
MAP2 PRG'STR,s,3 ! Programmer no. string
MAP2 JOBTYP,f,6 ! Job type
Comments
By calling GETJTB once at the start of each program, all the information likely to be required is readily available, without the need to call a hotchpotch of routines later on.
The operating system field, sysdos, contains the name of the host operating system on which A-Shell is running, for example Windows/32 or AIX. If A-Shell is running in demonstration mode, then an asterisk is appended to the name, e.g. AIX*.
The user name field, usrnam, returns the current logon user name.
The jobnam parameter will be returned with the trailing spaces removed, but the program name (jobprg) will be padded with trailing spaces to a length of 6.
The p and pn fields, being only one byte each, are only capable of handling up to 377,377 (octal). Since A-Shell supports decimal PPNs update to 999,999, you should use the prj’str and prg’str fields instead.