<?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: List the latest file in Operating System - OpenVMS</title>
    <link>https://community.hpe.com/t5/operating-system-openvms/list-the-latest-file/m-p/5174005#M42187</link>
    <description>A quick hack in DCL piping directory output into sort is at&lt;BR /&gt; &lt;A href="http://wwwvms.mppmu.mpg.de/util_root/com/dir_by_date.com" target="_blank"&gt;http://wwwvms.mppmu.mpg.de/util_root/com/dir_by_date.com&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;but it will break the correct order and display whenever a dir-/file-specification exceeds the filename field width (80 in my example).&lt;BR /&gt;&lt;BR /&gt;A slower DCL version using f$search loop is &lt;BR /&gt; &lt;A href="http://wwwvms.mppmu.mpg.de/util_root/com/dir_by_date2.com" target="_blank"&gt;http://wwwvms.mppmu.mpg.de/util_root/com/dir_by_date2.com&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;</description>
    <pubDate>Fri, 08 May 2009 08:44:46 GMT</pubDate>
    <dc:creator>Joseph Huber_1</dc:creator>
    <dc:date>2009-05-08T08:44:46Z</dc:date>
    <item>
      <title>List the latest file</title>
      <link>https://community.hpe.com/t5/operating-system-openvms/list-the-latest-file/m-p/5173998#M42180</link>
      <description>In DCL how can I get the latest created file on a directory?</description>
      <pubDate>Fri, 08 May 2009 05:37:36 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-openvms/list-the-latest-file/m-p/5173998#M42180</guid>
      <dc:creator>Per Arvidsson</dc:creator>
      <dc:date>2009-05-08T05:37:36Z</dc:date>
    </item>
    <item>
      <title>Re: List the latest file</title>
      <link>https://community.hpe.com/t5/operating-system-openvms/list-the-latest-file/m-p/5173999#M42181</link>
      <description>You can write a DCL command file:&lt;BR /&gt;&lt;BR /&gt;lastfile=""&lt;BR /&gt;last="17-NOV-1858"&lt;BR /&gt;last=f$cvtim(last,"COMPARISON")&lt;BR /&gt;&lt;BR /&gt;Loop with file=f$search("*.*") over the directory,&lt;BR /&gt;get the creation date cdt=f$file(file,"CDT")&lt;BR /&gt;convert the date to comparison cdt=f$cvtim(cdt,"COMPARISON")&lt;BR /&gt;Compare to the last time saved&lt;BR /&gt;Set last to cdt if cdt .ges. last&lt;BR /&gt;Set lastfile to file in this case &lt;BR /&gt;Continue loop.&lt;BR /&gt;&lt;BR /&gt;Or search on the VMS freeware disks for the program DIRBYDATE: it does not give You just the latest, but a directory listing with the  latest first or last in the list.&lt;BR /&gt;</description>
      <pubDate>Fri, 08 May 2009 05:59:56 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-openvms/list-the-latest-file/m-p/5173999#M42181</guid>
      <dc:creator>Joseph Huber_1</dc:creator>
      <dc:date>2009-05-08T05:59:56Z</dc:date>
    </item>
    <item>
      <title>Re: List the latest file</title>
      <link>https://community.hpe.com/t5/operating-system-openvms/list-the-latest-file/m-p/5174000#M42182</link>
      <description>Per,&lt;BR /&gt;&lt;BR /&gt;What are you trying to do ?&lt;BR /&gt;We need more detailed information.&lt;BR /&gt;&lt;BR /&gt;Hakan&lt;BR /&gt;&lt;BR /&gt;Ps. Jobbade tidigare pÃ¥ VMS-supporten hos Digital/Compaq/HP. Ds.</description>
      <pubDate>Fri, 08 May 2009 06:08:36 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-openvms/list-the-latest-file/m-p/5174000#M42182</guid>
      <dc:creator>Hakan Zanderau ( Anders</dc:creator>
      <dc:date>2009-05-08T06:08:36Z</dc:date>
    </item>
    <item>
      <title>Re: List the latest file</title>
      <link>https://community.hpe.com/t5/operating-system-openvms/list-the-latest-file/m-p/5174001#M42183</link>
      <description>Per,&lt;BR /&gt;&lt;BR /&gt;You could use QDSB, downloadable from&lt;BR /&gt;&lt;A href="http://www.quadratrix.be/qdsb.html" target="_blank"&gt;http://www.quadratrix.be/qdsb.html&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;Example:&lt;BR /&gt;$ QDSB/SORTED=DATE_C=ORDER=DESC&lt;BR /&gt;&lt;BR /&gt;Kris (aka Qkcl)&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Fri, 08 May 2009 06:48:54 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-openvms/list-the-latest-file/m-p/5174001#M42183</guid>
      <dc:creator>Kris Clippeleyr</dc:creator>
      <dc:date>2009-05-08T06:48:54Z</dc:date>
    </item>
    <item>
      <title>Re: List the latest file</title>
      <link>https://community.hpe.com/t5/operating-system-openvms/list-the-latest-file/m-p/5174002#M42184</link>
      <description>Thank  you all,  Wow!&lt;BR /&gt;What a response&lt;BR /&gt;</description>
      <pubDate>Fri, 08 May 2009 07:35:42 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-openvms/list-the-latest-file/m-p/5174002#M42184</guid>
      <dc:creator>Per Arvidsson</dc:creator>
      <dc:date>2009-05-08T07:35:42Z</dc:date>
    </item>
    <item>
      <title>Re: List the latest file</title>
      <link>https://community.hpe.com/t5/operating-system-openvms/list-the-latest-file/m-p/5174003#M42185</link>
      <description>I tried to pipe dir and sort but didnt succeed. These answers will do</description>
      <pubDate>Fri, 08 May 2009 07:43:30 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-openvms/list-the-latest-file/m-p/5174003#M42185</guid>
      <dc:creator>Per Arvidsson</dc:creator>
      <dc:date>2009-05-08T07:43:30Z</dc:date>
    </item>
    <item>
      <title>Re: List the latest file</title>
      <link>https://community.hpe.com/t5/operating-system-openvms/list-the-latest-file/m-p/5174004#M42186</link>
      <description>I think Kris's program is the most excellent doing a sorted directory anyway.&lt;BR /&gt;&lt;BR /&gt;&amp;gt;&amp;gt; tried to pipe dir and sort but didnt succeed. &lt;BR /&gt;&lt;BR /&gt;Because the default date format is not ISO or VMS "comparison": one has to switch date-format before the directory command, and has to fix the output fields with the /width qualifier, then one can pipe the output through sort.&lt;BR /&gt;&lt;BR /&gt;I did this for the file size (because it's simpler :-), see&lt;BR /&gt;  &lt;A href="http://wwwvms.mppmu.mpg.de/util_root/com/dir_by_size.com" target="_blank"&gt;http://wwwvms.mppmu.mpg.de/util_root/com/dir_by_size.com&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Fri, 08 May 2009 07:59:39 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-openvms/list-the-latest-file/m-p/5174004#M42186</guid>
      <dc:creator>Joseph Huber_1</dc:creator>
      <dc:date>2009-05-08T07:59:39Z</dc:date>
    </item>
    <item>
      <title>Re: List the latest file</title>
      <link>https://community.hpe.com/t5/operating-system-openvms/list-the-latest-file/m-p/5174005#M42187</link>
      <description>A quick hack in DCL piping directory output into sort is at&lt;BR /&gt; &lt;A href="http://wwwvms.mppmu.mpg.de/util_root/com/dir_by_date.com" target="_blank"&gt;http://wwwvms.mppmu.mpg.de/util_root/com/dir_by_date.com&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;but it will break the correct order and display whenever a dir-/file-specification exceeds the filename field width (80 in my example).&lt;BR /&gt;&lt;BR /&gt;A slower DCL version using f$search loop is &lt;BR /&gt; &lt;A href="http://wwwvms.mppmu.mpg.de/util_root/com/dir_by_date2.com" target="_blank"&gt;http://wwwvms.mppmu.mpg.de/util_root/com/dir_by_date2.com&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Fri, 08 May 2009 08:44:46 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-openvms/list-the-latest-file/m-p/5174005#M42187</guid>
      <dc:creator>Joseph Huber_1</dc:creator>
      <dc:date>2009-05-08T08:44:46Z</dc:date>
    </item>
    <item>
      <title>Re: List the latest file</title>
      <link>https://community.hpe.com/t5/operating-system-openvms/list-the-latest-file/m-p/5174006#M42188</link>
      <description>$ DEFINE/EXEC/TAB=LNM$DT_FORMAT_TABLE LIB$DATE_FORMAT_COMPARISON "!Y4-!MN0-!D0"&lt;BR /&gt;$ DEFINE LIB$DT_FORMAT LIB$DATE_FORMAT_COMPARISON,LIB_TIME_FORMAT_001&lt;BR /&gt;$ pipe (dir/date/wid=file=40 | search sys$input ";" | sort/key=(pos:43,siz:22,desc) s&lt;BR /&gt;ys$input sys$output)&lt;BR /&gt;&lt;BR /&gt;Hakan</description>
      <pubDate>Fri, 08 May 2009 08:47:57 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-openvms/list-the-latest-file/m-p/5174006#M42188</guid>
      <dc:creator>Hakan Zanderau ( Anders</dc:creator>
      <dc:date>2009-05-08T08:47:57Z</dc:date>
    </item>
    <item>
      <title>Re: List the latest file</title>
      <link>https://community.hpe.com/t5/operating-system-openvms/list-the-latest-file/m-p/5174007#M42189</link>
      <description>BTW, the LIB$DT_FORMAT feature only works if&lt;BR /&gt;@sys$startup:lib$dt_startup has been executed (best insert this in systartup_vms ).&lt;BR /&gt;</description>
      <pubDate>Fri, 08 May 2009 10:19:03 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-openvms/list-the-latest-file/m-p/5174007#M42189</guid>
      <dc:creator>Joseph Huber_1</dc:creator>
      <dc:date>2009-05-08T10:19:03Z</dc:date>
    </item>
    <item>
      <title>Re: List the latest file</title>
      <link>https://community.hpe.com/t5/operating-system-openvms/list-the-latest-file/m-p/5174008#M42190</link>
      <description>Joseph,&lt;BR /&gt;&lt;BR /&gt;The default date &amp;amp; time formats&lt;BR /&gt;&lt;BR /&gt;LIB$DATE_FORMAT_001&lt;BR /&gt;LIB$TIME_FORMAT_001&lt;BR /&gt;&lt;BR /&gt;are defined in SYS$STARTUP:VMS$INITIAL-050_LIB.COM&lt;BR /&gt;&lt;BR /&gt;You can define your own date and time format&lt;BR /&gt;in table lnm$dt_format_table and make use of it without running LIB$DT_STARTUP.COM&lt;BR /&gt;&lt;BR /&gt;I think I'm right about this, but I'm not 100% sure.&lt;BR /&gt;&lt;BR /&gt;Hakan</description>
      <pubDate>Fri, 08 May 2009 11:01:58 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-openvms/list-the-latest-file/m-p/5174008#M42190</guid>
      <dc:creator>Hakan Zanderau ( Anders</dc:creator>
      <dc:date>2009-05-08T11:01:58Z</dc:date>
    </item>
    <item>
      <title>Re: List the latest file</title>
      <link>https://community.hpe.com/t5/operating-system-openvms/list-the-latest-file/m-p/5174009#M42191</link>
      <description>As far I tested, only privileged users can do it.&lt;BR /&gt;So for average users it is better to rely on definitions done from systartup_vms.</description>
      <pubDate>Fri, 08 May 2009 11:30:34 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-openvms/list-the-latest-file/m-p/5174009#M42191</guid>
      <dc:creator>Joseph Huber_1</dc:creator>
      <dc:date>2009-05-08T11:30:34Z</dc:date>
    </item>
    <item>
      <title>Re: List the latest file</title>
      <link>https://community.hpe.com/t5/operating-system-openvms/list-the-latest-file/m-p/5174010#M42192</link>
      <description>Joseph,&lt;BR /&gt;&lt;BR /&gt;Oppps....forgot about the privileges needed to&lt;BR /&gt;define names in lnm$dt_format_table.&lt;BR /&gt;&lt;BR /&gt;The truth is that I have never worked without&lt;BR /&gt;privileges on VMS........ and have all privileges enabled by default.&lt;BR /&gt;&lt;BR /&gt;I know...., but that's the way it is ;-)&lt;BR /&gt;&lt;BR /&gt;Hakan</description>
      <pubDate>Fri, 08 May 2009 12:27:41 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-openvms/list-the-latest-file/m-p/5174010#M42192</guid>
      <dc:creator>Hakan Zanderau ( Anders</dc:creator>
      <dc:date>2009-05-08T12:27:41Z</dc:date>
    </item>
    <item>
      <title>Re: List the latest file</title>
      <link>https://community.hpe.com/t5/operating-system-openvms/list-the-latest-file/m-p/5174011#M42193</link>
      <description>&lt;!--!*#--&gt;&amp;gt; You can write a DCL command file:&lt;BR /&gt;&lt;BR /&gt;You're right.  This came up in the Linux&lt;BR /&gt;forum:&lt;BR /&gt;&lt;BR /&gt;&lt;A href="http://forums11.itrc.hp.com/service/forums/questionanswer.do?threadId=1335784" target="_blank"&gt;http://forums11.itrc.hp.com/service/forums/questionanswer.do?threadId=1335784&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;After saying that it would be easy in DCL, I&lt;BR /&gt;figured that I ought to try it.&lt;BR /&gt;&lt;BR /&gt;$!                                              8 May 2009.  SMS.&lt;BR /&gt;$!&lt;BR /&gt;$!    Find newest file in (wildcard) P1 specification.&lt;BR /&gt;$!&lt;BR /&gt;$ prev_file_spec = ""&lt;BR /&gt;$ date_max_c = f$cvtime( "17-NOV-1858 00:00:00.00", "COMPARISON")&lt;BR /&gt;$ file_spec_max = ""&lt;BR /&gt;$!&lt;BR /&gt;$ loop_top:&lt;BR /&gt;$!&lt;BR /&gt;$     file_spec = f$search( p1)&lt;BR /&gt;$!&lt;BR /&gt;$!    Quit if out of files, or (non-wildcard) look-up repeats.&lt;BR /&gt;$!&lt;BR /&gt;$     if ((file_spec .eqs. "") .or. -&lt;BR /&gt;       (file_spec .eqs. prev_file_spec)) then goto loop_end&lt;BR /&gt;$!&lt;BR /&gt;$     prev_file_spec = file_spec&lt;BR /&gt;$!&lt;BR /&gt;$!    Get file revision date, and convert it to "COMPARISON" format.&lt;BR /&gt;$!&lt;BR /&gt;$     file_date = f$file_attributes( file_spec, "RDT")&lt;BR /&gt;$     file_date_c = f$cvtime( file_date, "COMPARISON")&lt;BR /&gt;$!&lt;BR /&gt;$!    Save the information for a new newest file.&lt;BR /&gt;$!&lt;BR /&gt;$     if (file_date_c .gts. date_max_c)&lt;BR /&gt;$     then&lt;BR /&gt;$         file_spec_max = file_spec&lt;BR /&gt;$         date_max_c = file_date_c&lt;BR /&gt;$     endif&lt;BR /&gt;$!&lt;BR /&gt;$ goto loop_top&lt;BR /&gt;$ loop_end:&lt;BR /&gt;$!&lt;BR /&gt;$! If anything was found, display its information.&lt;BR /&gt;$!&lt;BR /&gt;$ if (file_spec_max .nes. "")&lt;BR /&gt;$ then&lt;BR /&gt;$     write sys$output file_spec_max&lt;BR /&gt;$     write sys$output date_max_c&lt;BR /&gt;$ endif&lt;BR /&gt;$!&lt;BR /&gt;&lt;BR /&gt;Easy enough, I reckon.</description>
      <pubDate>Fri, 08 May 2009 15:05:26 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-openvms/list-the-latest-file/m-p/5174011#M42193</guid>
      <dc:creator>Steven Schweda</dc:creator>
      <dc:date>2009-05-08T15:05:26Z</dc:date>
    </item>
    <item>
      <title>Re: List the latest file</title>
      <link>https://community.hpe.com/t5/operating-system-openvms/list-the-latest-file/m-p/5174012#M42194</link>
      <description>And here (without own programming), let the fine GNV do the work:-)&lt;BR /&gt;&lt;BR /&gt; $ bash -c "ls -lt"</description>
      <pubDate>Fri, 08 May 2009 17:10:45 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-openvms/list-the-latest-file/m-p/5174012#M42194</guid>
      <dc:creator>Joseph Huber_1</dc:creator>
      <dc:date>2009-05-08T17:10:45Z</dc:date>
    </item>
    <item>
      <title>Re: List the latest file</title>
      <link>https://community.hpe.com/t5/operating-system-openvms/list-the-latest-file/m-p/5174013#M42195</link>
      <description>&lt;!--!*#--&gt;&amp;gt; $ bash -c "ls -lt"&lt;BR /&gt;&lt;BR /&gt;That gives me more than "the [...] file".&lt;BR /&gt;Or did you mean this?:&lt;BR /&gt;&lt;BR /&gt;$ bash -c "ls -lt | head -2 | tail -1"&lt;BR /&gt;&lt;BR /&gt;The DCL method runs faster, and easily does&lt;BR /&gt;recursive descent into subdirectories&lt;BR /&gt;("[...]"), which is tougher to do with a&lt;BR /&gt;UNIX-like method.&lt;BR /&gt;&lt;BR /&gt;As usual, many things are possible.</description>
      <pubDate>Fri, 08 May 2009 17:40:40 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-openvms/list-the-latest-file/m-p/5174013#M42195</guid>
      <dc:creator>Steven Schweda</dc:creator>
      <dc:date>2009-05-08T17:40:40Z</dc:date>
    </item>
    <item>
      <title>Re: List the latest file</title>
      <link>https://community.hpe.com/t5/operating-system-openvms/list-the-latest-file/m-p/5174014#M42196</link>
      <description>&amp;gt;&amp;gt;That gives me more than "the [...] file".&lt;BR /&gt;&amp;gt;&amp;gt;Or did you mean this?:&lt;BR /&gt;&amp;gt;&amp;gt;$ bash -c "ls -lt | head -2 | tail -1"&lt;BR /&gt;&lt;BR /&gt;Yea right, thats exactly to get the one newest file, as Your DCL command file is doing.&lt;BR /&gt;&lt;BR /&gt;I was just comparing the bash one liner to my dir_by_date.com .&lt;BR /&gt;</description>
      <pubDate>Fri, 08 May 2009 18:31:54 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-openvms/list-the-latest-file/m-p/5174014#M42196</guid>
      <dc:creator>Joseph Huber_1</dc:creator>
      <dc:date>2009-05-08T18:31:54Z</dc:date>
    </item>
  </channel>
</rss>

