Operating System - OpenVMS
cancel
Showing results for 
Search instead for 
Did you mean: 

F$GETQUI problem

SOLVED
Go to solution

F$GETQUI problem

Hi - I'm trying to write a script thus:

@jobname batch$queue jobname

giving a result of the entry number and the batch queue it's in.
F$GETQUI is making me tear my hair out, can anyone please assist?
14 REPLIES
Hakan Zanderau ( Anders
Trusted Contributor

Re: F$GETQUI problem

F$GETQUI is not an easy one.....

Have you looked at the examples in

http://h71000.www7.hp.com/doc/83final/9996/9996pro_101.html#green_20

Hakan
Don't make it worse by guessing.........

Re: F$GETQUI problem

Thanks Hakan,
Yes I've perused that but still unable to get satisfactory results.

Dave
Hakan Zanderau ( Anders
Trusted Contributor

Re: F$GETQUI problem

I have just modified example #3 and got if to work.

$ TEMP = F$GETQUI("")
$ QLOOP:
$ QNAME = F$GETQUI("DISPLAY_QUEUE","QUEUE_NAME","*")
$ IF QNAME .EQS. "" THEN EXIT
$ JLOOP:
$ NOACCESS = F$GETQUI("DISPLAY_JOB","JOB_INACCESSIBLE",,"ALL_JOBS")
$ IF NOACCESS .EQS. "TRUE" THEN GOTO JLOOP
$ IF NOACCESS .EQS. "" THEN GOTO QLOOP
$ JNAME := 'F$GETQUI("DISPLAY_JOB","JOB_NAME",,"FREEZE_CONTEXT")
$ ENUM = F$GETQUI("DISPLAY_JOB","ENTRY_NUMBER",,"FREEZE_CONTEXT")
$ if JNAME .eqs. "''p1'"
$ then
$ WRITE SYS$OUTPUT " JOB: ", JNAME," QUEUE: ",QNAME," ENTRY: ",ENUM
$ endif
$ GOTO JLOOP

Hakan
Don't make it worse by guessing.........
Hakan Zanderau ( Anders
Trusted Contributor
Solution

Re: F$GETQUI problem

Some lines "wrapped" when I "cut & paste".

Use it as:

@COMMANDFILE 'jobname'

Then you have to edit the code to suit your needs.

Hakan
Don't make it worse by guessing.........

Re: F$GETQUI problem

Thanks again Hakan, but it's producing no results here.
I can see a batch queue with a job in it, but I can't run the job with the batch queue name and the jobname as params to give me the entry number of the jobname.

Re: F$GETQUI problem

Hakan, you're a genius, it worked a treat many thanks,

Dave
Hakan Zanderau ( Anders
Trusted Contributor

Re: F$GETQUI problem

Genius is a strong word, but Thanks !
I have some friends in the VMS-world that make me feel like a rockie.

If you need help to modify the script, mail me.

Hakan
hakan(dot)zanderau(at)ha-solutions(dot)se
Don't make it worse by guessing.........
Ian Miller.
Honored Contributor

Re: F$GETQUI problem

See also http://dcl.openvms.org
where you will find several examples of using F$GETQUI
____________________
Purely Personal Opinion
Hakan Zanderau ( Anders
Trusted Contributor

Re: F$GETQUI problem

My fingers typed without confirming with my brain.....

The word is ROOKIE, not rockie ! ;-)

Hakan
Don't make it worse by guessing.........
John Gillings
Honored Contributor

Re: F$GETQUI problem

Dave,

You can look up jobs by job name with F$GETQUI, rather than walking through a queue. This will also support wildcards in the job name.

$ jname=p1
$ Loop:
$ e=F$GETQUI("DISPLAY_ENTRY","ENTRY_NUMBER",jname,"WILDCARD")
$ IF e.NES.""
$ THEN
$ q=F$GETQUI("DISPLAY_ENTRY","QUEUE_NAME",e,"FREEZE_CONTEXT")
$ j=F$GETQUI("DISPLAY_ENTRY","JOB_NAME",e,"FREEZE_CONTEXT")
$ WRITE SYS$OUTPUT "Entry ''e' ''j' ''q'"
$ found="TRUE"
$ GOTO Loop
$ ENDIF
$ IF .NOT."''found'" THEN WRITE SYS$OUTPUT "No such entry ''jname'"


To gather more information about the entries, add more "DISPLAY_ENTRY" calls with "FREEZE_CONTEXT". There are some DCL commands, like SHOW ENTRY which can interfere with your context. If you need to execute one, use SPAWN to run it in a subprocess.
A crucible of informative mistakes
Jon Pinkley
Honored Contributor

Re: F$GETQUI problem

Dave,

John Gillings' suggestion to use DISPLAY_ENTRY is more efficient than DISPLAY_JOB, and if you are only interested in jobs running under the current username, it is probably the best way to go.

However, it is limited to listing entries for the current username regardless of your privilege.

It is a similar to the SHOW ENTRY DCL command, where the others are more like a SHOW QUEUE command with the output being filtered. And unlike SHOW ENTRY, there is no way to specify the /USER you are interested in. (If there is a way, it doesn't appear to be documented.)

If you want something that will see batch jobs for all users, and you have access to the queues via privilege or ACL, then the DISPLAY_JOB method is more general, but with the added cost of having to sift through possibly many jobs that you are not interested in.

Jon
it depends
Hakan Zanderau ( Anders
Trusted Contributor

Re: F$GETQUI problem

I need to make comment.

Dave answered that he had looked at the F$GETQUI examples, but couldn't make things work.

I took example #3 and made small modifications to hint Dave how he could use it as a template (for his own needs.......)

I could have written it more efficient, but that wasn't my goal.

There are a million ways to skin a cat....efficient or not.

Hakan
Don't make it worse by guessing.........
Jon Pinkley
Honored Contributor

Re: F$GETQUI problem

Here is what I use. It uses the DISPLAY_JOB method. The parameters are not in the order you specified, but you can at least use this as a starting point.

I got the original version of this from a note left by Jim Becker on DECUServe (Note VMS 3121.1)

I have made some local nodifications, the primary one being that it will now return a comma seperated list of entry numbers instead of just the first one it finds that matches. Also change the "help" displayed if no parameters were passed. You will need to edit the location where you keep your copy of find_batch_job.com.

I have included both versions in the attached find_batch_job.zip file. This was created on VMS without the "-V" zip

$ unzip -v find_batch_job
Get RMS defaults. getjpi sts = %x00000001.
Default: deq = 0, mbc = 0, mbf = 0.
Open callback. ID = 1, deq = 16384, mbc = 127, mbf = 2.
Archive: ROOT$USERS:[JON.SCRATCH]FIND_BATCH_JOB.ZIP;1
Length Method Size Ratio Date Time CRC-32 Name
-------- ------ ------- ----- ---- ---- ------ ----
2883 Defl:N 1201 58% 11-01-00 23:45 3d68d93b find_batch_job.com
1678 Defl:N 745 56% 07-08-09 15:21 14b5e717 find_batch_job.com_original
-------- ------- --- -------
4561 1946 57% 2 files
$

The original version was copied and renamed to find_batch_job.com_original

If you want the files to have standard text type and using the vms unzip program, use the following to unpack:

$ unzip -a find_batch_job

This hasn't been modified since 2000; if you are running 8.3, the job name matching could be modified to use f$match_wild to be a bit more general. As is, it matches substrings so using a string like "T4" will match any job name containing T4. If you don't like that behavior, change it.

Some useful commands to use the find_entry symbol created by find_batch_job:

$ @find_batch_job substring queue_wildcard

$ show queue 'find_entry' ! this displays the entries that matched

$ delete entry=('find_entry') ! this lets you delete multiple entries that match your criteria (I recomend using show entry 'find_entry' first)

Example usage:

$ @mgr:find_batch_job
Usage : @MGR:FIND_BATCH_JOB JOB_NAME [QUEUE]
P1 must give the string to find in the job name (case-insensitive).
P2 optional Queue(s) to search (any queue spec that's valid with f$getqui)
This will set the global SYMBOL FIND_ENTRY with list of entry numbers
$
$ @mgr:find_batch_job t4 ! when there are matching entries, the resulting find_entry symbol is displayed
FIND_ENTRY == "1004705,83,1004706,74"
$
$ sho sym $status
$STATUS == "%X00030001"
$
$ sho entry 'find_entry'
Entry Jobname Username Blocks Status
----- ------- -------- ------ ------
1004705 T4$COLLECT SYSTEM Executing
On available batch queue T4_BATCH$OMEGA

83 T4$COLLECT SYSTEM Holding until 8-JUL-2009 23:58:00.00
On available batch queue T4_BATCH$OMEGA

1004706 T4$COLLECT SYSTEM Executing
On available batch queue T4_BATCH$SIGMA

74 T4$COLLECT SYSTEM Holding until 8-JUL-2009 23:58:00.00
On available batch queue T4_BATCH$SIGMA
$
$ @mgr:find_batch_job asjfkl ! this won't find anything, just to show what happens
$
$ sho sym $status
$STATUS == "%X00000003"
$
$ sho sym find_entry
FIND_ENTRY == ""
$
it depends
Jon Pinkley
Honored Contributor

Re: F$GETQUI problem

The correct syntax to delete queue entries is:

$ delete/entry=('find_entry')

not $ delete entry=('find_entry')

that my previous comment had.

Jon
it depends