Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP
Path: utzoo!mnetor!uunet!husc6!hao!ames!ucbcad!ucbvax!CITHEX.CALTECH.EDU!carl
From: carl@CITHEX.CALTECH.EDU (Carl J Lydick)
Newsgroups: comp.os.vms
Subject: Re: How do I get the COMPLETE batch log file specification ?
Message-ID: <871203030918.087@CitHex.Caltech.Edu>
Date: Thu, 3-Dec-87 06:09:38 EST
Article-I.D.: CitHex.871203030918.087
Posted: Thu Dec  3 06:09:38 1987
Date-Received: Mon, 7-Dec-87 01:03:19 EST
Sender: usenet@ucbvax.BERKELEY.EDU
Organization: The ARPA Internet
Lines: 33


 > 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"))