From:	CRDGW2::CRDGW2::MRGATE::"SMTP::CRVAX.SRI.COM::RELAY-INFO-VAX"  2-NOV-1989 18:32
To:	MRGATE::"ARISIA::EVERHART"
Subj:	Using F$GETQUI Lexical Function (An example!)

Message-Id:  <8911020655.AA28532@crdgw1.ge.com>
Received: From RICEVM1.RICE.EDU by CRVAX.SRI.COM with TCP; Wed,  1 NOV 89 22:41:22 PDT
Received: from TAMSTAR.BITNET by ricevm1.rice.edu (IBM VM SMTP R1.2.1) with BSMTP id 8640; Thu, 02 Nov 89 00:43:16 CST
Date:     Thu, 2 Nov 89 00:41 CST
From: <MSH5795%TAMSTAR.BITNET@ricevm1.rice.edu>
Subject:  Using F$GETQUI Lexical Function (An example!)
To: info-vax@sri.com
X-Original-To:  info-vax@sri.com, MSH5795

Dear Info-VAX,

    You people have helped me out before and now I am trying to return
the favor(s).  I have seen some questions posted before regarding the
F$GETQUI Lexical function from DCL.  There is a severe lack of examples
in the help library.  Hacking through the subtleties of the F$GETQUI
entry in the help library, I managed to come up with the following DCL
program to list all the BATCH jobs that you have submited.  It is
similar to the SHOW QUEUE/BATCH command, but does not display queues
which you do not have jobs in.

    The fourth item code in the QNAME = F$GETQUI(...) line can be
changed from "BATCH" to any of the following.  Multiple items should be
separated by commas.
            BATCH
            GENERIC
            PRINTER
            SERVER
            SYMBIONT (Same as "PRINTER,SERVER,TERMINAL")
            TERMINAL

    Of course, you have to be running VMS V5.x to run this script.
Some of the checking at the bottom of the program to determine the
status of a job is "hack and slash", but you can kind of get an idea
of how to use the F$GETQUI Lexical funcion.

Seann Herdejurgen
MSH5795@TAMSTAR.BITnet
msh5795@star.tamu.edu
seann@csseq.tamu.edu
------------------------------- Cut here -------------------------------
$ TEMP = F$GETQUI("CANCEL_OPERATION")
$ FLAG = 0
$LOOP1:
$ QNAME = F$GETQUI("DISPLAY_QUEUE","QUEUE_NAME","*","BATCH")
$ IF QNAME .EQS. "" THEN EXIT
$ QNODE = F$GETQUI("DISPLAY_QUEUE","SCSNODE_NAME","*","FREEZE_CONTEXT")
$ IF FLAG .EQ. 1 THEN WRITE SYS$OUTPUT ""
$ FLAG = 0
$LOOP2:
$ JNAME = F$GETQUI("DISPLAY_JOB", "JOB_NAME", ,"WILDCARD")
$ IF JNAME .EQS. "" THEN GOTO LOOP1
$ IF FLAG .EQ. 1 THEN GOTO SKIP
$ WRITE SYS$OUTPUT "Batch queue ", QNAME, ", on ", QNODE, "::"
$ WRITE SYS$OUTPUT ""
$ WRITE SYS$OUTPUT "  Jobname         Username     Entry          Status"
$ WRITE SYS$OUTPUT "  -------         --------     -----          ------"
$SKIP: FLAG=1
$ ENTRY = F$GETQUI("DISPLAY_JOB","ENTRY_NUMBER", ,"FREEZE_CONTEXT")
$ USER = F$GETQUI("DISPLAY_JOB","USERNAME", ,"FREEZE_CONTEXT")
$ STAT = F$GETQUI("DISPLAY_JOB","JOB_STATUS", ,"FREEZE_CONTEXT")
$ IF STAT.EQ.2 THEN STATUS="Executing"
$ IF STAT.EQ.512 THEN STATUS="Holding until "+ -
  F$EXTRACT(0,17,F$GETQUI("DISPLAY_JOB","AFTER_TIME", ,"FREEZE_CONTEXT"))
$ WRITE SYS$OUTPUT F$FAO("  !15AS !12AS !5UL          !AS",JNAME,USER,ENTRY, -
  STATUS)
$ GOTO LOOP2

