<?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: File Pointers in Operating System - OpenVMS</title>
    <link>https://community.hpe.com/t5/operating-system-openvms/file-pointers/m-p/3591007#M6740</link>
    <description>[ram, sorry for hijacking your threat]&lt;BR /&gt;&lt;BR /&gt;&amp;gt;&amp;gt; The statement you posted can read a RMS record regardless of lock.&lt;BR /&gt;&lt;BR /&gt;Of course.&lt;BR /&gt;&lt;BR /&gt;In my earlier reply I just wanted to point out that, contrary to popular belief, this line will actually cause a VMS lock to be taken and released. &lt;BR /&gt;&lt;BR /&gt;If you use that procedure to read a file with millions of records from begin to end then this will be a significant system overhead.&lt;BR /&gt;&lt;BR /&gt;You can avoid this 'overhead' by also using the newish NQL option. &lt;BR /&gt;&lt;BR /&gt;hth,&lt;BR /&gt;Hein.&lt;BR /&gt;</description>
    <pubDate>Sat, 30 Jul 2005 06:38:46 GMT</pubDate>
    <dc:creator>Hein van den Heuvel</dc:creator>
    <dc:date>2005-07-30T06:38:46Z</dc:date>
    <item>
      <title>File Pointers</title>
      <link>https://community.hpe.com/t5/operating-system-openvms/file-pointers/m-p/3590985#M6718</link>
      <description>Hi,&lt;BR /&gt;&lt;BR /&gt;1) I declare 2 file pointers -&lt;BR /&gt;FILE *fp1, *fp2;&lt;BR /&gt;&lt;BR /&gt;2) Using 'fp1' I open a file for reading in binary mode -&lt;BR /&gt;fp1=fopen("test","rb");&lt;BR /&gt;&lt;BR /&gt;3) I use 'fp2' to point to same memory what fp1 is pointing to -&lt;BR /&gt;fp2=fp1;&lt;BR /&gt;&lt;BR /&gt;4) Using 'fp2' I read a record from the file 'test' using a structure -&lt;BR /&gt;fread(&amp;amp;rec,sizeof(struct st),1,fp2); &lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Question - &lt;BR /&gt;What is the impact on pointer 'fp1' after step #4 is executed? Where will 'fp1' point to?&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;My Observation -&lt;BR /&gt;After step #4 is executed, 'fp2' should be at the end of 1st record that is read. and since 'fp1' is never used it should still be pointing to the beginning of the file. but it does not work that way. what i find is though 'fp1' is not used, it too is at the end of the 1st record along with 'fp2'. &lt;BR /&gt;&lt;BR /&gt;i want 'fp1' to remain at the beginning of the file untill i position it. is this something that i could achieve? pl help.&lt;BR /&gt;</description>
      <pubDate>Wed, 27 Jul 2005 08:54:38 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-openvms/file-pointers/m-p/3590985#M6718</guid>
      <dc:creator>ram_47</dc:creator>
      <dc:date>2005-07-27T08:54:38Z</dc:date>
    </item>
    <item>
      <title>Re: File Pointers</title>
      <link>https://community.hpe.com/t5/operating-system-openvms/file-pointers/m-p/3590986#M6719</link>
      <description>Hi Ram,&lt;BR /&gt;&lt;BR /&gt;Since something of the type FILE * is a pointer to something (in this case an object of the opaque type FILE), it is only natural that if an operation changes something in that object, both pointers to the same object reflect those changes.&lt;BR /&gt;&lt;BR /&gt;You might want to read on the functions fseek() and ftell(); these can be used to (re)position the read/write marker in a file.&lt;BR /&gt;&lt;BR /&gt;Regards,&lt;BR /&gt;Kris (aka Qkcl)&lt;BR /&gt;</description>
      <pubDate>Wed, 27 Jul 2005 09:07:40 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-openvms/file-pointers/m-p/3590986#M6719</guid>
      <dc:creator>Kris Clippeleyr</dc:creator>
      <dc:date>2005-07-27T09:07:40Z</dc:date>
    </item>
    <item>
      <title>Re: File Pointers</title>
      <link>https://community.hpe.com/t5/operating-system-openvms/file-pointers/m-p/3590987#M6720</link>
      <description>Hi Ram,&lt;BR /&gt;if you want to keep two different file pointer on the same file you have to open file two times.&lt;BR /&gt; &lt;BR /&gt;FILE *fp1, *fp2;&lt;BR /&gt;fp1=fopen("test","rb");&lt;BR /&gt;fp2=fopen("test","rb");&lt;BR /&gt; &lt;BR /&gt;Antonio Vigliotti&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Wed, 27 Jul 2005 09:34:42 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-openvms/file-pointers/m-p/3590987#M6720</guid>
      <dc:creator>Antoniov.</dc:creator>
      <dc:date>2005-07-27T09:34:42Z</dc:date>
    </item>
    <item>
      <title>Re: File Pointers</title>
      <link>https://community.hpe.com/t5/operating-system-openvms/file-pointers/m-p/3590988#M6721</link>
      <description>fp1 and fp2 are pointers to the same data structure. Just as multiple pointers to the same variable will all "see" the same value, regardless of which pointer was used to set the value, both file pointers will always "see" the same view of the file.&lt;BR /&gt;&lt;BR /&gt;Opening the file twice will do what you want. HOWEVER, you need to open the file with shared access. The two opens from the same process are seen in the same way as opens from multiple processes - hence shared access is required.&lt;BR /&gt;&lt;BR /&gt;If you used RMS I/O you could OPEN the file once and CONNECT multiple streams. This would allow you to maintain multiple pointers into the file, but with exclusive access. Native C I/O doesn't have a way to access multiple RMS streams (BASIC and COBOL do).&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Wed, 27 Jul 2005 17:01:38 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-openvms/file-pointers/m-p/3590988#M6721</guid>
      <dc:creator>John Gillings</dc:creator>
      <dc:date>2005-07-27T17:01:38Z</dc:date>
    </item>
    <item>
      <title>Re: File Pointers</title>
      <link>https://community.hpe.com/t5/operating-system-openvms/file-pointers/m-p/3590989#M6722</link>
      <description>Am not quite familiar with RMS. Where could I find documentation on RMS, if possible with examples.</description>
      <pubDate>Thu, 28 Jul 2005 00:11:20 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-openvms/file-pointers/m-p/3590989#M6722</guid>
      <dc:creator>ram_47</dc:creator>
      <dc:date>2005-07-28T00:11:20Z</dc:date>
    </item>
    <item>
      <title>Re: File Pointers</title>
      <link>https://community.hpe.com/t5/operating-system-openvms/file-pointers/m-p/3590990#M6723</link>
      <description>ram,&lt;BR /&gt;&lt;BR /&gt;There are a number of examples in SYS$EXAMPLES showing various&lt;BR /&gt;features of RMS.&lt;BR /&gt;&lt;BR /&gt;The documentation can be found by following the link at the&lt;BR /&gt;bottom of the main page for this forum.&lt;BR /&gt;&lt;BR /&gt;&lt;A href="http://h71000.www7.hp.com/doc/index.html" target="_blank"&gt;http://h71000.www7.hp.com/doc/index.html&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;Dave&lt;BR /&gt;</description>
      <pubDate>Thu, 28 Jul 2005 00:40:01 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-openvms/file-pointers/m-p/3590990#M6723</guid>
      <dc:creator>David B Sneddon</dc:creator>
      <dc:date>2005-07-28T00:40:01Z</dc:date>
    </item>
    <item>
      <title>Re: File Pointers</title>
      <link>https://community.hpe.com/t5/operating-system-openvms/file-pointers/m-p/3590991#M6724</link>
      <description>ram,&lt;BR /&gt;&lt;BR /&gt;The RMS reference manual is at&lt;BR /&gt;&lt;BR /&gt;&lt;A href="http://h71000.www7.hp.com/doc/731FINAL/4523/4523PRO.HTML" target="_blank"&gt;http://h71000.www7.hp.com/doc/731FINAL/4523/4523PRO.HTML&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;which covers all the services and has various&lt;BR /&gt;examples, some in C.&lt;BR /&gt;&lt;BR /&gt;Dave&lt;BR /&gt;</description>
      <pubDate>Thu, 28 Jul 2005 00:44:12 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-openvms/file-pointers/m-p/3590991#M6724</guid>
      <dc:creator>David B Sneddon</dc:creator>
      <dc:date>2005-07-28T00:44:12Z</dc:date>
    </item>
    <item>
      <title>Re: File Pointers</title>
      <link>https://community.hpe.com/t5/operating-system-openvms/file-pointers/m-p/3590992#M6725</link>
      <description>Hi&lt;BR /&gt;RMS programming is not simple and (in this case) can't help.&lt;BR /&gt;Neither fopen(), neither fread() of standard c-runtime doesn't lock record.&lt;BR /&gt;Using of RMS is useful to manage indexed files, not binary/stream flushes.&lt;BR /&gt;Full working example is attached.&lt;BR /&gt; &lt;BR /&gt;Antonio Vigliotti</description>
      <pubDate>Thu, 28 Jul 2005 01:47:45 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-openvms/file-pointers/m-p/3590992#M6725</guid>
      <dc:creator>Antoniov.</dc:creator>
      <dc:date>2005-07-28T01:47:45Z</dc:date>
    </item>
    <item>
      <title>Re: File Pointers</title>
      <link>https://community.hpe.com/t5/operating-system-openvms/file-pointers/m-p/3590993#M6726</link>
      <description>How can I have a look at SYS$EXAMPLES. Am sorry but I am quite new to VMS.&lt;BR /&gt;</description>
      <pubDate>Thu, 28 Jul 2005 02:05:23 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-openvms/file-pointers/m-p/3590993#M6726</guid>
      <dc:creator>ram_47</dc:creator>
      <dc:date>2005-07-28T02:05:23Z</dc:date>
    </item>
    <item>
      <title>Re: File Pointers</title>
      <link>https://community.hpe.com/t5/operating-system-openvms/file-pointers/m-p/3590994#M6727</link>
      <description>$ dir sys$examples:*.c&lt;BR /&gt;&lt;BR /&gt;will list all the C programs.&lt;BR /&gt;&lt;BR /&gt;$ type/page sys$examples:alpha_logger.c&lt;BR /&gt;&lt;BR /&gt;will list alpha_logger.c&lt;BR /&gt;&lt;BR /&gt;You may find it easier to look at the examples&lt;BR /&gt;in the documentation.&lt;BR /&gt;&lt;BR /&gt;Dave</description>
      <pubDate>Thu, 28 Jul 2005 02:09:08 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-openvms/file-pointers/m-p/3590994#M6727</guid>
      <dc:creator>David B Sneddon</dc:creator>
      <dc:date>2005-07-28T02:09:08Z</dc:date>
    </item>
    <item>
      <title>Re: File Pointers</title>
      <link>https://community.hpe.com/t5/operating-system-openvms/file-pointers/m-p/3590995#M6728</link>
      <description>Hi RAM,&lt;BR /&gt;SYS$EXAMPLES is a logical name; you can think to this like a mapped disk of windows. You can simply type&lt;BR /&gt;DIR SYS$EXAMPLES:*.C&lt;BR /&gt;However, I don't think you can solve your dubt.&lt;BR /&gt;Would you see some RMS source code?&lt;BR /&gt; &lt;BR /&gt;Antonio Vigliotti&lt;BR /&gt;</description>
      <pubDate>Thu, 28 Jul 2005 02:09:38 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-openvms/file-pointers/m-p/3590995#M6728</guid>
      <dc:creator>Antoniov.</dc:creator>
      <dc:date>2005-07-28T02:09:38Z</dc:date>
    </item>
    <item>
      <title>Re: File Pointers</title>
      <link>https://community.hpe.com/t5/operating-system-openvms/file-pointers/m-p/3590996#M6729</link>
      <description>The binary files that am talking about are Indexed RMS VMS binary file.</description>
      <pubDate>Thu, 28 Jul 2005 02:11:36 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-openvms/file-pointers/m-p/3590996#M6729</guid>
      <dc:creator>ram_47</dc:creator>
      <dc:date>2005-07-28T02:11:36Z</dc:date>
    </item>
    <item>
      <title>Re: File Pointers</title>
      <link>https://community.hpe.com/t5/operating-system-openvms/file-pointers/m-p/3590997#M6730</link>
      <description>Using fsetpos and fgetpos am able to get what I wanted.</description>
      <pubDate>Thu, 28 Jul 2005 02:23:09 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-openvms/file-pointers/m-p/3590997#M6730</guid>
      <dc:creator>ram_47</dc:creator>
      <dc:date>2005-07-28T02:23:09Z</dc:date>
    </item>
    <item>
      <title>Re: File Pointers</title>
      <link>https://community.hpe.com/t5/operating-system-openvms/file-pointers/m-p/3590998#M6731</link>
      <description>When I used those above functions and read records from the file, each time I get an extra record, which is obviously a junk record.&lt;BR /&gt;&lt;BR /&gt;are there any special considerations while using those functions?</description>
      <pubDate>Thu, 28 Jul 2005 02:41:28 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-openvms/file-pointers/m-p/3590998#M6731</guid>
      <dc:creator>ram_47</dc:creator>
      <dc:date>2005-07-28T02:41:28Z</dc:date>
    </item>
    <item>
      <title>Re: File Pointers</title>
      <link>https://community.hpe.com/t5/operating-system-openvms/file-pointers/m-p/3590999#M6732</link>
      <description>Hi Ram,&lt;BR /&gt;attached file is source for RMS files manager I use for some years.&lt;BR /&gt;Sorry, remarks are in Italian language, because I use it for personal purpose.&lt;BR /&gt;Function are like stdio file function. For example, file pointer is declared by&lt;BR /&gt;XFILE *fp;&lt;BR /&gt;--------------------------------- &lt;BR /&gt;Function are:&lt;BR /&gt; &lt;BR /&gt;fp = xopen(filename, mode);&lt;BR /&gt;open a RMS file; mode may be r,w,b,a that means Read only, Write only, Both (read &amp;amp; write), Append.&lt;BR /&gt;File pointer is null RMS file can't be opened.&lt;BR /&gt; &lt;BR /&gt;xclose(fp);&lt;BR /&gt;close a RMS file.&lt;BR /&gt; &lt;BR /&gt;buf_prt = xread (buf_ptr, key_str_ptr, index, max_bytes, fp); &lt;BR /&gt;read a record from file opened by xopen  with exact key. Main index is 0. If function can't read, returns null.&lt;BR /&gt; &lt;BR /&gt;buf_prt = xseek (buf_ptr, key_str_ptr, index, max_bytes, fp); &lt;BR /&gt;read a record from file opened by xopen with key greater of equal. Main index is 0. If function can't read, returns null.&lt;BR /&gt; &lt;BR /&gt;buf_prt = xnext (buf_ptr, fp); &lt;BR /&gt;read a next record after xread o xseek.If function can't read, returns null.&lt;BR /&gt; &lt;BR /&gt;bytes = xwrite (buf_ptr, max_bytes, fp); &lt;BR /&gt;write a new record into file opened by xopen.&lt;BR /&gt; &lt;BR /&gt;bytes = xrewrite (buf_ptr, max_bytes, fp); &lt;BR /&gt;rewrite a record after xread.&lt;BR /&gt; &lt;BR /&gt;BOOL = xdelete (fp); &lt;BR /&gt;delete current record after xread.&lt;BR /&gt; &lt;BR /&gt;Antonio Vigliotti&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Thu, 28 Jul 2005 02:48:45 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-openvms/file-pointers/m-p/3590999#M6732</guid>
      <dc:creator>Antoniov.</dc:creator>
      <dc:date>2005-07-28T02:48:45Z</dc:date>
    </item>
    <item>
      <title>Re: File Pointers</title>
      <link>https://community.hpe.com/t5/operating-system-openvms/file-pointers/m-p/3591000#M6733</link>
      <description>Hi,&lt;BR /&gt;here there is xfile.h to compile previous file.&lt;BR /&gt;I forgot some other functions:&lt;BR /&gt; &lt;BR /&gt;settmo (fp, timeout);&lt;BR /&gt;set time-out when read locked record.&lt;BR /&gt; &lt;BR /&gt;setlmode (fp, mode);&lt;BR /&gt;set lock mode; mode may be r for Read (record is not locked by xread o xseek) or w for Write (record is locked).&lt;BR /&gt; &lt;BR /&gt;errc = xerror (fp);&lt;BR /&gt;return last error code.&lt;BR /&gt; &lt;BR /&gt;Antonio Vigliotti&lt;BR /&gt;</description>
      <pubDate>Thu, 28 Jul 2005 02:52:46 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-openvms/file-pointers/m-p/3591000#M6733</guid>
      <dc:creator>Antoniov.</dc:creator>
      <dc:date>2005-07-28T02:52:46Z</dc:date>
    </item>
    <item>
      <title>Re: File Pointers</title>
      <link>https://community.hpe.com/t5/operating-system-openvms/file-pointers/m-p/3591001#M6734</link>
      <description>Antonio, parhaps you could make your library of routines available as freeware on Hunter Goatley's fileserv site and/or the next VMS Freeware collection. All software greatfully accepted - they even take some of mine :-)</description>
      <pubDate>Thu, 28 Jul 2005 03:24:20 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-openvms/file-pointers/m-p/3591001#M6734</guid>
      <dc:creator>Ian Miller.</dc:creator>
      <dc:date>2005-07-28T03:24:20Z</dc:date>
    </item>
    <item>
      <title>Re: File Pointers</title>
      <link>https://community.hpe.com/t5/operating-system-openvms/file-pointers/m-p/3591002#M6735</link>
      <description>Ian,&lt;BR /&gt;how can I made it?&lt;BR /&gt;Have I translate remarks?&lt;BR /&gt; &lt;BR /&gt;Antonio Vigliotti&lt;BR /&gt;</description>
      <pubDate>Thu, 28 Jul 2005 03:58:02 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-openvms/file-pointers/m-p/3591002#M6735</guid>
      <dc:creator>Antoniov.</dc:creator>
      <dc:date>2005-07-28T03:58:02Z</dc:date>
    </item>
    <item>
      <title>Re: File Pointers</title>
      <link>https://community.hpe.com/t5/operating-system-openvms/file-pointers/m-p/3591003#M6736</link>
      <description>Hi Antonio,&lt;BR /&gt;&lt;BR /&gt;Thanks for the source. I need to look at those files at leisure as they seem to be complex :)</description>
      <pubDate>Thu, 28 Jul 2005 04:08:03 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-openvms/file-pointers/m-p/3591003#M6736</guid>
      <dc:creator>ram_47</dc:creator>
      <dc:date>2005-07-28T04:08:03Z</dc:date>
    </item>
    <item>
      <title>Re: File Pointers</title>
      <link>https://community.hpe.com/t5/operating-system-openvms/file-pointers/m-p/3591004#M6737</link>
      <description>Anonito, go to &lt;BR /&gt;&lt;A href="http://www.process.com/openvms/index.html" target="_blank"&gt;http://www.process.com/openvms/index.html&lt;/A&gt;&lt;BR /&gt;for more info on fileserv. email Hunter Goatley (address on that web page) as he is very helpful and will explain packaging requirements.&lt;BR /&gt;&lt;BR /&gt;For VMS freeware go to&lt;BR /&gt;&lt;A href="http://h71000.www7.hp.com/openvms/freeware/cd_guide.html" target="_blank"&gt;http://h71000.www7.hp.com/openvms/freeware/cd_guide.html&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Thu, 28 Jul 2005 04:54:47 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-openvms/file-pointers/m-p/3591004#M6737</guid>
      <dc:creator>Ian Miller.</dc:creator>
      <dc:date>2005-07-28T04:54:47Z</dc:date>
    </item>
  </channel>
</rss>

