home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!olivea!charnel!rat!ucselx!crash!cmkrnl!jeh
- From: jeh@cmkrnl.com
- Newsgroups: comp.os.vms
- Subject: Re: Detecting directory of invoked .com
- Message-ID: <1992Dec23.203029.1002@cmkrnl.com>
- Date: 24 Dec 92 04:30:28 GMT
- References: <1992Dec23.160636.27010@tigger.jvnc.net>
- Organization: Kernel Mode Consulting, San Diego, CA
- Lines: 42
-
- In article <1992Dec23.160636.27010@tigger.jvnc.net>,
- fogelinc@nmr1.Cyanamid.COM (Carl Fogelin) writes:
- > At the risk of being flamed by the "active" participants of this Sig, I have
- > a problem which I hope has a reasonable answer.
-
- Oxidizer and napalm tanks full check!
- Pressure tank charged check!
- Igniter charged check!
- Safety off che
-
- ... oops, sorry, got carried away there.
-
- >
- > In a DCL program, I would like to be able to determine what directory the
- > invoked .com file is located in. I seem to remember a similar thread about
- > 6 - 8 months ago, so I hope someone remembers the solution.
-
- General rule of DCL command procedures: If you want information about
- something -- almost anything -- look at lexical functions. HELP LEXICALS
- gives you a complete list. Unfortunately this is one of those cases where
- you have to know the name by which VMS refers to something before you can
- go looking for it.
-
- f$environment("PROCEDURE")
-
- will return the complete file specification of the command procedure from
- which it is invoked. To get just the device and directory name, you can
- parse this out yourself with just a few quick strokes of f$element, but
- f$parse will do it for you:
-
- $ comfile = f$environment("PROCEDURE")
- $ comfile_dev = f$parse(comfile,,,"DEVICE")
- $ comfile_dir = f$parse(comfile,,,"DIRECTORY")
-
- For more information, see HELP LEXICALS F$ENVIRONMENT or ... F$PARSE.
-
- --- Jamie Hanrahan, Kernel Mode Consulting, San Diego CA
- drivers, internals, networks, applications, and training for VMS and Windows-NT
- uucp 'g' protocol guru and release coordinator, VMSnet (DECUS uucp) W.G., and
- Chair, Programming and Internals Working Group, U.S. DECUS VMS Systems SIG
- Internet: jeh@cmkrnl.com, hanrahan@eisner.decus.org, or jeh@crash.cts.com
- Uucp: ...{crash,eisner,uunet}!cmkrnl!jeh
-