<?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: SUbtracting in OpenVMS in Operating System - OpenVMS</title>
    <link>https://community.hpe.com/t5/operating-system-openvms/subtracting-in-openvms/m-p/5255878#M40649</link>
    <description>Having seen similar file naming conventions, I suspect that the filename is calculated/created and sometime thereafter the actual file is actually created on disk.  Since the filename appears to have relevance to the application at hand, the asker can not rely on the creation date and must resort to the actual filname itself.  That being said, I think that a variation on the alternative method I suggested might be a better way to approach this.  Using the search capability of directory along with a time qualifier should make the list short enough to process easily.  Depending upon the rename, adding an exclude qualifier ont he directory command may make the list even shorter.&lt;BR /&gt;&lt;BR /&gt;The bottom line here is that a more detailed description of the ultimate goal is needed.&lt;BR /&gt;&lt;BR /&gt;Dan</description>
    <pubDate>Wed, 22 Sep 2010 16:15:33 GMT</pubDate>
    <dc:creator>abrsvc</dc:creator>
    <dc:date>2010-09-22T16:15:33Z</dc:date>
    <item>
      <title>SUbtracting in OpenVMS</title>
      <link>https://community.hpe.com/t5/operating-system-openvms/subtracting-in-openvms/m-p/5255852#M40623</link>
      <description>Hi,&lt;BR /&gt;&lt;BR /&gt;I am writing a COM to rename a group of files which satisfy the below condition. The File name has the current date and time &lt;BR /&gt;Example: 20100919103344&lt;BR /&gt;If the difference between the current date (20100920) and the file date (20100919) is greater than 1, then i need to do certain steps.&lt;BR /&gt;I tried this but it is not working as expected.&lt;BR /&gt;&lt;BR /&gt;$file_name = "V2B_20100919103344.TXT"&lt;BR /&gt;$file_name = "V2B_20100919103344.TXT_TEMP"&lt;BR /&gt;$&lt;BR /&gt;$SH SYM file_name&lt;BR /&gt;  FILE_NAME = "V2B_20100919103344.TXT_TEMP"&lt;BR /&gt;$file_date = f$extract(4,8,''file_name)&lt;BR /&gt;$SH SYM file_date&lt;BR /&gt;  FILE_DATE = "20100919"&lt;BR /&gt;$CUR_DAT = F$CVTIME(,,"DATE") - "-" - "-"&lt;BR /&gt;$SH SYM CUR_DAT&lt;BR /&gt;  CUR_DAT = "20100920"&lt;BR /&gt;$&lt;BR /&gt;$FINAL = (CUR_DAT - FILE_DATE)&lt;BR /&gt;$SH SYM FINAL&lt;BR /&gt;  FINAL = "20100920"&lt;BR /&gt;&lt;BR /&gt;Please advice.</description>
      <pubDate>Mon, 20 Sep 2010 10:29:24 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-openvms/subtracting-in-openvms/m-p/5255852#M40623</guid>
      <dc:creator>CHANDRASEKARAN S</dc:creator>
      <dc:date>2010-09-20T10:29:24Z</dc:date>
    </item>
    <item>
      <title>Re: SUbtracting in OpenVMS</title>
      <link>https://community.hpe.com/t5/operating-system-openvms/subtracting-in-openvms/m-p/5255853#M40624</link>
      <description>You could use F$INTEGER on the strings CUR_DAT and FILE_DATE, and then do the subtraction.&lt;BR /&gt;&lt;BR /&gt;Regards,&lt;BR /&gt;Kris (aka Qkcl)</description>
      <pubDate>Mon, 20 Sep 2010 10:37:17 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-openvms/subtracting-in-openvms/m-p/5255853#M40624</guid>
      <dc:creator>Kris Clippeleyr</dc:creator>
      <dc:date>2010-09-20T10:37:17Z</dc:date>
    </item>
    <item>
      <title>Re: SUbtracting in OpenVMS</title>
      <link>https://community.hpe.com/t5/operating-system-openvms/subtracting-in-openvms/m-p/5255854#M40625</link>
      <description>As stated above, use the f$integer lexical as shown in a modified version of your procedure listed bwloe.&lt;BR /&gt;&lt;BR /&gt;Dan&lt;BR /&gt;&lt;BR /&gt;============================================&lt;BR /&gt;&lt;BR /&gt;$file_name = "V2B_20100919103344.TXT" &lt;BR /&gt;$file_name = "V2B_20100919103344.TXT_TEMP" &lt;BR /&gt;$! &lt;BR /&gt;$SH SYM file_name &lt;BR /&gt;$file_date = f$extract(4,8,''file_name) &lt;BR /&gt;$SH SYM file_date &lt;BR /&gt;$CUR_DAT = F$CVTIME(,,"DATE") - "-" - "-" &lt;BR /&gt;$SH SYM CUR_DAT &lt;BR /&gt;$! &lt;BR /&gt;$ c=f$integer("''cur_dat'")&lt;BR /&gt;$ f=f$integer("''file_date'")&lt;BR /&gt;$FINAL = (c - f) &lt;BR /&gt;$SH SYM FINAL&lt;BR /&gt;</description>
      <pubDate>Mon, 20 Sep 2010 10:52:50 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-openvms/subtracting-in-openvms/m-p/5255854#M40625</guid>
      <dc:creator>abrsvc</dc:creator>
      <dc:date>2010-09-20T10:52:50Z</dc:date>
    </item>
    <item>
      <title>Re: SUbtracting in OpenVMS</title>
      <link>https://community.hpe.com/t5/operating-system-openvms/subtracting-in-openvms/m-p/5255855#M40626</link>
      <description>Please note that the double and single quotes in the F$integer parameter are not required.  I am a creature of habitand tend to include them, but they are not required in this context.&lt;BR /&gt;&lt;BR /&gt;Dan</description>
      <pubDate>Mon, 20 Sep 2010 13:18:55 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-openvms/subtracting-in-openvms/m-p/5255855#M40626</guid>
      <dc:creator>abrsvc</dc:creator>
      <dc:date>2010-09-20T13:18:55Z</dc:date>
    </item>
    <item>
      <title>Re: SUbtracting in OpenVMS</title>
      <link>https://community.hpe.com/t5/operating-system-openvms/subtracting-in-openvms/m-p/5255856#M40627</link>
      <description>&lt;BR /&gt;&lt;BR /&gt;Why subtract? Your requirement&lt;BR /&gt;"If the difference between the current date"&lt;BR /&gt;&lt;BR /&gt;_any_ difference will be 1 day or more.&lt;BR /&gt;&lt;BR /&gt;So instead of :&lt;BR /&gt;&lt;BR /&gt; - $FINAL = (CUR_DAT - FILE_DATE) &lt;BR /&gt;&lt;BR /&gt;Use a string compare like:&lt;BR /&gt;&lt;BR /&gt; - $IF CUR_DAT .GTS. FILE_DATE .......&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Enjoy,&lt;BR /&gt;Hein&lt;BR /&gt;</description>
      <pubDate>Mon, 20 Sep 2010 19:56:13 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-openvms/subtracting-in-openvms/m-p/5255856#M40627</guid>
      <dc:creator>Hein van den Heuvel</dc:creator>
      <dc:date>2010-09-20T19:56:13Z</dc:date>
    </item>
    <item>
      <title>Re: SUbtracting in OpenVMS</title>
      <link>https://community.hpe.com/t5/operating-system-openvms/subtracting-in-openvms/m-p/5255857#M40628</link>
      <description>Just to explain the behaviour... this is DCL doing clever things with the minus operator and polymorphic operands.&lt;BR /&gt;&lt;BR /&gt;When DCL sees what appears to be an arithmetic expression containing only "+" and "-" it tries to work out if this is an INTEGER operation or a STRING operation, depending on the apparent types of the operands. In this case CUR_DATE is determined to be STRING, so the operation is STRING. Since the subtrahend is not a substring of the minuend, the result is the minuend.&lt;BR /&gt;&lt;BR /&gt;You need to be very careful with these operators, to make sure DCL understands your intent. Sometimes you need to use F$INTEGER to force an operand to be interpreted as INTEGER or F$STRING to force it to be STRING. &lt;BR /&gt;In this case I'd go with Hein and use a comparison. Note that there you also need to be explicit about data type "GTS" for string and "GT" for integer.</description>
      <pubDate>Mon, 20 Sep 2010 21:10:59 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-openvms/subtracting-in-openvms/m-p/5255857#M40628</guid>
      <dc:creator>John Gillings</dc:creator>
      <dc:date>2010-09-20T21:10:59Z</dc:date>
    </item>
    <item>
      <title>Re: SUbtracting in OpenVMS</title>
      <link>https://community.hpe.com/t5/operating-system-openvms/subtracting-in-openvms/m-p/5255858#M40629</link>
      <description>Why not get yesterday's date in the same format as used in the filenames, then you can simply compare them.&lt;BR /&gt;&lt;BR /&gt;$ yest_date = F$CVTIME("","COMPARISON","DATE") - "-" - "-"&lt;BR /&gt;&lt;BR /&gt;(The above gives 20100921 when I run it because here it's already 21 Sep here.)&lt;BR /&gt;&lt;BR /&gt;Just compare yest_date to the first 8 characters of your filename string.&lt;BR /&gt;&lt;BR /&gt;It's not clear if you want to rename the files but this would be the simplest because you wouldn't need to check if the files were created earlier than yesterday.</description>
      <pubDate>Tue, 21 Sep 2010 00:04:55 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-openvms/subtracting-in-openvms/m-p/5255858#M40629</guid>
      <dc:creator>John McL</dc:creator>
      <dc:date>2010-09-21T00:04:55Z</dc:date>
    </item>
    <item>
      <title>Re: SUbtracting in OpenVMS</title>
      <link>https://community.hpe.com/t5/operating-system-openvms/subtracting-in-openvms/m-p/5255859#M40630</link>
      <description>Hi All,&lt;BR /&gt;&lt;BR /&gt;Thanks a lot for your replies.&lt;BR /&gt;I will be trying today with all of your valuable inputs..&lt;BR /&gt;&lt;BR /&gt;Really thanks a lot..</description>
      <pubDate>Tue, 21 Sep 2010 01:58:41 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-openvms/subtracting-in-openvms/m-p/5255859#M40630</guid>
      <dc:creator>CHANDRASEKARAN S</dc:creator>
      <dc:date>2010-09-21T01:58:41Z</dc:date>
    </item>
    <item>
      <title>Re: SUbtracting in OpenVMS</title>
      <link>https://community.hpe.com/t5/operating-system-openvms/subtracting-in-openvms/m-p/5255860#M40631</link>
      <description>Hi All,&lt;BR /&gt;&lt;BR /&gt;I have a problem now.&lt;BR /&gt;Consider this Example:&lt;BR /&gt;The current date is 20101001(October 1st 2010). The File date is 20100930.&lt;BR /&gt;I went with subtracting them as an integer. But i need the value to be 1. If i subtract, it gives the putput as 71.&lt;BR /&gt;&lt;BR /&gt;Please Help..</description>
      <pubDate>Wed, 22 Sep 2010 09:02:15 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-openvms/subtracting-in-openvms/m-p/5255860#M40631</guid>
      <dc:creator>CHANDRASEKARAN S</dc:creator>
      <dc:date>2010-09-22T09:02:15Z</dc:date>
    </item>
    <item>
      <title>Re: SUbtracting in OpenVMS</title>
      <link>https://community.hpe.com/t5/operating-system-openvms/subtracting-in-openvms/m-p/5255861#M40632</link>
      <description>Can I ask why you are messing with this subtraction stuff at all.    &lt;BR /&gt;&lt;BR /&gt;    Is there no way you can do this using the f$delta_time lexical.&lt;BR /&gt;&lt;BR /&gt;F$DELTA_TIME&lt;BR /&gt;&lt;BR /&gt;       Returns the time difference between a given start and end time.&lt;BR /&gt;       The end time must be the same as or later than the start time.&lt;BR /&gt;&lt;BR /&gt;       Format&lt;BR /&gt;&lt;BR /&gt;         F$DELTA_TIME(start-time,end-time)&lt;BR /&gt;&lt;BR /&gt;Times are supplied as "Absolute", so use f$cvtime to convert FILE_DATE back to absolute, Set CUR_DATE to f$cvtime(,"ABSOLUTE","DATE").&lt;BR /&gt;&lt;BR /&gt;f$delta will return the difference as a Delta time.   From which you extract the "day" component to test.&lt;BR /&gt;&lt;BR /&gt;It certainly avoids having to worry about days-in-month.&lt;BR /&gt;&lt;BR /&gt;Dave.&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Wed, 22 Sep 2010 10:02:19 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-openvms/subtracting-in-openvms/m-p/5255861#M40632</guid>
      <dc:creator>The Brit</dc:creator>
      <dc:date>2010-09-22T10:02:19Z</dc:date>
    </item>
    <item>
      <title>Re: SUbtracting in OpenVMS</title>
      <link>https://community.hpe.com/t5/operating-system-openvms/subtracting-in-openvms/m-p/5255862#M40633</link>
      <description>f$delta_time is the correct way to get a time difference.&lt;BR /&gt;&lt;BR /&gt;Even if You take f$integer() of the dates, don't think the difference of the two integers is the number of days between two dates!&lt;BR /&gt;&lt;BR /&gt;Example:&lt;BR /&gt; 20101001-20100901 = 100, not 30 !</description>
      <pubDate>Wed, 22 Sep 2010 10:39:32 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-openvms/subtracting-in-openvms/m-p/5255862#M40633</guid>
      <dc:creator>Joseph Huber_1</dc:creator>
      <dc:date>2010-09-22T10:39:32Z</dc:date>
    </item>
    <item>
      <title>Re: SUbtracting in OpenVMS</title>
      <link>https://community.hpe.com/t5/operating-system-openvms/subtracting-in-openvms/m-p/5255863#M40634</link>
      <description>HI,&lt;BR /&gt;&lt;BR /&gt;I have the file_date like this 20100930.&lt;BR /&gt;How will i convert it to absolute time ??</description>
      <pubDate>Wed, 22 Sep 2010 11:00:48 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-openvms/subtracting-in-openvms/m-p/5255863#M40634</guid>
      <dc:creator>CHANDRASEKARAN S</dc:creator>
      <dc:date>2010-09-22T11:00:48Z</dc:date>
    </item>
    <item>
      <title>Re: SUbtracting in OpenVMS</title>
      <link>https://community.hpe.com/t5/operating-system-openvms/subtracting-in-openvms/m-p/5255864#M40635</link>
      <description>What i want to do:&lt;BR /&gt;I need to find out all the files from a certain logical, which are older than 1 day from the current date and rename them.&lt;BR /&gt;The file Format which we have is   %%_yyyymmddhhmmss.%%%&lt;BR /&gt;&lt;BR /&gt;I get the FILE_DATE as "20100930"&lt;BR /&gt;&lt;BR /&gt;How can i convert it into absoulte date ?&lt;BR /&gt;&lt;BR /&gt;I tried the below:&lt;BR /&gt;&lt;BR /&gt;$CUR_DATE = f$cvtime(,"ABSOLUTE","DATE")&lt;BR /&gt;$&lt;BR /&gt;$YEST = f$cvtime("YESTERDAY","ABSOLUTE","DATE")&lt;BR /&gt;$&lt;BR /&gt;$&lt;BR /&gt;$SH SYM CUR_DATE&lt;BR /&gt;  CUR_DATE = "22-SEP-2010"&lt;BR /&gt;$&lt;BR /&gt;$SH SYM YEST&lt;BR /&gt;  YEST = "21-SEP-2010"&lt;BR /&gt;$&lt;BR /&gt;$DAYS = F$DELTA_TIME (YEST,CUR_DATE)&lt;BR /&gt;$&lt;BR /&gt;$SH SYM DAYS&lt;BR /&gt;  DAYS = "   1 00:00:00.00"&lt;BR /&gt;$&lt;BR /&gt;&lt;BR /&gt;How can i extract DAY component from the variable DAYS ?&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Please help.</description>
      <pubDate>Wed, 22 Sep 2010 11:16:34 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-openvms/subtracting-in-openvms/m-p/5255864#M40635</guid>
      <dc:creator>CHANDRASEKARAN S</dc:creator>
      <dc:date>2010-09-22T11:16:34Z</dc:date>
    </item>
    <item>
      <title>Re: SUbtracting in OpenVMS</title>
      <link>https://community.hpe.com/t5/operating-system-openvms/subtracting-in-openvms/m-p/5255865#M40636</link>
      <description>How about taking a different approach which will avoid all of this?  Use the directory command as follows to generate a list of the files.  Use the /output qualifier to send them to a file and process the file.  This method may be easier to use in the long run.  Let the system worry about the month transitions.&lt;BR /&gt;&lt;BR /&gt;Dan&lt;BR /&gt;&lt;BR /&gt;==================================&lt;BR /&gt;$ a=f$cvtime("yesterday")&lt;BR /&gt;$ yyyy=f$extract(0,4,a)&lt;BR /&gt;$ mm=f$extract(5,2,a)&lt;BR /&gt;$ dd=f$extract(8,2,a)&lt;BR /&gt;$ srch_string=yyyy+mm+dd&lt;BR /&gt;$ dir/before=yesterday *'string'*&lt;BR /&gt;&lt;BR /&gt;===================================</description>
      <pubDate>Wed, 22 Sep 2010 11:30:54 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-openvms/subtracting-in-openvms/m-p/5255865#M40636</guid>
      <dc:creator>abrsvc</dc:creator>
      <dc:date>2010-09-22T11:30:54Z</dc:date>
    </item>
    <item>
      <title>Re: SUbtracting in OpenVMS</title>
      <link>https://community.hpe.com/t5/operating-system-openvms/subtracting-in-openvms/m-p/5255866#M40637</link>
      <description>&lt;BR /&gt;I have the file_date like this 20100930.&lt;BR /&gt;How will i convert it to absolute time ?&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Try this .COM file:&lt;BR /&gt;$!&lt;TITLE&gt;Convert compact date (20100922) to VMS absolute &lt;/TITLE&gt;&lt;BR /&gt;$ cdt=p1&lt;BR /&gt;$ y=f$extract(0,4,cdt)&lt;BR /&gt;$ m=f$extract(4,2,cdt)&lt;BR /&gt;$ d=f$extract(6,2,cdt)&lt;BR /&gt;$mn="NULL,JAN,FEB,MAR,APR,MAY,JUN,JUL,AUG,SEP,OCT,NOV,DEC,"&lt;BR /&gt;$ nm=f$integer(m)&lt;BR /&gt;$! if (m.klt.1).or.(M&amp;gt;12) THEN GOTO ERR&lt;BR /&gt;$ mon=f$element(nm,",",mn)&lt;BR /&gt;$ vmsdate=d+"-"+mon+"-"+y&lt;BR /&gt;$ show symbol vmsdate&lt;BR /&gt;$ exit&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Wed, 22 Sep 2010 11:31:25 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-openvms/subtracting-in-openvms/m-p/5255866#M40637</guid>
      <dc:creator>Joseph Huber_1</dc:creator>
      <dc:date>2010-09-22T11:31:25Z</dc:date>
    </item>
    <item>
      <title>Re: SUbtracting in OpenVMS</title>
      <link>https://community.hpe.com/t5/operating-system-openvms/subtracting-in-openvms/m-p/5255867#M40638</link>
      <description>CHANDRASEKARAN,&lt;BR /&gt;&lt;BR /&gt;As usual, "What problem are you trying to solve" is important info.&lt;BR /&gt;&lt;BR /&gt;&amp;gt;&amp;gt;&amp;gt;&lt;BR /&gt;I need to find out all the files from a certain logical, which are older than 1 day from the current date and rename them. &lt;BR /&gt;&amp;lt;&amp;lt;&amp;lt;&lt;BR /&gt;&lt;BR /&gt;In VMS, this info is directly available:&lt;BR /&gt;&lt;BR /&gt;$ Credat = f$file_attribute(filename,"CDT")&lt;BR /&gt;... and do the date-handling from there.&lt;BR /&gt;&lt;BR /&gt;But even more directly if you want to rename them:&lt;BR /&gt;&lt;BR /&gt;$ RENAME filename newname /BEFORE=YESTERDAY.&lt;BR /&gt;... if you need to retain (parts of) the file spec, then there are really nice tricks with wildcarding, or if you need more sofisticated manipulations, with f$parse.&lt;BR /&gt;&lt;BR /&gt;But YOU have to tell us WHAT you need.&lt;BR /&gt;&lt;BR /&gt;hth&lt;BR /&gt;&lt;BR /&gt;Proost.&lt;BR /&gt;&lt;BR /&gt;Have one on me.&lt;BR /&gt;&lt;BR /&gt;jpe&lt;BR /&gt;</description>
      <pubDate>Wed, 22 Sep 2010 12:10:39 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-openvms/subtracting-in-openvms/m-p/5255867#M40638</guid>
      <dc:creator>Jan van den Ende</dc:creator>
      <dc:date>2010-09-22T12:10:39Z</dc:date>
    </item>
    <item>
      <title>Re: SUbtracting in OpenVMS</title>
      <link>https://community.hpe.com/t5/operating-system-openvms/subtracting-in-openvms/m-p/5255868#M40639</link>
      <description>PLease note the following correction in my previous posting:&lt;BR /&gt;&lt;BR /&gt;Original:&lt;BR /&gt;&lt;BR /&gt;$ srch_string=yyyy+mm+dd &lt;BR /&gt;$ dir/before=yesterday *'string'* &lt;BR /&gt;&lt;BR /&gt;Corrected:&lt;BR /&gt;&lt;BR /&gt;$ srch_string=yyyy+mm+dd &lt;BR /&gt;$ dir/before=yesterday *'srch_string'* &lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Wed, 22 Sep 2010 12:12:59 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-openvms/subtracting-in-openvms/m-p/5255868#M40639</guid>
      <dc:creator>abrsvc</dc:creator>
      <dc:date>2010-09-22T12:12:59Z</dc:date>
    </item>
    <item>
      <title>Re: SUbtracting in OpenVMS</title>
      <link>https://community.hpe.com/t5/operating-system-openvms/subtracting-in-openvms/m-p/5255869#M40640</link>
      <description>&amp;gt;&amp;gt; I have the file_date like this 20100930.&lt;BR /&gt;&amp;gt;&amp;gt; How will i convert it to absolute time ??&lt;BR /&gt;&lt;BR /&gt;Just like you always when you chewed of more than you can handle: A couple of bytes at a time&lt;BR /&gt;&lt;BR /&gt;Joseph give a fine bit of parsing and reconstructing using F$ELEMENT. I like and often use that. But then you have to glue in the dashes.&lt;BR /&gt;&lt;BR /&gt;So for this case I prefer F$EXTRACT and ditch the intermediate variable... those are for wimps!&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;$ vmsdate = f$extract(6,2,cdt) + -&lt;BR /&gt;            f$extract( 4 * f$extract(4,2,cdt), 5, "NULL-JAN-FEB-MAR-APR-MAY-JUN-JUL-AUG-SEP-OCT-NOV-DEC-") + -&lt;BR /&gt;            f$extract(0,4,cdt)&lt;BR /&gt;$&lt;BR /&gt;$ write sys$output cdt, " = ", vmsdate, " = ", f$cvtime(vmsdate,,"DATE")&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&amp;gt;&amp;gt; I need to find out all the files from a certain logical, which are older than 1 day from the current date and rename them. &lt;BR /&gt;&lt;BR /&gt;Ah! Here is what we really want to to (Jan!)&lt;BR /&gt;Is that a simple rename like directory, extension or name only, or complex replacing pieces of string in the name?&lt;BR /&gt;&lt;BR /&gt;If it is complex rename, then you may want to consider a perl 'one-liner'&lt;BR /&gt;&lt;BR /&gt;Just for fun....&lt;BR /&gt;&lt;BR /&gt;First you test with 'print qq'&lt;BR /&gt;&lt;BR /&gt;$ perl -le "for (&lt;V2B_&gt;) { if ( -M &amp;gt; 1 ) { $old = $_; s/V2B/done/; print qq($old, $_ ) }}"&lt;BR /&gt;&lt;BR /&gt;for (&lt;V2B_&gt;) ... GLOB returning matching file names in $_&lt;BR /&gt;&lt;BR /&gt;if ( -M &amp;gt; 1 ) ... Modification data older than 1.0 days?&lt;BR /&gt;&lt;BR /&gt;$old = $_; ... Remember the old name&lt;BR /&gt;&lt;BR /&gt;s/V2B/done/; ... Substitute a piece of string in $_&lt;BR /&gt;&lt;BR /&gt;print qq($old, $_ ) ... print what rename details.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Now make it real by just replacing "print qq" with "rename"&lt;BR /&gt;&lt;BR /&gt;$ perl -le "for (&lt;V2B_&gt;) { if ( -M &amp;gt; 1 ) { $old = $_; s/V2B/done/; rename ($old, $_ ) }}"&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;This assumes that the file modification date matched the file name, which may be a stretch&lt;BR /&gt;&lt;BR /&gt;And it assumes that you really wanted more than 24 hours = 1.0 days old, not just 'yesterday'. &lt;BR /&gt;If you want yesterday use DIR/BEF=YES.&lt;BR /&gt;&lt;BR /&gt;Perl can of course also suck on that piece of time string in the filename and turn it into a real time.&lt;BR /&gt;&lt;BR /&gt;Just for your entertainment....&lt;BR /&gt;&lt;BR /&gt;One of many ways to pick apart the string:&lt;BR /&gt;&lt;BR /&gt;$ perl -le "($y,$m,$d) = unpack(q(a4a2a2),q(20100930)); print qq(y=$y m=$m d=$d)"&lt;BR /&gt;y=2010 m=09 d=30&lt;BR /&gt;&lt;BR /&gt;And now turn that into a time (seconds since 1-jan-1970, 86400 per day) and back:&lt;BR /&gt;&lt;BR /&gt;$  perl -le "use Time::Local; ($y,$m,$d) = unpack q(a4a2a2),q(20100930); print scalar localtime timelocal(0,0,0,$d,$m-1,$y)"&lt;BR /&gt;Thu Sep 30 00:00:00 2010&lt;BR /&gt;&lt;BR /&gt;Hope this helps some,&lt;BR /&gt;Hein&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/V2B_&gt;&lt;/V2B_&gt;&lt;/V2B_&gt;</description>
      <pubDate>Wed, 22 Sep 2010 13:31:13 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-openvms/subtracting-in-openvms/m-p/5255869#M40640</guid>
      <dc:creator>Hein van den Heuvel</dc:creator>
      <dc:date>2010-09-22T13:31:13Z</dc:date>
    </item>
    <item>
      <title>Re: SUbtracting in OpenVMS</title>
      <link>https://community.hpe.com/t5/operating-system-openvms/subtracting-in-openvms/m-p/5255870#M40641</link>
      <description>Hi All,&lt;BR /&gt;&lt;BR /&gt;I achieved the conversion of absoulte date from the string by using the below command:&lt;BR /&gt;&lt;BR /&gt;$file_date="20100922"&lt;BR /&gt;$ADATE  = F$CVTIME(f$extract(0,4,file_date)-f$extract(5,2,file_date)-f$extract(7,2,file_date), "ABSOLUTE", "DATE")&lt;BR /&gt;$sh sym adate&lt;BR /&gt;  ADATE = "22-SEP-2010"&lt;BR /&gt;$&lt;BR /&gt;$&lt;BR /&gt;&lt;BR /&gt;Anyway thanks for all your comments..</description>
      <pubDate>Wed, 22 Sep 2010 14:01:06 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-openvms/subtracting-in-openvms/m-p/5255870#M40641</guid>
      <dc:creator>CHANDRASEKARAN S</dc:creator>
      <dc:date>2010-09-22T14:01:06Z</dc:date>
    </item>
    <item>
      <title>Re: SUbtracting in OpenVMS</title>
      <link>https://community.hpe.com/t5/operating-system-openvms/subtracting-in-openvms/m-p/5255871#M40642</link>
      <description>Sorry buddy, but that did not work at all.&lt;BR /&gt;&lt;BR /&gt;Try 20100830.&lt;BR /&gt;&lt;BR /&gt;You ended up substracting pieces of string from each other resulting in '010'.&lt;BR /&gt;That was used as the HOUR in the time defaulting the rest to "TODAY" and the time being discarded by the explicit "DATE" request.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Watch:&lt;BR /&gt;&lt;BR /&gt;$ write sys$output  f$extract(0,4,file_date)-f$extract(5,2,file_date)-f$extract(7,2,file_date)&lt;BR /&gt;010&lt;BR /&gt;&lt;BR /&gt;$  write sys$output F$CVTIME(010,"ABSOLUTE")&lt;BR /&gt;22-SEP-2010 10:00:00.00&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Cheers,&lt;BR /&gt;Hein&lt;BR /&gt;</description>
      <pubDate>Wed, 22 Sep 2010 14:10:31 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-openvms/subtracting-in-openvms/m-p/5255871#M40642</guid>
      <dc:creator>Hein van den Heuvel</dc:creator>
      <dc:date>2010-09-22T14:10:31Z</dc:date>
    </item>
  </channel>
</rss>

