	SUBROUTINE GET_MAIL_NODE(mail_node, local_node, number_mail_nodes)
	IMPLICIT INTEGER(A-Z)
	INTEGER*4 icode, mail_len, number_mail_nodes, mail_index
	INTEGER*4 trnlst_l(16), SYS$TRNLNM, mail_table_len
	INTEGER*2 trnlst(32)
C
	CHARACTER mail_node(127)*31, local_node*31
	CHARACTER mail_name*255, mail_table*31
	CHARACTER*16 table_name /'LNM$SYSTEM_TABLE'/
c	CHARACTER*17 table_name /'LNM$PROCESS_TABLE'/
	LOGICAL get_logical
	EQUIVALENCE (trnlst, trnlst_l)
	PARAMETER LNM$C_MAXDEPTH     = '0000000A'X
	PARAMETER LNM$C_NAMLENGTH    = '000000FF'X
	PARAMETER LNM$C_TABNAMLEN    = '0000001F'X
	PARAMETER LNM$M_CASE_BLIND   = '02000000'X
	PARAMETER LNM$M_CONCEALED    = '00000100'X
	PARAMETER LNM$M_CONFINE      = '00000002'X
	PARAMETER LNM$M_CREATE_IF    = '01000000'X
	PARAMETER LNM$M_CRELOG       = '00000004'X
	PARAMETER LNM$M_EXISTS       = '00000400'X
	PARAMETER LNM$M_NO_ALIAS     = '00000001'X
	PARAMETER LNM$M_SHAREABLE    = '00010000'X
	PARAMETER LNM$M_TABLE        = '00000008'X
	PARAMETER LNM$M_TERMINAL     = '00000200'X
	PARAMETER LNM$S_LNMDEF       = '00000004'X
	PARAMETER LNM$V_CASE_BLIND   = '00000019'X
	PARAMETER LNM$V_CONCEALED    = '00000008'X
	PARAMETER LNM$V_CONFINE      = '00000001'X
	PARAMETER LNM$V_CREATE_IF    = '00000018'X
	PARAMETER LNM$V_CRELOG       = '00000002'X
	PARAMETER LNM$V_EXISTS       = '0000000A'X
	PARAMETER LNM$V_NO_ALIAS     = '00000000'X
	PARAMETER LNM$V_SHAREABLE    = '00000010'X
	PARAMETER LNM$V_TABLE        = '00000003'X
	PARAMETER LNM$V_TERMINAL     = '00000009'X
	PARAMETER LNM$_ACMODE        = '00000006'X
	PARAMETER LNM$_ATTRIBUTES    = '00000003'X
	PARAMETER LNM$_CHAIN         = 'FFFFFFFF'X
	PARAMETER LNM$_INDEX         = '00000001'X
	PARAMETER LNM$_LENGTH        = '00000005'X
	PARAMETER LNM$_LNMB_ADDR     = '00000009'X
	PARAMETER LNM$_MAX_INDEX     = '00000007'X
	PARAMETER LNM$_PARENT        = '00000008'X
	PARAMETER LNM$_STRING        = '00000002'X
	PARAMETER LNM$_TABLE         = '00000004'X
C
	EXTERNAL netmail_nomailnode, netmail_nolocalnode
	INCLUDE '($LIBDEF)'
	INCLUDE '($SSDEF)'
C
C	Set up item list for TRNLNM system service.
C
C	Index item.
	mail_len     = 0
	trnlst(1)    = 4
	trnlst(2)    = LNM$_INDEX
	trnlst_l(2)  = %LOC(mail_index)
	trnlst_l(3)  = 0
C	Logical string item.
	trnlst(7)    = 255
	trnlst(8)    = LNM$_STRING
	trnlst_l(5)  = %LOC(mail_name)
	trnlst_l(6)  = 0
C	Length of logical.
	trnlst(13)   = 4
	trnlst(14)   = LNM$_LENGTH
	trnlst_l(8)  = %LOC(mail_len)
	trnlst_l(9)  = 0
C	Max number logicals in list.
	trnlst(19)   = 4
	trnlst(20)   = LNM$_MAX_INDEX
	trnlst_l(11) = %LOC(number_mail_nodes)
	trnlst_l(12) = 0
C	Max number logicals in list.
	trnlst(25)   = 31
	trnlst(26)   = LNM$_TABLE
	trnlst_l(14) = %LOC(mail_table)
	trnlst_l(15) = %LOC(mail_table_len)
	trnlst_l(16) = 0
C
C	Set default strings and logicals.
C
	get_logical = .true.
	mail_name = ' '
	local_node  = ' '
	DO 100 I = 1,127
	mail_node(I) = ' '
100	continue
C
C	Translate logical name NETMAIL.
C
	DO WHILE (get_logical)
	icode = SYS$TRNLNM(,table_name,'NETMAIL',,trnlst)
	mail_index = mail_index + 1
	  if (icode.eq.SS$_NOTRAN)
     &    CALL LIB$SIGNAL(netmail_nomailnode)
	icode = STR$UPCASE(mail_node(mail_index), mail_name)
	mail_name = ' '
	if (mail_index.gt.number_mail_nodes) get_logical = .false.
	Enddo ! End loop for mail node logical search.
C
C	Translate logical name SYS$NODE
C
	icode = LIB$SYS_TRNLOG('SYS$NODE',,local_node)
	 if(local_node(1:1).eq.'_') local_node = local_node(2:31)
	  if (icode.eq.SS$_NOTRAN)
     &    CALL LIB$SIGNAL(netmail_nolocalnode)
	icode = STR$UPCASE(local_node, local_node)
C
	return
	end
