[comp.os.vms] How do I get the COMPLETE batch log file specification ?

RECERIK@DKARH02.BITNET ("Erik Bertelsen, UNI-C Aarhus") (12/03/87)

After reading the latest discussion about batch job logfile directory
specifications, I have this further question:

How does a batch job determine the full file specification of its own log
file (including version number) ?

Show queue/full gives most of this information, but not the version number
of the log file.

I my case I have the same job running periodically, and I would like to
let the job itself decide whether to remove or print/keep its own log
file even if there are several versions of the file present.

So the question is:
How does a batch job determine the complete file specification of its
log file ?

Erik Bertelsen
UNI-C, The Danish Computing Centre for Research and Education
RECERIK@DKARH02     (bitnet/earn)

carl@CITHEX.CALTECH.EDU (Carl J Lydick) (12/03/87)

 > After reading the latest discussion about batch job logfile directory
 > specifications, I have this further question:
 > 
 > How does a batch job determine the full file specification of its own log
 > file (including version number) ?
 > 
 > Show queue/full gives most of this information, but not the version number
 > of the log file.
 > 
 > I my case I have the same job running periodically, and I would like to
 > let the job itself decide whether to remove or print/keep its own log
 > file even if there are several versions of the file present.
 > 
 > So the question is:
 > How does a batch job determine the complete file specification of its
 > log file ?

Given that you've got the file name, type, and directory, you can use the
SHOW DEVICE command to get the version number, assuming that your batch
job hasn't opened a second file with the same name and type in the same
directory.  Assume you've got the directory, name, and type in the DCL symbol
FUBAR.  Then the following places the filespec (including version number,
but not device) in the DCL symbol FILENAME:
	$	PID = F$GETJPI("","PID")
	$	FILE = "SYS$SCRATCH:" + PID + ".TMP"
	$	SHOW DEVICE/FILES/OUTPUT='FILE' SYS$OUTPUT:
	$	SEARCH/OUTPUT='FILE' 'FILE';-1/MATCH=AND " ''PID' ",'FUBAR'
	$	OPEN/READ FILE 'FILE'
	$	READ FILE REC
	$	CLOSE FILE
	$	DELETE 'FILE';,;
	$	FILENAME = F$ELEMENT(2," ",F$EDIT(REC,"TRIM,COMPRESS"))

u3369429@murdu.UUCP (12/04/87)

In article <871203030918.087@CitHex.Caltech.Edu> carl@CITHEX.CALTECH.EDU (Carl J Lydick) writes:
> > How does a batch job determine the full file specification of its own log
> > file (including version number) ?

Can we assume that the job was submitted without `/NAME=' qualifier?
If yes, the following two lines will return the log-file name:
$ x=F$Parse(F$Element(0,".",F$Environment("Procedure")),".LOG")
$ x=x+F$Element(1,";",F$Search(x))
assuming that the batch job is running in the same directory
where the log-file is.

> > Show queue/full gives most of this information, but not the version number
> > of the log file.
> > 
> > I my case I have the same job running periodically, and I would like to
> > let the job itself decide whether to remove or print/keep its own log
> > file even if there are several versions of the file present.

I don't think a batch job can delete its own log file.

Michael Bednarek		
Institute of Applied Economic and Social Research (IAESR)
Melbourne University, Parkville 3052, AUSTRALIA, Phone : +61 3 344 5744
Domain: u3369429@{murdu.oz.au | ucsvc.dn.mu.oz.au}  or  mb@munnari.oz.au
"bang": ...UUNET.UU.NET!munnari!{murdu.oz | ucsvc.dn.mu.oz}!u3369429

"POST NO BILLS."