HP OpenVMS Systemsask the wizard |
The Question is:
This question concerns f$parse when the default directory is a search list.
f$parse seems to return an incorrect device if the search lists are defined a
certain way. Are there rules to be followed when defining search lists or
should it just be done by
example?
Example follows:
$ show default ! our default is a search list
PRD_SOURCE:[BUILD]
= LOC_SOURCE:[BUILD]
= DEV_SOURCE:[BUILD]
$ show logical/full prd_source ! logical is defined to point to two other
logicals
"PRD_SOURCE" [exec] = "loc_source:" (LNM$JOB_81015280)
= "dev_source:"
1 "LOC_SOURCE" [exec] = "DISK1:[USERS.GOODMAN.LOCAL_SOURCE.]" [concealed]
(LNM$JOB_81015280)
1 "DEV_SOURCE" [exec] = "disk1:[prd_source.]" [concealed] (LNM$JOB_81015280)
"PRD_SOURCE" [exec] = "DISK1:[PRD_SOURCE.]" [concealed] (LNM$SYSTEM_TABLE)
$ dir set_build_env.com ! This file exists only in the second directory
Directory DEV_SOURCE:[BUILD]
SET_BUILD_ENV.COM;45
Total of 1 file.
$ write sys$output f$parse("set_build_env.com",,,"device") ! but F$PARSE
says it's in the first directory
LOC_SOURCE:
$ dir x.x ! This file exists only in the first directory
Directory LOC_SOURCE:[BUILD]
X.X;1
Total of 1 file.
$ write sys$output f$parse("x.x",,,"DEVICE") ! F$PARSE reports it correctly
LOC_SOURCE:
$! change logical definitions
$ show default ! our default is still a search list
PRD_SOURCE:[BUILD]
= PRD_SOURCE:[BUILD]
= DISK1:[PRD_SOURCE.][BUILD]
$ sh log/fu prd_source ! but the logical is now defined differently
"PRD_SOURCE" [exec] = "DKA100:[USERS.GOODMAN.LOCAL_SOURCE.]"
[concealed,terminal] (LNM$JOB_81015280)
= "DISK1:[PRD_SOURCE.]"
"PRD_SOURCE" [exec] = "DISK1:[PRD_SOURCE.]" [concealed] (LNM$SYSTEM_TABLE)
$ dir set_build_env.com ! This file still exists only in the second
directory
Directory DISK1:[PRD_SOURCE.][BUILD]
SET_BUILD_ENV.COM;45
Total of 1 file.
$ write sys$output f$parse("set_build_env.com",,,"device") ! But now
F$PARSE returns something reasonable
PRD_SOURCE:
$ dir x.x
Directory PRD_SOURCE:[BUILD]
X.X;1
Total of 1 file.
$ write sys$output f$parse("x.x",,,"DEVICE") ! F$PARSE returns PRD_SOURCE
for all files
PRD_SOURCE:
The Answer is :
The OpenVMS Wizard would encourage you to define the logical names
involved exactly as the SYS$SYSROOT and related logical names are
defined. If you do not have the concealed and the terminal attributes
correctly configured, then you can (will) encounter these problems.
In this case, PRD_SOURCE is (incorrectly) not marked as concealed.
Also make sure that any logical names with the "concealed" attribute use
only physical device names in the equivalence name. The following DCL
will define a concealed, terminal logical name, performing the translation
from logical device name to physical, if necessary.
for example, the following command will define a concealed device rooted
in SYS$SPECIFIC:[SYSMGR] (first translation of SYS$MANAGER):
$ @DEFINE_CONCEALED SYSMGR SYS$MANAGER
DEFINE_CONCEALED.COM
$ IF p1.EQS."" THEN INQUIRE p1 "Logical name"
$ IF p2.EQS."" THEN INQUIRE p2 "Directory"
$ ! p3 = extra DEFINE qualifiers
$ !
$ Conc=F$TRNLNM(F$PARSE(p2,,,"DEVICE")-":")
$ IF F$LOCATE("<",Conc).LT.F$LENGTH(Conc)
$ THEN
$ lbr="<"
$ rbr=">"
$ ELSE
$ lbr="["
$ rbr="]"
$ ENDIF
$ trans=(F$PARSE(p2,,,"DEVICE","NO_CONCEAL")+-
F$PARSE(p2,lbr+"000000"+rbr,,"DIRECTORY","NO_CONCEAL"))--
(rbr+lbr)-("000000"+rbr)-("."+rbr)+"*"-".*"-"*"-rbr+("."+rbr)
$ DEFINE/TRANSLATION_ATTRIBUTES=(TERMINAL,CONCEALED)'p3' 'p1' 'trans'
$ EXIT
|