- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - OpenVMS
- >
- Re: Translating File Alias
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Discussions
Discussions
Forums
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО11-18-2007 08:28 PM
тАО11-18-2007 08:28 PM
My intention is to use DUMP/HEAD to get the File ID, and then DUMP/HEAD/FILE to get the original file name and directory.
My question is, does anyone know of a single step DCL command, i.e. 'SHOW FILE/ALIAS'?
Rob.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО11-18-2007 09:09 PM
тАО11-18-2007 09:09 PM
Re: Translating File Alias
. a=F$Parse(F$search("b.txt"),,,"DEVICE")
. sh sym a
A = "CNC_SCRATCH:"
. b= F$file("b.txt","fid")
. ws F$fid_to_name(a,b)
DISK$CNC_DATEN:[CNC_SCRATCH.ROHW.ROHWEDDER]A.TXT;1
regards kalle
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО11-18-2007 09:20 PM
тАО11-18-2007 09:20 PM
Re: Translating File Alias
Unfortunately, F$FID_TO_NAME() wasn't released until 8.2, so no good for my 7.3-2 system.
Having said that, your response is very helpful, as it shows there probably isn't a direct method if HP had to realease this new lexical to fill the gap.
Rob.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО11-18-2007 11:07 PM
тАО11-18-2007 11:07 PM
Re: Translating File Alias
It is a bit brute force, but you can do this (iteratively) using the existing F$FILE_ATTRIBUTES lexical to match to the known File ID.
- Use F$FILE_ATTRIBUTES to get the FID of the file using the Alias entry
- Then use F$SEARCH (with wildcards) to search through candidate files until you find one with a matching File ID (using F$FILE_ATTRIBUTES at each step)
I understand that the above is tedious, but it does work on 7.3-2 (and probably on all previous versions).
- Bob Gezelter, http://www.rlgsc.com
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО11-19-2007 12:01 AM
тАО11-19-2007 12:01 AM
Re: Translating File Alias
Use the alias, or don't, but don't use it and then surprise folks with the real McCoy.
But be that as it may, I did recently create a FID_TO_NAME alternative in C, simply using LIB$FID_TO_NAME. You get the required ID argument from F$FILE(x,"FID") of course.
Include below, and attached.
[btw... This topic kinda shows the importance of kindly providing the OS version and perhaps the platfom when submitting a query!]
Enjoy!
Hein van den Heuvel
/*
** fid_to_name.c Hein van den Heuvel, 2007
**
** Usage: Define as external DCL command and pass filespec as param.
** Result: DCL Symbol defined with filename as value
** $fid_to_name device index-lo sequence index-hi symbol
*/
#include
#include
#include
void set_symbol(char *symbol, char *value)
{
void lib$set_symbol();
struct {int len; char *addr;} symbol_desc, value_desc;
symbol_desc.addr = symbol;
symbol_desc.len = strlen(symbol);
value_desc.addr = value;
value_desc.len = strlen (value);
lib$set_symbol ( &symbol_desc, &value_desc);
}
main (int argc, char *argv[])
{
char device_name[128],file_name[256];
int i, s, lib$fid_to_name();
short fid[4];
struct {int len; char *addr;} device_name_desc, file_name_desc;
if (6 != argc) {
printf ("Usage: $fid_to_name device index-lo sequence index-hi symbol\n");
printf (" index-lo : fid-word-0, 16 lsb bits for file-id\n");
printf (" index-hi : fid-word-2, 8 msb bits for file-id plus rvn byte\n");
printf (" Symbol : DCL symbol to be defined with resulting filespec\n");
exit (16);
}
device_name_desc.addr = argv[1];
device_name_desc.len = strlen(argv[1]);
file_name_desc.addr = file_name;
file_name_desc.len = sizeof file_name - 1;
fid[0] = atoi ( argv[2] );
fid[1] = atoi ( argv[3] );
fid[2] = atoi ( argv[4] );
s = lib$fid_to_name ( &device_name_desc, &fid, &file_name_desc, &fid[3] );
file_name[ fid[3] ] = 0;
set_symbol ( argv[5], file_name );
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО11-19-2007 12:37 AM
тАО11-19-2007 12:37 AM
Re: Translating File Alias
THEN you can use DUMP/ID to make it get the 'original' name:
$ x="a.tmp"
$ id = f$elem(0,",",f$file(x,"FID")) - "("
$ dump/head/bloc=count=0/id='id' sys$disk/out=tmp.tmp
$ sea tmp.tmp "Dump of file"
Dump of file _DRA3:[HEIN]X.TMP;1 on 19-NOV-2007 07:17:11.68
And yet an other, cheaky, alternative is it exploit SUBMIT.
Submit goes by file ID, and SHOW ENTR will reconstruct the name:
$ subm/hold a.tmp
Job X (queue SYS$BATCH, entry 979) holding
$ show entry /full a.tmp
%JBC-E-NOSUCHENT, no such entry
$ show entry /full 979
Entry Jobname Username Blocks Status
----- ------- -------- ------ ------
979 X HEIN Holding
On idle batch queue SYS$BATCH
Submitted 19-NOV-2007 07:19:09.19 /KEEP /NOPRINT /PRIORITY=100
File: _DRA3:HEIN]X.TMP;1
Folks smarter than me could use F$GETQUI ("DISPLAY_FILE","FILE_SPECIFICATION"..)
To get the name from there.
Cheers,
Hein.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО11-19-2007 05:48 AM
тАО11-19-2007 05:48 AM
Re: Translating File Alias
I'm not sure I understand why you would use two DUMP /HEADER commands. You shouldn't need to get the file ID. The command:
$ DUMP /HEAD/BLOCK=COUNT=0 aliasname
will show you the original file name in the file header's Identification area.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО11-19-2007 04:16 PM
тАО11-19-2007 04:16 PM
Re: Translating File Alias
I did not read the question careful enough, being thown of with the DUMP/HEAD/FILE where supposedly /IDENTIFIER was intended.
Indeed, 1 dump is enough to get a FID_TO_NAME, once you have a FID from $DIRECTORY/FILE or F$FILE(file,"FID").
The queue manager hack could look like:
$ subm/hold A.TMP
Job X (queue SYS$BATCH, entry 569) holding
$ clear = F$GETQUI("CANCEL_OPERATION",,,)
$ job = F$GETQUI("DISPLAY_ENTRY","JOB_NAME",$entry,"WILDCARD")
$ file = f$getqui("DISPLAY_FILE","FILE_SPECIFICATION",,)
$ dele/entry='$entry
$ show symb file
FILE = "DRA3:[HEIN]X.TMP;1"
$
Hein.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО11-19-2007 06:43 PM
тАО11-19-2007 06:43 PM
Re: Translating File Alias
returns the filename, not the alias.
Fwiw
Wim
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО11-19-2007 07:47 PM
тАО11-19-2007 07:47 PM
Re: Translating File Alias
>>>
$ file = f$getqui("DISPLAY_FILE","FILE_SPECIFICATION",,)
<<<
AFAIK, the trouble with F$getqui is that this specific attribute request does NOT work!
At least on any V7 system, up to 7,3-2.
It was reported to Engeneering, but obviously did not get enough priority.
I am a bit wondering about your last 2 commas though. They should not be relevant however.
(Can anyone test it? I am somewhere in the middle of nowhere in southern France this week, with NO VMS access).
If this CAN be made to work, we DO have some functionalities that DO need the file specs from print & batch jobs, and we would like to clean out the ugly output parsing constructs.
fwiw
Proost.
Have one on me,
jpe
fwiw