

 PROC dum$display_primary_task_list, display_primary_task_list, display_ptl, disptl (
   ptl_ordinal, ptlo: integer 0 .. 4095 OR KEY all, a = all
   output, o: file = output
   help: boolean = FALSE
   status)

   IF $value(help) THEN
     put_line '0PROC display_ptl, disptl (                                   ' o=$output
     put_line '   ptl_ordinal, ptlo: integer 0 .. 4095 OR KEY all, a = all   ' o=$output
     put_line '   output, o: file = $OUTPUT                                  ' o=$output
     put_line '   help: boolean = FALSE                                      ' o=$output
     put_line '   status)                                                    ' o=$output
     put_line '0This procedure is used during an Analyze_Dump session as a   ' o=$output
     put_line ' means of producing the contents of the Primary_Task_List.  It' o=$output
     put_line ' produces the entire PTL (by default), or it can produce a    ' o=$output
     put_line ' specific PTL entry.                                          ' o=$output
     put_line '                                                              ' o=$output
     EXIT_PROC
  IFEND

   crev tmt$task_status k=string d=0..14
   tmt$task_status(0) = 'TMC$TS_NULL'
   tmt$task_status(1) = 'TMC$TS_READY (= TMC$TS_LAST_STATUS_IN_DCT)'
   tmt$task_status(2) = 'TMC$TS_TIMEOUT_REQEXP_SHORTSHRT (= TMC$TS_FIRST_STATUS_IN_WAIT_Q)'
   tmt$task_status(3) = 'TMC$TS_TIMEOUT_REQEXP_LONGLONG'
   tmt$task_status(4) = 'TMC$TS_TIMEOUT_REQEXP_LONGVLONG (= TMC$TS_LAST_STATUS_IN_WAIT_Q)'
   tmt$task_status(5) = 'TMC$TS_EXECUTING'
   tmt$task_status(6) = 'TMC$TS_TIMEOUT_REQEXP_INFLONG'
   tmt$task_status(7) = 'TMC$TS_TIMEOUT_REQEXP_INFVLONG'
   tmt$task_status(8) = 'TMC$TS_READY_BUT_SWAPPED'
   tmt$task_status(9) = 'TMC$TS_IO_WAIT_NOT_QUEUED (= TMC$TS_FIRST_READY_UNCOND)'
   tmt$task_status(10) = 'TMC$TS_PAGE_WAIT (= TMC$TS_FIRST_EXTERNAL_QUEUE)'
   tmt$task_status(11) = 'TMC$TS_MEMORY_WAIT'
   tmt$task_status(12) = 'TMC$TS_SEGMENT_LOCK_WAIT'
   tmt$task_status(13) = 'TMC$TS_JOB_EVENT_QUEUE'
   tmt$task_status(14) = 'TMC$TS_IO_WAIT_QUEUED'
   crev tmt$idle_status k=string d=0..3
   tmt$idle_status(0) = 'TMC$IS_NOT_IDLED'
   tmt$idle_status(1) = 'TMC$IS_IDLE_INITIATED'
   tmt$idle_status(2) = 'TMC$IS_IDLED'
   tmt$idle_status(3) = 'TMC$IS_IDLED_SCHED_NOTIFIED'
   crev syt$monitor_flag k=string d=0..15
   syt$monitor_flag(0) = 'TMC$MF_CAUSE_JOB_FREE_FLAG_TRAP'
   syt$monitor_flag(1) = 'MMC$MF_SEGMENT_MGR_FLAG'
   syt$monitor_flag(2) = 'DMC$MF_GLOBAL_SFT_FLAG'
   syt$monitor_flag(3) = 'DMC$MF_LOCAL_SFT_FLAG'
   syt$monitor_flag(4) = 'SYC$MF_SYSTEM_DEBUGGER'
   syt$monitor_flag(5) = 'SYC$MF_INVOKE_SYSDEBUG'
   syt$monitor_flag(6) = 'SYC$MF_HANG_TASK'
   syt$monitor_flag(7) = 'SYC$MF_DUMP_JOB_ENVIRONMENT'
   syt$monitor_flag(8) = 'SYC$MF_CAUSE_JOB_RECOVERY'
   syt$monitor_flag(9) = 'UNDEFINED_9'
   syt$monitor_flag(10) = 'UNDEFINED_10'
   syt$monitor_flag(11) = 'UNDEFINED_11'
   syt$monitor_flag(12) = 'UNDEFINED_12'
   syt$monitor_flag(13) = 'UNDEFINED_13'
   syt$monitor_flag(14) = 'UNDEFINED_14'
   syt$monitor_flag(15) = 'UNDEFINED_15'
   crev syt$system_flag k=string d=0..31
   syt$system_flag(0) = 'UNDEFINED_0'
   syt$system_flag(1) = 'AVC$MONITOR_STATISTICS_FLAG'
   syt$system_flag(2) = 'PMC$SF_TERMINATE_TASK'
   syt$system_flag(3) = 'JMC$DROP_JOB_FLAG_ID'
   syt$system_flag(4) = 'TMC$MAINFRAME_LINKED_SIGNALS'
   syt$system_flag(5) = 'JMC$LOGOUT_FLAG_ID'
   syt$system_flag(6) = 'JMC$JOB_TIME_LIMIT_FLAG_ID'
   syt$system_flag(7) = 'DSC$RETRIEVE_SYSTEM_MESSAGE'
   syt$system_flag(8) = 'NAC$CHANNELNET_INPUT_RECEIVED'
   syt$system_flag(9) = 'NLC$XT_WORK_LIST_FLAG'
   syt$system_flag(10) = 'NAC$XI_LOCAL_EVENT'
   syt$system_flag(11) = 'NAC$CHANNELNET_LOCAL_EVENT'
   syt$system_flag(12) = 'NAC$NOTIFY_ROUTING_ME'
   syt$system_flag(13) = 'SYC$JOB_RECOVERY_FLAG'
   syt$system_flag(14) = 'IOC$SUBSYSTEM_IO_COMPLETED'
   syt$system_flag(15) = 'DSC$LOG_DFT_FLAG_ID'
   syt$system_flag(16) = 'OFC$OPERATOR_BREAK_FLAG'
   syt$system_flag(17) = 'OSC$SYSTEM_UNSTEP_RESUME_FLAG'
   syt$system_flag(18) = 'NAC$CHANNELNET_OUTPUT_COMPLETE'
   syt$system_flag(19) = 'NAC$ASSIGN_CONN_TO_AM_TASK'
   syt$system_flag(20) = 'MMC$FAILED_FILE_ALLOC_FLAG'
   syt$system_flag(21) = 'UNDEFINED_21'
   syt$system_flag(22) = 'UNDEFINED_22'
   syt$system_flag(23) = 'UNDEFINED_23'
   syt$system_flag(24) = 'UNDEFINED_24'
   syt$system_flag(25) = 'UNDEFINED_25'
   syt$system_flag(26) = 'UNDEFINED_26'
   syt$system_flag(27) = 'UNDEFINED_27'
   syt$system_flag(28) = 'UNDEFINED_28'
   syt$system_flag(29) = 'UNDEFINED_29'
   syt$system_flag(30) = 'UNDEFINED_30'
   syt$system_flag(31) = 'UNDEFINED_31'

   ptl_base = $mem($sa(tmv$ptl_p))      " Beginning of PTL"
   ptl_entry = ptl_base + 20(16)        " First real entry"
   IF $file($value(output) open_position) = '$EOI' THEN
     output_file = $string($value(output))
   ELSE
     output_file = $string($value(output))//'.$eoi'
   IFEND

   IF $value_kind(ptl_ordinal) = 'NAME' THEN
     line = ' PTL ENTRY: PTL_0'
     putl line o=$fname(output_file)

     WHILE ($mem(ptl_entry+3 1) > 0) DO
       IF $mem(ptl_entry+17(16) 1) <> 0 THEN
         line = '0PTL ENTRY: TASK_'//$strrep(((ptl_entry-ptl_base)/20(16)) 16)//'(16)'
         putl line o=$fname(output_file)
         put_line ' Task '//$strrep(((ptl_entry-ptl_base)/20(16)) 16)//'(16):' o=$fname(output_file)
         val = $mem(ptl_entry+0 2)
         line = '0  ptl_thread = '//$strrep(val 16)//'(16)'
         put_line line o=$fname(output_file)
         val = $mem(ptl_entry+2 1)
         line = '   index = '//$strrep(val 16)//'(16)'
         val = $mem(ptl_entry+3 1)
         line = line//', sequence_number = '//$strrep(val 16)//'(16)'
         put_line line o=$fname(output_file)
         val = $mem(ptl_entry+4 4)
         line = '   xcb_offset = '//$strrep(val 16)//'(16)'
         put_line line o=$fname(output_file)
         val = $mem(ptl_entry+8 2)
         line = '   ijl_ordinal = '//$strrep(val 16)//'(16):'
         put_line line o=$fname(output_file)
         line = '     block_number = '//$strrep((val/32) 16)//'(16)'
         line = line//', block_index = '//$strrep($mod(val 2048) 16)//'(16)'
         put_line line o=$fname(output_file)
         val = $mem(ptl_entry+0a(16) 1)
         IF (val < 0) OR (val > 14) THEN
           line = '   status = --> RANGE ERROR <--'
         ELSE
           line = '   status = '//tmt$task_status(val)
         IFEND
         put_line line o=$fname(output_file)
         val = $mem(ptl_entry+0b(16) 1)
         IF (val < 0) OR (val > 14) THEN
           line = '   new_task_status = --> RANGE ERROR <--'
         ELSE
           line = '   new_task_status = '//tmt$task_status(val)
         IFEND
         put_line line o=$fname(output_file)
         val = $mem(ptl_entry+0c(16) 1)
         IF (val < 0) OR (val > 3) THEN
           line = '   idle_status = --> RANGE ERROR <--'
         ELSE
           line = '   idle_status = '//tmt$idle_status(val)
         IFEND
         put_line line o=$fname(output_file)
         val = $mem(ptl_entry+0d(16) 2)
         line = '   queue_link (GTID): index = '//$strrep(val 16)//'(16)'
         val = $mem(ptl_entry+0f(16) 1)
         line = line//', sequence_number = '//$strrep(val 16)//'(16)'
         put_line line o=$fname(output_file)
         val = $mem(ptl_entry+10(16) 1)
         line = '   wait_inhibited = '//$strrep(val<>0)
         put_line line o=$fname(output_file)
         val = $mem(ptl_entry+11(16) 2)
         line = '   monitor_flags = { }'
         put_line line o=$fname(output_file)
         FOR i=0 TO 15 DO
           IF $bit(val 48+i) THEN
             line = '                    '//syt$monitor_flag(i)
             put_line line o=$fname(output_file)
           IFEND
         FOREND
         val = $mem(ptl_entry+13(16) 2)
         line = '   system_flags = { }'
         put_line line o=$fname(output_file)
         FOR i=0 TO 31 DO
           IF $bit(val 32+i) THEN
             line = '                   '//syt$system_flag(i)
             put_line line o=$fname(output_file)
           IFEND
         FOREND
         val = $mem(ptl_entry+17(16) 1)
         line = '   dispatching_priority = '//$strrep(val 16)//'(16)'
         put_line line o=$fname(output_file)
         next_task = $mem(ptl_entry+18(16) 2)
         line = '   ijl_thread (ordinal of next task) = '//$strrep(next_task 16)//'(16)'
         put_line line o=$fname(output_file)
         val = $mem(ptl_entry+1A(16) 6)
         line = '   end_of_wait_time = '//$strrep(val 16)//'(16)'
         put_line line o=$fname(output_file)
       ELSE
         line = '0PTL ENTRY: TASK_'//$strrep(((ptl_entry-ptl_base)/20(16)) 16)//'(16)'
         putl line o=$fname(output_file)
         putl ' This task is undefined/unused.' o=$fname(output_file)
       IFEND
       ptl_entry = ptl_entry + 20(16)

     WHILEND

   ELSE

     ptl_entry = ptl_base + ($value(ptl_ordinal) * 20(16))
     IF ($mem(ptl_entry+3 1) = 0) AND ($mem(ptl_entry+17(16) 1) = 0) THEN
       line = ' PTL ENTRY: TASK_'//$strrep(((ptl_entry-ptl_base)/20(16)) 16)//'(16)'
       putl line o=$fname(output_file)
       putl '0This task is undefined/unused.' o=$fname(output_file)
       EXIT_PROC
     IFEND

     line = ' PTL ENTRY: TASK_'//$strrep(((ptl_entry-ptl_base)/20(16)) 16)//'(16)'
     putl line o=$fname(output_file)
     put_line '0Task '//$strrep(((ptl_entry-ptl_base)/20(16)) 16)//'(16):' o=$fname(output_file)
     val = $mem(ptl_entry+0 2)
     line = '0  ptl_thread = '//$strrep(val 16)//'(16)'
     put_line line o=$fname(output_file)
     val = $mem(ptl_entry+2 1)
     line = '   index = '//$strrep(val 16)//'(16)'
     val = $mem(ptl_entry+3 1)
     line = line//', sequence_number = '//$strrep(val 16)//'(16)'
     put_line line o=$fname(output_file)
     val = $mem(ptl_entry+4 4)
     line = '   xcb_offset = '//$strrep(val 16)//'(16)'
     put_line line o=$fname(output_file)
     val = $mem(ptl_entry+8 2)
     line = '   ijl_ordinal = '//$strrep(val 16)//'(16):'
     put_line line o=$fname(output_file)
     line = '     block_number = '//$strrep((val/32) 16)//'(16)'
     line = line//', block_index = '//$strrep($mod(val 2048) 16)//'(16)'
     put_line line o=$fname(output_file)
     val = $mem(ptl_entry+0a(16) 1)
     IF (val < 0) OR (val > 14) THEN
       line = '   status = --> RANGE ERROR <--'
     ELSE
       line = '   status = '//tmt$task_status(val)
     IFEND
     put_line line o=$fname(output_file)
     val = $mem(ptl_entry+0b(16) 1)
     IF (val < 0) OR (val > 14) THEN
       line = '   new_task_status = --> RANGE ERROR <--'
     ELSE
       line = '   new_task_status = '//tmt$task_status(val)
     IFEND
     put_line line o=$fname(output_file)
     val = $mem(ptl_entry+0c(16) 1)
     IF (val < 0) OR (val > 3) THEN
       line = '   idle_status = --> RANGE ERROR <--'
     ELSE
       line = '   idle_status = '//tmt$idle_status(val)
     IFEND
     put_line line o=$fname(output_file)
     val = $mem(ptl_entry+0d(16) 2)
     line = '   queue_link (GTID): index = '//$strrep(val 16)//'(16)'
     val = $mem(ptl_entry+0f(16) 1)
     line = line//', sequence_number = '//$strrep(val 16)//'(16)'
     put_line line o=$fname(output_file)
     val = $mem(ptl_entry+10(16) 1)
     line = '   wait_inhibited = '//$strrep(val<>0)
     put_line line o=$fname(output_file)
     val = $mem(ptl_entry+11(16) 2)
     line = '   monitor_flags = { }'
     put_line line o=$fname(output_file)
     FOR i=0 TO 15 DO
       IF $bit(val 48+i) THEN
         line = '                    '//syt$monitor_flag(i)
         put_line line o=$fname(output_file)
       IFEND
     FOREND
     val = $mem(ptl_entry+13(16) 2)
     line = '   system_flags = { }'
     put_line line o=$fname(output_file)
     FOR i=0 TO 31 DO
       IF $bit(val 32+i) THEN
         line = '                   '//syt$system_flag(i)
         put_line line o=$fname(output_file)
       IFEND
     FOREND
     val = $mem(ptl_entry+17(16) 1)
     line = '   dispatching_priority = '//$strrep(val 16)//'(16)'
     put_line line o=$fname(output_file)
     next_task = $mem(ptl_entry+18(16) 2)
     line = '   ijl_thread (ordinal of next task) = '//$strrep(next_task 16)//'(16)'
     put_line line o=$fname(output_file)
     val = $mem(ptl_entry+1A(16) 6)
     line = '   end_of_wait_time = '//$strrep(val 16)//'(16)'
     put_line line o=$fname(output_file)

   IFEND

 PROCEND dum$display_primary_task_list
