home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #31 / NN_1992_31.iso / spool / comp / os / vms / 19985 < prev    next >
Encoding:
Internet Message Format  |  1992-12-29  |  2.4 KB

  1. Path: sparky!uunet!gatech!usenet.ins.cwru.edu!agate!ucbvax!U.WASHINGTON.EDU!DEREK
  2. From: DEREK@U.WASHINGTON.EDU
  3. Newsgroups: comp.os.vms
  4. Subject: Re: Detecting directory of invoked .com
  5. Message-ID: <A3D6046EF3BF20503E@MAX.U.WASHINGTON.EDU>
  6. Date: 28 Dec 92 19:16:00 GMT
  7. Sender: daemon@ucbvax.BERKELEY.EDU
  8. Distribution: world
  9. Organization: The Internet
  10. Lines: 49
  11.  
  12. Carl Fogelin (fogelincc@cyanamid.com) asked:
  13.  
  14. >In a DCL program, I would like to be able to determine what directory the
  15. >invoked .com file is located in.
  16.  
  17. Several people gave solutions to Carl's problem by suggesting the use of
  18. the F$ENVIRONMENT() lexical function, e.g., F$ENVIRONMENT("PROCEDURE").
  19. A couple of respondents indicated that you can use the F$PARSE() lexical
  20. function to easily extract the DIRECTORY portion of the returned file
  21. specification.
  22.  
  23. (One side note: of the eight responses I have seen to date, only Jamie
  24. Hanrahan included any humor.  Good job, Jamie!)
  25.  
  26. Although a few posters also mentioned using F$PARSE() to extract the
  27. DEVICE portion of the file-spec, no one really was specific as to WHY
  28. this information might be useful.  The point is that the DIRECTORY name
  29. may not supply sufficient information to distinguish between the two
  30. installations.  For example, if the test code is in DISK$TEST:[CARL] and
  31. production code is in DISK$PRODUCTION:[CARL], then in is clear that you
  32. ALSO need to know the DEVICE names.
  33.  
  34.  
  35. Nonetheless, the answers are still incomplete.  It may be that the device
  36. name used is something like PRODUCT$DEVICE:[CARL], where the definition
  37. of PRODUCT$DEVICE is different for the two installations.  The better
  38. solution, I would think, would be to use the NO_CONCEAL argument to the
  39. F$PARSE() lexical function.  For example, try the following five line
  40. command procedure and compare the output.
  41.  
  42. $ write sys$output f$parse(f$env("procedure"),,,"device")
  43. $ write sys$output f$parse(f$env("procedure"),,,"directory")
  44. $!
  45. $ write sys$output f$parse(f$env("Procedure"),,,"device","no_conceal")
  46. $ write sys$output f$parse(f$env("procedure"),,,"directory","no_conceal")
  47.  
  48. I am not going to claim that this is absolutely the BEST solution.  I
  49. will, however, argue that it is a more complete solution that those which
  50. have previously been offered.
  51.  
  52. -Derek S. Haining
  53.  University Computing Services
  54.  University of Washington
  55.  Seattle, Washington  98195 
  56.  (206) 543-5579
  57.  
  58.  DEREK@MAX.BITNET
  59.  DEREK@MAX.U.WASHINGTON.EDU
  60.  
  61.