externalroutine  listijob(string (255) s)
   string (50) restofs,in,out
   externalroutinespec  define(string (255) s)
   integer  i, flag, l, count, j
   recordformat  rf(integer  conad, filetype, datastart, dataend)
   systemroutinespec  connect(string (31) file, integer  mode, hole,
           project, record (rf)name  r, integername  flag)
   systemstringfnspec  unpackdate(integer  p)
   systemstringfnspec  unpacktime(integer  p)
   recordformat  ijob head f( c 
      integer  end, start, size, filetype,
      checksum, date time, format, sp0,
      maxcells, freep, freen, sp1,
      halfintegerarray  list head(0:127))
   record (ijob head f)name  ijob head
   recordformat  cell f(string (6) user, string (16) device, integer  size,
     halfinteger  last, next, integer  time q, time unq, string (6) jname)
   ! This requires 48 bytes.
   record (cell f)arrayname  cell
   record (cell f)arrayformat  caf(1:50000)
   record (cell f)name  c
   record (rf) r
 
   routine  output(string (255)s, integer  l)
      printstring(s); spaces(l-length(s))
   end 

   in = "JJ#SPIJOB"; out = ".LP"; ! Defaults.
   if  s -> s.(",").restofs start 
      out = restofs unless  restofs=""
   finish 
   in = s unless  s=""
   define("20,".out)
   connect(in, 0, 0, 0, r, flag)
   monitor  and  stop  if  flag#0
   selectoutput(20)

   ijob head == record(r_conad)
   cell == array(r_conad+ijob head_start, caf)

   printstring("File ".in." - header information:")
   newlines(2)
   printstring("maxcells:"); write(ijob head_maxcells,3); newline
   printstring("freep:"); write(ijob head_freep,3); newline
   printstring("freen:"); write(ijob head_freen,3); newline
   newlines(4)
   count = 0
   for  l=0,1,127 cycle 
      printstring("List no:"); write(l,1); newlines(2)
      printstring(" last cell next     user    jname  device")
      printstring("                time q            time unq        size")
      newline
   
      i = ijob head_listhead(l); j = 0
      while  i#0 cycle 
         count = count+1; j = j+1
         c == cell(i)
         newline
         write(c_last,4); write(i,4); write(c_next,4)
         spaces(4); printstring(c_user)
         spaces(2); output(c_jname,6)
         spaces(2); output(c_device,16)
         spaces(2); printstring(unpack date(c_timeq))
         space; printstring(unpack time(c_timeq))
         spaces(2); printstring(unpack date(c_time unq))
         space; printstring(unpack time(c_time unq))
         write(c_size,5)
         i = c_next
         exit  if  j>100; ! To avoid getting stuck in loops.
      repeat 
      newlines(2)
   repeat 
   newlines(2)
   printstring("Total cells in use:"); write(count,1)
   newlines(3)
end ; ! Of %externalroutine listijob.
endoffile