This example illustates a basic technique for finding the MQ for a specific thread.

We   find   the   MQ   for   thread   slot   8 :
# # . p8
  Slot    Pid    Ppid   Csid   Ord    Sta   Pri    pTSD       pPTDA      pTCB       Disp   SG   Name
* 0008 #   0004   0001   0004   0001   blk   0500   ab596000   ab9c7020   ab988bf0   1ed0   01   pmshell
# # dd   % ab988bf0   + 74
% ab988c64    00000000   00070000   00041304   12d2ca34
% ab988c74    12d2ded8   00000000   00000000   00000000
% ab988c84    00000000   00000000   00000000   00000000
% ab988c94    00000000   00000000   00000000   00000000
% ab988ca4    00000000   00000000   00000000   00000000
% ab988cb4    00000000   00000000   00000000   00000000
% ab988cc4    00000000   00000000   00000000   00000000
% ab988cd4    00000000   00000000   00000000   00000000

The TCB address is found from the .P output.

Offset +0x74 into the TCB is the saved thread local memory area.

Offset +0x08 into the TLMA are the AAB registers.

The first is the last PM error to occur on this thread. In this case severity 4 error code 1304.

The next double-word is the PMQ.

We can verify this by displaying it and checking the offset +0a4 is the same thread slot number.

Notes:

After fix-pack 7 the TCB in WARP is extended by 4 bytes. The TLMA begins at TCB+0x78.

Since AAB is allocated using DosAllocThreadLocalMemory its location in the TLMA is depended how many TLMA allocations are made prior to PM initialising in the thread. In practice this is normally found at TLMA offset +0x8, but if the AAB is displaced it can usually be located by searching the TLMA for the MQ address which is normally in the range 12000000 to 14000000.