[inherit('sys$library:starlet','lib$spawn','smgdefs','smg$repaint_line',
'BB.PEN')]
module get_node_data;

[global] 
procedure get_node_data;

{Get information needed to process mail on current node.  On systems
where  the executable file is run, but the data base files reside on
another  system on the local area network, it may be necessary to run
a form of the  file ASSIGN.COM before executing the program if there
is no VAX/VMS mail on the system where the program  actually runs.  In
this case, a mail job will be spawned, but it will go to the
designated system where it will enter the mail queue through a
NETNONPRIV account.} 

var
  fullnam : [volatile] nodetype;
  i : [volatile] integer;
  rtlen : [volatile] integer;

begin
  with item_list[1] do
    begin
      length := 4; 
      code := lnm$_max_index;
      adr::integer_ptr := address(num_nodes);
      retlen := address(rtlen);
    end;
  with item_list[2] do
    begin
      length := 0;
      code := 0;
    end;

  {Returns information about BB$DATA_NODE which are the nodes that can access
   the data base files.}
  $trnlnm(tabnam:='LNM$DCL_LOGICAL',lognam:='BB$DATA_NODE',itmlst:=item_list);
  if (num_nodes > 15) then num_nodes:=15;

  with item_list[1] do
    begin
      code := lnm$_index;
      adr::integer_ptr := address(i);
    end;
  with item_list[2] do
    begin
      length := node_name_length;
      code := lnm$_string;
      adr::node_ptr := address(fullnam);
      retlen := address(rtlen);
    end;
  with item_list[3] do
    begin
      length := 0;
      code := 0;
    end;
  if (num_nodes <> -1) then
    for i := 0 to num_nodes do
      begin
        rtlen := 0;
        $trnlnm(tabnam:='LNM$DCL_LOGICAL',lognam:='BB$DATA_NODE',
                itmlst:=item_list);
        data_nodes[i+1] := substr(fullnam,1,rtlen);
      end;

end;
end.
