From:	SMTP%"RELAY-INFO-VAX@CRVAX.SRI.COM"  1-SEP-1993 08:11:51.87
To:	EVERHART
CC:	
Subj:	Re: Getting "bare bones" file spec?

Date: Tue, 31 Aug 1993 10:52:52 +0100
From: Arne Vajhxj <ARNE@kopc.hhs.dk>
Subject: Re: Getting "bare bones" file spec?
To: 00mjstum@LEO.BSUVC.BSU.EDU, INFO-VAX@sri.com
Message-Id: <01H2E5AQ1PAA9LVMU8@kopc.hhs.dk>
X-Vms-To: KOPC::IN%"00mjstum@LEO.BSUVC.BSU.EDU"
X-Vms-Cc: IN::"INFO-VAX@SRI.COM"
Mime-Version: 1.0
Content-Type: TEXT/PLAIN; CHARSET=ISO-8859-1
Content-Transfer-Encoding: 8BIT

> Is there a system service or, more likely, a slick algorithm for getting
> at what I call a "bare bones" file spec?  Bare bones means no logicals...
> we're talking physical device, root directory if any, directory, file name,
> and file extension... the kind of output you get when you do a GETJPI and
> ask for the current image name.
> 
> I wrote a little test program in DCL to keep translating device logicals
> until it couldn't anymore but for some reason it turned out very ugly and
> doesn't work in all situations.

I think F$PARSE / SYS$PARSE will do what you want !

Example in DCL:

$ write sys$output f$parse(p1,,,,"NO_CONCEAL")

Example in C:

#include <stdio.h>
#include <rms.h>
#include <string.h>

int sys$parse();

main(int argc,char *argv[])
{
   long stat;
   char buffer[256];
   struct FAB fabblk;
   struct NAM namblk;
   fabblk = cc$rms_fab;
   fabblk.fab$l_fna = argv[1];
   fabblk.fab$b_fns = strlen(argv[1]);
   fabblk.fab$l_nam = &namblk;
   namblk = cc$rms_nam;
   namblk.nam$l_esa = buffer;
   namblk.nam$b_ess = sizeof(buffer)-1;
   namblk.nam$b_nop = NAM$M_NOCONCEAL;
   stat = sys$parse(&fabblk,0,0);
   buffer[namblk.nam$b_esl] = '\0';
   printf("%s\n",buffer);
}

Hope it helps !

                                                          Arne

Arne Vajhxj                             local DECNET:  KO::ARNE
Computer Department                     PSI:           PSI%238310013040::ARNE
Business School of Southern Denmark     Internet:      ARNE@KO.HHS.DK


