PROCEDURE dum$display_active_job_list, display_active_job_list, disajl (
  output, o: file = $output
  status)

  VAR
    cctqm: string 1..256 = '???????????????????????????????? !"#$%&''()*+,-./0123456789:;'//..
          '<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~????????????????'//..
          '???????????????????????????????????????????????????????????????????????????????????'//..
          '??????????????????????????????'
    jmv$jcb: integer = 300000000(16)              "($sa(jmv$jcb))
    job_fixed_seg_num: integer = 14(16)           "relative to monitor address space
    job_monitor_xcb_offset: integer = 100(16)     "from start of job fixed
  VAREND

  VAR
    ajl: integer
    ajl_entry_size: integer
    ajl_ord: integer
    ajl_p: integer
    field_length: integer
    field_offset: integer
    job_name: integer
    line: string
    local_status: status
    number_of_entries: integer
    output_file: file
    system_ajl_ordinal: integer
    user_id: integer
  VAREND

  IF $file(output open_position) = '$BOI' THEN
    delete_file f=output status=local_status
    set_file_attributes f=output fc=list
  IFEND
  output_file = output.$eoi

  put_line l='1COMMAND: DISPLAY_ACTIVE_JOB_LIST' o=output_file
  put_line l=' ' o=output_file

  jmt$job_control_block field=JOBNAME offset=field_offset length=field_length
  job_name = field_offset/8            "offset into job control block
  jmt$job_control_block field=USER_ID offset=field_offset length=field_length
  user_id = field_offset/8             "offset into job control block

  change_default e=monitor am=pva
  ajl_p = $symbol_address(jmv$ajl_p)
  ajl = $memory(ajl_p)
  IF $nil_pva(ajl) THEN
    put_line l=' The active job list has not yet been established.' o=output_file
    EXIT PROCEDURE
  IFEND

  ajl_entry_size = $memory(ajl_p+14 4)
  system_ajl_ordinal = $memory(ajl_p+10 4)
  number_of_entries = $memory(ajl_p+6 4)/ajl_entry_size
  put_line l=' ajl starts at '//$strrep(ajl 16)//', entry size = '//$strrep(ajl_entry_size 16) o=output_file

  " Change the JPS value to the System Job Monitor XCB value.

  change_processor_register ..
        jps=$rma(((system_ajl_ordinal+job_fixed_seg_num)*100000000(16))+job_monitor_xcb_offset)
  change_default e=job

  FOR ajl_ord = system_ajl_ordinal TO (system_ajl_ordinal + number_of_entries - 1) DO
    IF $memory(ajl+(ajl_ord*ajl_entry_size) 3) > 0 THEN   "process entry if entry is in use.
      line = ' '//$strrep(ajl_ord)//'.'
      change_processor_register ..
            jps=$rma(((ajl_ord+job_fixed_seg_num)*100000000(16))+job_monitor_xcb_offset monitor)
      IF ajl_ord <> system_ajl_ordinal THEN
        line = line//', job name = '//$trim($translate(cctqm $memory_string(jmv$jcb+job_name 31)))
      IFEND
      line = line // ', user id = '//$trim($translate(cctqm $memory_string(jmv$jcb+user_id 31)))
      put_line l=line o=output_file
    IFEND
  FOREND

PROCEND dum$display_active_job_list
