	SUBROUTINE DISPLAYREC(cmd_type, options, username, running_user,
     +               mail_data, fwd_length, per_length, modified,
     +               displayed_record, record_found, new_record, privl)
	IMPLICIT INTEGER(A-Z)
	INTEGER*4 icode, str$trim, str$position, str$match_wild
	INTEGER*4 per_len, fwd_len, name_len
	BYTE	  fwd_length, per_length
	CHARACTER username*31, running_user*31, mail_data*639
	CHARACTER*256 options(4)
	CHARACTER forward*256, personal*177, name*256, cmd_type*6
	LOGICAL privl, displayed_record, record_found, modified
	LOGICAL new_record
	PARAMETER (STR$_MATCH = 2393113)
C
C	Get record info.
C
	 If (fwd_length.ne.0) then
	 forward = mail_data(1:fwd_length)
	 icode = STR$TRIM(forward, forward, fwd_len)
	 else
	 forward = ' '
	 fwd_len = 1
	 Endif	!Forward field check.
C
	 If (per_length.ne.0) then
	 personal = mail_data(1+fwd_length:fwd_length+per_length)
	 icode = STR$TRIM(personal, personal, per_len)
	 name_len = STR$POSITION(personal(1:31), '|')
	  if (name_len.gt.0) then
	  name     = personal(1:name_len-1)
	  personal = personal(name_len+1:per_len)
	  icode = STR$UPCASE(name_match,name)
	  else
	  name = ' '
	  endif
	 else
	 name = ' '
	 personal = ' '
	 name_len = 1
	 per_len = 1
	 Endif	!Personal/Name field check.
C
C
C
	If ((cmd_type(1:4).eq.'SHOW').or.(cmd_type.eq.'COMPAR'))
     +     CALL MATCHREC(record_found, options, username, name)
	If (cmd_type(1:4).eq.'LIST') record_found = .true.
C
C	Display the record if it is a match.
C

	If((record_found).or.(new_record)) then
	displayed_record = .true.
	CALL LIB$PUT_OUTPUT(' ')
	If ((cmd_type(1:4).ne.'SHOW').and.(.not.modified))
     +       CALL LIB$PUT_OUTPUT(' Current Record -')
	 If (cmd_type(1:4).ne.'SHOW') then
	  If ((modified).or.(new_record))
     +       CALL LIB$PUT_OUTPUT(' New Record -')
	 Endif
	CALL LIB$PUT_OUTPUT(' Username:  ' // username //
     +                      ' Name: ' // name(1:name_len))
C
C	If priveleged or running user matches, display forward.
C
	icode = STR$MATCH_WILD(username,running_user)
	If(icode.eq.STR$_MATCH) then
	CALL LIB$PUT_OUTPUT(' Forward:   ' // forward(1:fwd_len))
	Else
	If (privl) CALL LIB$PUT_OUTPUT(' Forward: ' // forward(1:fwd_len))
	Endif !Priveleged/user match check for forward display.
C
	CALL LIB$PUT_OUTPUT(' Personal: ' // personal(1:per_len))
C
	Else !It is NOT the right record.
	record_found     = .false.
	Endif	!Display record.
C
	return
	end
