<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Checking if filename contains a directory specification in Operating System - OpenVMS</title>
    <link>https://community.hpe.com/t5/operating-system-openvms/checking-if-filename-contains-a-directory-specification/m-p/3976381#M35871</link>
    <description>The script you suggests fails if it is provided a filespace with version number, or just a ";".&lt;BR /&gt; &lt;BR /&gt;Can we safely ignore ODS-5 extended file naming?&lt;BR /&gt;&lt;BR /&gt;If not then you really should go the F$PARSE route. Else, You could just do&lt;BR /&gt;&lt;BR /&gt;$test = f - "]" - "&amp;gt;" - ":"&lt;BR /&gt;$if test.nes.t then ws "Device or Directory present".&lt;BR /&gt;&lt;BR /&gt;But I would like to echo Steven's closing suggestion: Just let F$PARSE do all the work. Let it combine the filespec with the missing pieces provided as 'default name'.&lt;BR /&gt;That's what it is there for.&lt;BR /&gt;&lt;BR /&gt;Now if you wanted to do this in a program, not DCL, and wanted to roll your own, then you should look at the $FILESCAN system service.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Hein.&lt;BR /&gt;&lt;BR /&gt;</description>
    <pubDate>Thu, 05 Apr 2007 22:33:00 GMT</pubDate>
    <dc:creator>Hein van den Heuvel</dc:creator>
    <dc:date>2007-04-05T22:33:00Z</dc:date>
    <item>
      <title>Checking if filename contains a directory specification</title>
      <link>https://community.hpe.com/t5/operating-system-openvms/checking-if-filename-contains-a-directory-specification/m-p/3976379#M35869</link>
      <description>&lt;!--!*#--&gt;I am wondering if there is a simpler way to determine if a filename contains a device and/or directory specificaton from DCL. Currently I use something similiar to what you see in the attachment but it doesn't work for all cases. For instance if I want to check if the filename has a device name specified.&lt;BR /&gt;&lt;BR /&gt;I would like to use it to determine if an input parameter include a device or directory if not then it will look in a default directory defined by some logical name.&lt;BR /&gt;&lt;BR /&gt;Thanks&lt;BR /&gt;J Bath</description>
      <pubDate>Thu, 05 Apr 2007 18:13:29 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-openvms/checking-if-filename-contains-a-directory-specification/m-p/3976379#M35869</guid>
      <dc:creator>Jeff Bath</dc:creator>
      <dc:date>2007-04-05T18:13:29Z</dc:date>
    </item>
    <item>
      <title>Re: Checking if filename contains a directory specification</title>
      <link>https://community.hpe.com/t5/operating-system-openvms/checking-if-filename-contains-a-directory-specification/m-p/3976380#M35870</link>
      <description>&lt;!--!*#--&gt;If I neded to do it, I might use SYNTAX_ONLY&lt;BR /&gt;with an unlikely default file specification:&lt;BR /&gt;&lt;BR /&gt;$ ws = "WRITE SYS$OUTPUT"&lt;BR /&gt;$ f = f$edit(p1,"COLLAPSE,UPCASE")&lt;BR /&gt;$ nsdev = "NO_SUCH_DEV:"&lt;BR /&gt;$ nsdir = "[no_such_dir]"&lt;BR /&gt;$ nsdevdir = nsdev+ nsdir&lt;BR /&gt;$ dev = f$parse( f, nsdevdir, , "DEVICE", "SYNTAX_ONLY")&lt;BR /&gt;$ dir = f$parse( f, nsdevdir, , "DIRECTORY", "SYNTAX_ONLY")&lt;BR /&gt;$ if (dev .eqs. nsdev)&lt;BR /&gt;$ then&lt;BR /&gt;$    dev = "(none)"&lt;BR /&gt;$ endif&lt;BR /&gt;$ ws "Device = ''dev'"&lt;BR /&gt;$ if (dir .eqs. nsdir)&lt;BR /&gt;$ then&lt;BR /&gt;$    dir = "(none)"&lt;BR /&gt;$ endif&lt;BR /&gt;$ ws "Directory = ''dir'"&lt;BR /&gt;$!&lt;BR /&gt;&lt;BR /&gt;But it may be that you could simply use&lt;BR /&gt;F$PARSE with your logical name as the default&lt;BR /&gt;file spec.</description>
      <pubDate>Thu, 05 Apr 2007 19:07:24 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-openvms/checking-if-filename-contains-a-directory-specification/m-p/3976380#M35870</guid>
      <dc:creator>Steven Schweda</dc:creator>
      <dc:date>2007-04-05T19:07:24Z</dc:date>
    </item>
    <item>
      <title>Re: Checking if filename contains a directory specification</title>
      <link>https://community.hpe.com/t5/operating-system-openvms/checking-if-filename-contains-a-directory-specification/m-p/3976381#M35871</link>
      <description>The script you suggests fails if it is provided a filespace with version number, or just a ";".&lt;BR /&gt; &lt;BR /&gt;Can we safely ignore ODS-5 extended file naming?&lt;BR /&gt;&lt;BR /&gt;If not then you really should go the F$PARSE route. Else, You could just do&lt;BR /&gt;&lt;BR /&gt;$test = f - "]" - "&amp;gt;" - ":"&lt;BR /&gt;$if test.nes.t then ws "Device or Directory present".&lt;BR /&gt;&lt;BR /&gt;But I would like to echo Steven's closing suggestion: Just let F$PARSE do all the work. Let it combine the filespec with the missing pieces provided as 'default name'.&lt;BR /&gt;That's what it is there for.&lt;BR /&gt;&lt;BR /&gt;Now if you wanted to do this in a program, not DCL, and wanted to roll your own, then you should look at the $FILESCAN system service.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Hein.&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Thu, 05 Apr 2007 22:33:00 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-openvms/checking-if-filename-contains-a-directory-specification/m-p/3976381#M35871</guid>
      <dc:creator>Hein van den Heuvel</dc:creator>
      <dc:date>2007-04-05T22:33:00Z</dc:date>
    </item>
    <item>
      <title>Re: Checking if filename contains a directory specification</title>
      <link>https://community.hpe.com/t5/operating-system-openvms/checking-if-filename-contains-a-directory-specification/m-p/3976382#M35872</link>
      <description>Jeff,&lt;BR /&gt;&lt;BR /&gt;Please use the F$PARSE lexical function. It is guaranteed to work (you can limit the processing as noted by using the SYNTAX_ONLY parameter).&lt;BR /&gt;&lt;BR /&gt;You can also use multi-level defaulting when using F$PARSE. This allows you to specify default elements (e.g. logical names, directories) for things in a manner consistent with all of the other system utilities.&lt;BR /&gt;&lt;BR /&gt;It is NEVER recommended to parse things yourself. On occasion, changes appear that can break manual filename parsing (e.g. ODS-5). The lexical function is guaranteed to work correctly. Manual code is guaranteed to have to be maintained over the years.&lt;BR /&gt;&lt;BR /&gt;A good general rule is that it is worth the time and effort to use a provided facility (e.g. F$PARSE) than to write one's own code.&lt;BR /&gt;&lt;BR /&gt;- Bob Gezelter, &lt;A href="http://www.rlgsc.com" target="_blank"&gt;http://www.rlgsc.com&lt;/A&gt;</description>
      <pubDate>Fri, 06 Apr 2007 05:09:32 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-openvms/checking-if-filename-contains-a-directory-specification/m-p/3976382#M35872</guid>
      <dc:creator>Robert Gezelter</dc:creator>
      <dc:date>2007-04-06T05:09:32Z</dc:date>
    </item>
    <item>
      <title>Re: Checking if filename contains a directory specification</title>
      <link>https://community.hpe.com/t5/operating-system-openvms/checking-if-filename-contains-a-directory-specification/m-p/3976383#M35873</link>
      <description>Hey Jeff.  The following simple code will tell you if the device or directory are specified and are valid.  That's all it's checking for.&lt;BR /&gt;&lt;BR /&gt;$ IF F$PARSE(P1,"BOGUS:[BOGUS]",,,) .EQS. "" THEN WRITE SYS$OUTPUT "INVALID"&lt;BR /&gt;&lt;BR /&gt;Change BOGUS to something else if BOGUS is a valid device/dir at your place.&lt;BR /&gt;</description>
      <pubDate>Fri, 06 Apr 2007 07:56:03 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-openvms/checking-if-filename-contains-a-directory-specification/m-p/3976383#M35873</guid>
      <dc:creator>EdgarZamora_1</dc:creator>
      <dc:date>2007-04-06T07:56:03Z</dc:date>
    </item>
    <item>
      <title>Re: Checking if filename contains a directory specification</title>
      <link>https://community.hpe.com/t5/operating-system-openvms/checking-if-filename-contains-a-directory-specification/m-p/3976384#M35874</link>
      <description>Edgar, &lt;BR /&gt;&lt;BR /&gt;That will not work if filespec does provide a device or directory, but one which is not valid (yet).&lt;BR /&gt;It will also return a blank string.&lt;BR /&gt;&lt;BR /&gt;The question was:&lt;BR /&gt;"  Checking if filename contains a directory specification"&lt;BR /&gt;&lt;BR /&gt;It did not indicate whether that directory needed to be valid, allthough admittedly that typically is expected.&lt;BR /&gt;- the final file spec may need to be use in a different context, maybe a different system.&lt;BR /&gt;- the file, directory or logical name for the device might not yet exist&lt;BR /&gt;Agreed, unlikely.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;I normally solve it like Steven already suggested.&lt;BR /&gt;Provide a recognizable bogus directory / device as default name and see if they come back after a SYNTAX_ONLY' parse.&lt;BR /&gt;&lt;BR /&gt;Hein.&lt;BR /&gt;</description>
      <pubDate>Fri, 06 Apr 2007 08:17:37 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-openvms/checking-if-filename-contains-a-directory-specification/m-p/3976384#M35874</guid>
      <dc:creator>Hein van den Heuvel</dc:creator>
      <dc:date>2007-04-06T08:17:37Z</dc:date>
    </item>
    <item>
      <title>Re: Checking if filename contains a directory specification</title>
      <link>https://community.hpe.com/t5/operating-system-openvms/checking-if-filename-contains-a-directory-specification/m-p/3976385#M35875</link>
      <description>Hein,  I agree with what you said.  That's why I said it would work only for valid (and by valid I meant "existing") device and directory.</description>
      <pubDate>Fri, 06 Apr 2007 08:34:47 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-openvms/checking-if-filename-contains-a-directory-specification/m-p/3976385#M35875</guid>
      <dc:creator>EdgarZamora_1</dc:creator>
      <dc:date>2007-04-06T08:34:47Z</dc:date>
    </item>
    <item>
      <title>Re: Checking if filename contains a directory specification</title>
      <link>https://community.hpe.com/t5/operating-system-openvms/checking-if-filename-contains-a-directory-specification/m-p/3976386#M35876</link>
      <description>I posted up some brief comments on the parsing of file specs yourself about a month or so back, over in &lt;A href="http://64.223.189.234/node/71" target="_blank"&gt;http://64.223.189.234/node/71&lt;/A&gt; and I've added a few more cases where this gets "fun".&lt;BR /&gt;&lt;BR /&gt;It isn't trivial to get all the cases, and the effort becomes increasing non-trivial when the potential exists for changes in the parsing rules in future releases.</description>
      <pubDate>Fri, 06 Apr 2007 09:31:21 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-openvms/checking-if-filename-contains-a-directory-specification/m-p/3976386#M35876</guid>
      <dc:creator>Hoff</dc:creator>
      <dc:date>2007-04-06T09:31:21Z</dc:date>
    </item>
    <item>
      <title>Re: Checking if filename contains a directory specification</title>
      <link>https://community.hpe.com/t5/operating-system-openvms/checking-if-filename-contains-a-directory-specification/m-p/3976387#M35877</link>
      <description>Thanks for all of your help. I guess I never took the time to really understand all of the features of f$parse. Now I can see how simple this really should be.&lt;BR /&gt;</description>
      <pubDate>Fri, 06 Apr 2007 10:40:51 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-openvms/checking-if-filename-contains-a-directory-specification/m-p/3976387#M35877</guid>
      <dc:creator>Jeff Bath</dc:creator>
      <dc:date>2007-04-06T10:40:51Z</dc:date>
    </item>
    <item>
      <title>Re: Checking if filename contains a directory specification</title>
      <link>https://community.hpe.com/t5/operating-system-openvms/checking-if-filename-contains-a-directory-specification/m-p/3976388#M35878</link>
      <description>Jeff,&lt;BR /&gt;&lt;BR /&gt;please review&lt;BR /&gt;&lt;BR /&gt;&lt;A href="http://forums1.itrc.hp.com/service/forums/helptips.do?#33" target="_blank"&gt;http://forums1.itrc.hp.com/service/forums/helptips.do?#33&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;on how to express thanks in these forums.&lt;BR /&gt;&lt;BR /&gt;Proost.&lt;BR /&gt;&lt;BR /&gt;Have one on me.&lt;BR /&gt;&lt;BR /&gt;jpe</description>
      <pubDate>Fri, 06 Apr 2007 12:25:03 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-openvms/checking-if-filename-contains-a-directory-specification/m-p/3976388#M35878</guid>
      <dc:creator>Jan van den Ende</dc:creator>
      <dc:date>2007-04-06T12:25:03Z</dc:date>
    </item>
  </channel>
</rss>

