<?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: Indexed files  and c++ in Operating System - OpenVMS</title>
    <link>https://community.hpe.com/t5/operating-system-openvms/indexed-files-and-c/m-p/4206735#M44076</link>
    <description>It appears you are seeking to port or to interoperate with BASIC code and related files from within a (new or updated) C/C++ application.  Okfine. &lt;BR /&gt;&lt;BR /&gt;You'll probably become familiar with DUMP (or with local code to perform a dump) here, to see exactly what is written into various records, and you'll also get familiar with the padding within records within a C structure.  (See the #pragma member_alignment, for instance.)&lt;BR /&gt;&lt;BR /&gt;As for code, there's a full source example&lt;BR /&gt;&lt;A href="http://64.223.189.234/labsnotes/newuser102.zip" target="_blank"&gt;http://64.223.189.234/labsnotes/newuser102.zip&lt;/A&gt; which has a callable library of RMS operations in C, and record-level operations specifically with indexed files, and declarations and maintenance of record definitions using SDL (if that's of interest), which in aggregate should get you going.&lt;BR /&gt;&lt;BR /&gt;Stephen Hoffman&lt;BR /&gt;HoffmanLabs LLC&lt;BR /&gt;</description>
    <pubDate>Thu, 29 May 2008 03:19:35 GMT</pubDate>
    <dc:creator>Hoff</dc:creator>
    <dc:date>2008-05-29T03:19:35Z</dc:date>
    <item>
      <title>Indexed files  and c++</title>
      <link>https://community.hpe.com/t5/operating-system-openvms/indexed-files-and-c/m-p/4206732#M44073</link>
      <description>Is there a way to open an indexed file in c++ similar to using HPbasic.&lt;BR /&gt; &lt;BR /&gt;For example say we have a simple ddl defined in DDL:MAST.INC &lt;BR /&gt;----------------------------------------------&lt;BR /&gt;DDL:MAST.INC&lt;BR /&gt;----------------------------------------------&lt;BR /&gt;RECORD MAST_REC&lt;BR /&gt;   VARIANT&lt;BR /&gt;    CASE &lt;BR /&gt;      STRING    WHOLE=20 &lt;BR /&gt;    CASE &lt;BR /&gt;       STRING   KEY 0=4&lt;BR /&gt;    CASE &lt;BR /&gt;       STRING   ACCT=4&lt;BR /&gt;       STRING   NA.ME=16&lt;BR /&gt;   END VARIANT&lt;BR /&gt;END RECORD&lt;BR /&gt;&lt;BR /&gt;After converting the data file with an fdl it would be opened in basic like this. &lt;BR /&gt;&lt;BR /&gt;DECLARE LONG CONSTANT MAST.CHAN =22%&lt;BR /&gt;&lt;BR /&gt;INCLUDE "DDL:MAST.INC"&lt;BR /&gt;MAP (MAST_MAP) MAST_REC MAST&lt;BR /&gt;OPEN MAST$DAT FOR INPUT AS FILE #MAST.CHAN, &amp;amp;&lt;BR /&gt;      INDEXED,                              &amp;amp; &lt;BR /&gt;      ACCESS READ,     ALLOW MODIFY,      &amp;amp;&lt;BR /&gt;      MAP MAST_MAP,      BUFFER 4%,         &amp;amp;&lt;BR /&gt;      PRIMARY MAST::KEY0&lt;BR /&gt;&lt;BR /&gt;INPUT "Enter acct ";acct$&lt;BR /&gt;GET #MAST.CHAN, KEY #MAST::KEY0 EQ ACCT$&lt;BR /&gt;IF E%&lt;BR /&gt;THEN    PRINT ERT$(E%)&lt;BR /&gt;        EXIT PROGRAM&lt;BR /&gt;END IF&lt;BR /&gt;PRINT "ACCT= ";MAST::ACCT&lt;BR /&gt;PRINT "NAME= ";MAST::NA.ME&lt;BR /&gt;END PROGRAM&lt;BR /&gt;&lt;BR /&gt;I have searched the web, but have not been able to find much on this. Any help would be much appreciated.</description>
      <pubDate>Wed, 28 May 2008 23:40:49 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-openvms/indexed-files-and-c/m-p/4206732#M44073</guid>
      <dc:creator>Jason_429</dc:creator>
      <dc:date>2008-05-28T23:40:49Z</dc:date>
    </item>
    <item>
      <title>Re: Indexed files  and c++</title>
      <link>https://community.hpe.com/t5/operating-system-openvms/indexed-files-and-c/m-p/4206733#M44074</link>
      <description>Sorry about the formatting, is there a [code] [/code] tag i should be using on this forum ? &lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Wed, 28 May 2008 23:42:49 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-openvms/indexed-files-and-c/m-p/4206733#M44074</guid>
      <dc:creator>Jason_429</dc:creator>
      <dc:date>2008-05-28T23:42:49Z</dc:date>
    </item>
    <item>
      <title>Re: Indexed files  and c++</title>
      <link>https://community.hpe.com/t5/operating-system-openvms/indexed-files-and-c/m-p/4206734#M44075</link>
      <description>&lt;!--!*#--&gt;&amp;gt;&amp;gt; formating&lt;BR /&gt;&lt;BR /&gt;There is a check-box "Retain format(spacing)."&lt;BR /&gt;&lt;BR /&gt;&amp;gt;&amp;gt; Is there a way to open an indexed file in c++ similar to using HPbasic&lt;BR /&gt;&lt;BR /&gt;Typically you would set up a FAB and RAB&lt;BR /&gt;and call RMS directly: SYS$OPEN, SYS$CONNECT, SYS$GET.&lt;BR /&gt;&lt;BR /&gt;Chapter 2 in the C Userguide explains all about the details:&lt;BR /&gt;&lt;A href="http://h71000.www7.hp.com/commercial/c/docs/5492profile_009.html#index_sec" target="_blank"&gt;http://h71000.www7.hp.com/commercial/c/docs/5492profile_009.html#index_sec&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;You would have to create a C - layout for the record. Chapter 5 has a section on CDD and CDDL usage.&lt;BR /&gt;&lt;BR /&gt;But it could be directly re-mapped as:&lt;BR /&gt;&lt;BR /&gt;struct mast_rec {&lt;BR /&gt;   union {&lt;BR /&gt;       char whole[20];&lt;BR /&gt;       char key[4];&lt;BR /&gt;       struct {&lt;BR /&gt;          char act[4];&lt;BR /&gt;          char name[16];&lt;BR /&gt;          } parts;&lt;BR /&gt;        } parts_union;&lt;BR /&gt;      } mast_rec;&lt;BR /&gt;&lt;BR /&gt;Typically you would not need the union as much in C as in Basic. &lt;BR /&gt;C is perfectly happy with &lt;BR /&gt;&lt;BR /&gt;your_rab.rab$l_kbf = mast_rec.acct;&lt;BR /&gt;your_rab.rab$b_ksz = sizeof ( mast_rec.acct );&lt;BR /&gt;&lt;BR /&gt;No need to call it both 'key' and 'acct'&lt;BR /&gt;And this 'whole' just becomes &lt;BR /&gt;address: &amp;amp;mast_rec, with size = sizeof (struct mast_rec);&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Enjoy!&lt;BR /&gt;Hein.&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Thu, 29 May 2008 02:56:07 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-openvms/indexed-files-and-c/m-p/4206734#M44075</guid>
      <dc:creator>Hein van den Heuvel</dc:creator>
      <dc:date>2008-05-29T02:56:07Z</dc:date>
    </item>
    <item>
      <title>Re: Indexed files  and c++</title>
      <link>https://community.hpe.com/t5/operating-system-openvms/indexed-files-and-c/m-p/4206735#M44076</link>
      <description>It appears you are seeking to port or to interoperate with BASIC code and related files from within a (new or updated) C/C++ application.  Okfine. &lt;BR /&gt;&lt;BR /&gt;You'll probably become familiar with DUMP (or with local code to perform a dump) here, to see exactly what is written into various records, and you'll also get familiar with the padding within records within a C structure.  (See the #pragma member_alignment, for instance.)&lt;BR /&gt;&lt;BR /&gt;As for code, there's a full source example&lt;BR /&gt;&lt;A href="http://64.223.189.234/labsnotes/newuser102.zip" target="_blank"&gt;http://64.223.189.234/labsnotes/newuser102.zip&lt;/A&gt; which has a callable library of RMS operations in C, and record-level operations specifically with indexed files, and declarations and maintenance of record definitions using SDL (if that's of interest), which in aggregate should get you going.&lt;BR /&gt;&lt;BR /&gt;Stephen Hoffman&lt;BR /&gt;HoffmanLabs LLC&lt;BR /&gt;</description>
      <pubDate>Thu, 29 May 2008 03:19:35 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-openvms/indexed-files-and-c/m-p/4206735#M44076</guid>
      <dc:creator>Hoff</dc:creator>
      <dc:date>2008-05-29T03:19:35Z</dc:date>
    </item>
  </channel>
</rss>

