From:	CRDGW2::CRDGW2::MRGATE::"SMTP::CRVAX.SRI.COM::RELAY-INFO-VAX" 23-JUN-1989 13:22
To:	MRGATE::"ARISIA::EVERHART"
Subj:	Extracting queue info from VMSmail V5 (callable mail)

Message-Id:  <8906222325.AA04223@crdgw1.ge.com>
Received: From KL.SRI.COM by CRVAX.SRI.COM with TCP; Thu, 22 JUN 89 13:47:13 PDT
Received: from hqhsd.brooks.af.mil by KL.SRI.COM with TCP; Thu, 22 Jun 89 13:17:25 PDT
Date: 22 Jun 89 14:57:00 CST
From: "Jonathan L Wilson" <wilsonjl@hqhsd.brooks.af.mil>
Subject: Extracting queue info from VMSmail V5 (callable mail)
To: "info-vax" <info-vax@kl.sri.com>


Earlier today I posted a request for help in getting a queue name from MAIL
(set by the user using the MAIL command "SET QUEUE queue-name"). I backed up
and tried again. Here's a FORTRAN subroutine which will return the name of the
queue and the length of the returned string. If the user has not set a queue,
it returns "SYS$PRINT". 

Jonathan L Wilson 
TRW Defense Systems Group 
MILNET: WILSONJL@HQHSD.BROOKS.AF.MIL 
Phone:  (512) 536 2236   
------------------------------------------------------------------------

	subroutine get_mail_queue(que_name, que_len) 
	implicit none
!
! Subroutine uses VMS 5 callable mail interface to get the name
! of the queue the user prefers. If the user hasn't set one, SYS$PRINT
! is returned. 
!
! J Wilson / TRW D.S.G. / 22-Jun-1989
! WILSONJL@HQHSD.BROOKS.AF.MIL
!

!
! Parameters
!
	character*31		que_name
	integer*2		que_len
!
! RTL related stuff
!
	integer*4		mail$user_begin 
	integer*4		mail$user_end  
	integer*4		mail$user_get_info  
	include			'($MAILDEF)'
!
! Item list data structure
!
	structure		/itmlst/
	  union
	    map
	      integer*2		buflen
	      integer*2		itmcod
	      integer*4		bufadr
	      integer*4		retadr
	    end map
	    map
	      integer*4		end_list
	    end map
	  end union
	end structure
!
! Local variables
!
	record /itmlst/		null_list
	record /itmlst/		output_list(2)
	record /itmlst/		input_list(2)
	integer*4		status
	integer*4		context
!
! Initialize item lists
!
	null_list.end_list  = 0 	
	output_list(1).buflen   = 31
	output_list(1).itmcod   = MAIL$_USER_QUEUE
	output_list(1).bufadr   = %loc(que_name)
	output_list(1).retadr   = %loc(que_len)
	output_list(2).end_list = 0
!
! Establish context 
! 
	status = MAIL$USER_BEGIN( context, null_list, null_list)
	if (.not. status) call lib$signal(%val(status))
!
! Get the queue name
!
	status = MAIL$USER_GET_INFO(context,null_list,output_list)
	if (.not. status) call lib$signal(%val(status))
!
! Finish context
!
	status = MAIL$USER_END( context, null_list, null_list)
	if (.not. status) call lib$signal(%val(status))

	RETURN
	END


