From:	CRDGW2::CRDGW2::MRGATE::"SMTP::CRVAX.SRI.COM::RELAY-INFO-VAX" 23-MAY-1989 19:10
To:	MRGATE::"ARISIA::EVERHART"
Subj:	F$GETQUI example

Received: From KL.SRI.COM by CRVAX.SRI.COM with TCP; Tue, 23 MAY 89 10:38:53 PDT
Received: from ucbvax.Berkeley.EDU by KL.SRI.COM with TCP; Tue, 23 May 89 10:37:48 PDT
Received: by ucbvax.Berkeley.EDU (5.61/1.36)
	id AA27867; Tue, 23 May 89 10:17:32 -0700
Received: from USENET by ucbvax.Berkeley.EDU with netnews
	for info-vax@kl.sri.com (info-vax@kl.sri.com)
	(contact usenet@ucbvax.Berkeley.EDU if you have questions)
Date: 23 May 89 16:53:18 GMT
From: amelia!howells@ames.arc.nasa.gov  (Mr. Neutron)
Organization: Aeroflightdynamics Directorate
Subject: F$GETQUI example
Message-Id: <2074@amelia.nas.nasa.gov>
Sender: info-vax-request@kl.sri.com
To: info-vax@kl.sri.com

Just in case anybody wants it, here is an example dcl procedure that I wrote
while trying to understand the new f$getqui lexical function.

$! 
$! GETQUI.COM
$!
$! See comments at the end of this file
$!
$!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
$!
$	if p1 .eqs. "" then inquire p1 "Queue"
$	if p1 .eqs. "" then exit
$	queue_name = p1
$	temp = f$getqui("cancel_operation")
$	qname = f$getqui("display_queue","queue_name",queue_name,"wildcard")
$	write sys$output "Queue:  ",qname
$loop:
$	jname = f$getqui("display_job","job_name",,"all_jobs")
$	if jname .eqs. "" then exit
$	entry = -
	  f$getqui("display_job","entry_number",,"freeze_context,all_jobs")
$	date = f$getqui("display_job","after_time",,"freeze_context,all_jobs")
$	uname = f$getqui("display_job","username",,"freeze_context,all_jobs")
$	uic = f$getqui("display_job","uic",,"freeze_context,all_jobs")
$	hold_status = -
	  f$getqui("display_job","job_holding",,"freeze_context,all_jobs")
$	pend_status = -
	  f$getqui("display_job","job_pending",,"freeze_context,all_jobs")
$	exec_status = -
	  f$getqui("display_job","job_executing",,"freeze_context,all_jobs")
$	susp_status = -
	  f$getqui("display_job","job_suspended",,"freeze_context,all_jobs")
$	time_status = -
	  f$getqui("display_job","job_timed_release",,"freeze_context,all_jobs")
$	accname = -
	   f$getqui("display_job","account_name",,"freeze_context,all_jobs")
$	pid = f$getqui("display_job","job_pid",,"freeze_context,all_jobs")
$	prior = f$getqui("display_job","priority",,"freeze_context,all_jobs")
$	file = f$getqui("display_file","file_specification",,)
$	write sys$output "----------------------------------------"
$	write sys$output "Job name: ''jname'"
$	write sys$output "Entry: ''entry'"
$	write sys$output "Username: ''uname'"
$	write sys$output "UIC: ''uic'"
$	write sys$output "Account: ''accname'"
$	if exec_status then -
	   write sys$output "Job is currently executing"
$	if hold_status then -
	   write sys$output "Job is being held"
$	if pend_status then -
	   write sys$output "Job is pending"
$	if susp_status then -
	   write sys$output "Job is suspended"
$	if exec_status then -
	   write sys$output "PID: ''pid'"
$	write sys$output "Priority: ''prior'"
$	if time_status then -
	   write sys$output "Holding until: ''date'"
$	write sys$output "File spec: ''file'"
$	goto loop
$!
$!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
$!
$! GETQUI.COM
$!
$! Purpose:
$!
$!	This is an example of how to use the new F$GETQUI lexical function
$!	in VMS 5.0. The manual was a little fuzzy on how to use this function
$!	so I whipped this up as an example. Under version 4.x, in order to get 
$!	information about jobs holding in a batch queue, you had to do 
$!	something like:
$!
$!		SHOW QUEUE/ALL/FULL/OUTPUT=QUEUE.DAT
$!
$!	and then open the file with the DCL OPEN command and read one line at
$!	a time in order to extract the information you needed (like "Holding"
$!	status, etc.). The new lexical function provides a more direct, and
$!	faster, access to this information. Using this command file as a
$!	template, certain information can be returned and used as a basis
$!	for further commands. This example is concerned with batch queues
$!	only. Refer to the DCL Dictionary (DCL-266) for itemcodes having to
$!	do with print queues.
$!
$!	Requires READ access to the job or SYSPRV or OPER privilege to
$!	obtain job and file information.
$!
$! Example:
$!
$!	$ @GETQUI BAT$SYSTEM
$!
$!	Information returned for all jobs in the queue BAT$SYSTEM includes:
$!
$!	job name
$!	entry number
$!	username associated with the job
$!	uic associated with the job
$!	account name associated with the job
$!	executing status (if currently executing)
$!	holding status (if held until explicitly released)
$!	pending status (if pending execution)
$!	suspend status (if suspended execution)
$!	pid of the executing batch job (if executing)
$!	priority of the job
$!	date and time when the job is scheduled to run (if time released)
$!	full file specification of the job
$!
$! Author:
$!
$!	John Howells
$!	Sterling Software
$!

--------------------------------------------------------------------------------
John Howells           |  "Science does not     | howells@pioneer.arc.nasa.gov
Sterling Software      |   remove the terror    | howells@krypton.arc.nasa.gov
Palo Alto, Ca.         |   of the Gods"         | howells%kry@ames-io.arpa

