<?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: Find file end block in pascal in Operating System - OpenVMS</title>
    <link>https://community.hpe.com/t5/operating-system-openvms/find-file-end-block-in-pascal/m-p/4970802#M33989</link>
    <description>Hein,&lt;BR /&gt;I had found that first link you googled before I posted, but for some reason I was only shown the question and the first part of the answer (not the example code), which would have got me closer, I think.&lt;BR /&gt;The example code I posted is in a user_action routine already.&lt;BR /&gt;I had the required beverage last night (when I had no access to the code), and this morning, I have access to the code, but no beverage.&lt;BR /&gt;Hopefully I can manage with 50% of the required assets.&lt;BR /&gt;I'll get back after I've had a go at solving the problem.&lt;BR /&gt;Thanks,&lt;BR /&gt;Ken</description>
    <pubDate>Fri, 31 Mar 2006 03:05:16 GMT</pubDate>
    <dc:creator>KenAdam</dc:creator>
    <dc:date>2006-03-31T03:05:16Z</dc:date>
    <item>
      <title>Find file end block in pascal</title>
      <link>https://community.hpe.com/t5/operating-system-openvms/find-file-end-block-in-pascal/m-p/4970795#M33982</link>
      <description>In 1984, I wrote some software in VAX Pascal which used fab.fab$l_alq to check the "size" of a binary file I was opening (at that time the cluster size must have been 1 block) which I then mapped to a section (provided it was no more than 130 blocks.&lt;BR /&gt;With new disk drives having larger clusters, I can no longer use the ALQ to get the information and I need to find out which is the end block of the user data.&lt;BR /&gt;I've read the fortran example, but not having used either fortran or VMS for many years, Idon;t quite see how to make it work.&lt;BR /&gt;Can anyone provide a simple example?&lt;BR /&gt;The current code is:&lt;BR /&gt;&lt;BR /&gt;file_fab.fab$v_ufo := true;&lt;BR /&gt;open_status := $open (fab := file_fab)&lt;BR /&gt;$connect (rab := file_rab);&lt;BR /&gt;(* get channel number *)&lt;BR /&gt;sec_chan := file_fab.fab$l_stv;&lt;BR /&gt;file_size := file_fab.fab$l_alq;&lt;BR /&gt;IF file_size &amp;gt; 130 THEN&lt;BR /&gt; lib$signal (lin_filetoobig, 2, %stdescr f_name [f_no], file_size);&lt;BR /&gt;&lt;BR /&gt;Thanks&lt;BR /&gt;Ken</description>
      <pubDate>Thu, 30 Mar 2006 08:31:22 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-openvms/find-file-end-block-in-pascal/m-p/4970795#M33982</guid>
      <dc:creator>KenAdam</dc:creator>
      <dc:date>2006-03-30T08:31:22Z</dc:date>
    </item>
    <item>
      <title>Re: Find file end block in pascal</title>
      <link>https://community.hpe.com/t5/operating-system-openvms/find-file-end-block-in-pascal/m-p/4970796#M33983</link>
      <description>Ken,&lt;BR /&gt;&lt;BR /&gt;Welcome to the VMS forum!&lt;BR /&gt;&lt;BR /&gt;You must use the File Header Characteristic XAB (XABFHC). My Pascal is very rusty so I try to explain:&lt;BR /&gt;Allocate an XABFHC block and initialise it. Then point to this block from the FAB block filling the fab$l_xab with the address of the XABFHC block.&lt;BR /&gt;After the SYS$OPEN service you have:&lt;BR /&gt;In the xab$l_ebk you get the end block and in xab$w_ffb the last byte of the file.&lt;BR /&gt;&lt;BR /&gt;Bojan</description>
      <pubDate>Thu, 30 Mar 2006 09:30:58 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-openvms/find-file-end-block-in-pascal/m-p/4970796#M33983</guid>
      <dc:creator>Bojan Nemec</dc:creator>
      <dc:date>2006-03-30T09:30:58Z</dc:date>
    </item>
    <item>
      <title>Re: Find file end block in pascal</title>
      <link>https://community.hpe.com/t5/operating-system-openvms/find-file-end-block-in-pascal/m-p/4970797#M33984</link>
      <description>Bojan outlines the right technique.&lt;BR /&gt;How come your are not 100% happy with the result (as suggested by the points)?&lt;BR /&gt;Please share and maybe we can help you better.&lt;BR /&gt;&lt;BR /&gt;There are plenty of examples floating around of how to allocate an XAB and hook it up. Google quickly found:&lt;BR /&gt;&lt;A href="http://h71000.www7.hp.com/wizard/wiz_4996.html" target="_blank"&gt;http://h71000.www7.hp.com/wizard/wiz_4996.html&lt;/A&gt;&lt;BR /&gt;There a standard pascal open is used, the fab address requested, an XAB connected and $display used to ask RMS to fill in details.&lt;BR /&gt;&lt;BR /&gt;It turns out that a default PASCAL open already hooks up an XABFHC, so you could perhaps pre-open and walk fab --&amp;gt; xabfhc --&amp;gt; xab$l_ebk. Then close and re-open with UFO. The overhead would be minimal, as everything will be in cache, and you'll get the standard PASCAL IO error handling for free to deal with simple File-not-found, Locking and protections problems.&lt;BR /&gt;&lt;BR /&gt;&lt;A href="http://h71000.www7.hp.com/doc/82final/6140/6140pro_012.html" target="_blank"&gt;http://h71000.www7.hp.com/doc/82final/6140/6140pro_012.html&lt;/A&gt;&lt;BR /&gt;FAB$L_XAB : "The XAB chain always has a File Header Characteristics (FHC) extended attribute block in order to get the longest record length (XAB$W_LRL)..."&lt;BR /&gt;&lt;BR /&gt;You may also want to check out using a "USER_ACTION" pascal OPEN option to hav the RTL to a maximum of work.&lt;BR /&gt;&lt;BR /&gt;hth,&lt;BR /&gt;Hein.&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Thu, 30 Mar 2006 11:58:07 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-openvms/find-file-end-block-in-pascal/m-p/4970797#M33984</guid>
      <dc:creator>Hein van den Heuvel</dc:creator>
      <dc:date>2006-03-30T11:58:07Z</dc:date>
    </item>
    <item>
      <title>Re: Find file end block in pascal</title>
      <link>https://community.hpe.com/t5/operating-system-openvms/find-file-end-block-in-pascal/m-p/4970798#M33985</link>
      <description>If you like C better than Fortran, there is&lt;BR /&gt;some code using xab$l_ebk/xab$w_ffb in the&lt;BR /&gt;Info-ZIP Zip source.  Look in (the seldom&lt;BR /&gt;used) [.VMS]VMS_IM.C.&lt;BR /&gt;&lt;BR /&gt;&lt;A href="http://www.info-zip.org/" target="_blank"&gt;http://www.info-zip.org/&lt;/A&gt;&lt;BR /&gt;&lt;A href="http://www.info-zip.org/Zip.html" target="_blank"&gt;http://www.info-zip.org/Zip.html&lt;/A&gt;&lt;BR /&gt;&lt;A href="http://www.info-zip.org/Zip.html#Sources" target="_blank"&gt;http://www.info-zip.org/Zip.html#Sources&lt;/A&gt;&lt;BR /&gt;[...]&lt;BR /&gt;&lt;BR /&gt;Quality not guaranteed, of course.</description>
      <pubDate>Thu, 30 Mar 2006 12:07:00 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-openvms/find-file-end-block-in-pascal/m-p/4970798#M33985</guid>
      <dc:creator>Steven Schweda</dc:creator>
      <dc:date>2006-03-30T12:07:00Z</dc:date>
    </item>
    <item>
      <title>Re: Find file end block in pascal</title>
      <link>https://community.hpe.com/t5/operating-system-openvms/find-file-end-block-in-pascal/m-p/4970799#M33986</link>
      <description>Some more thoughts...&lt;BR /&gt;&lt;BR /&gt;file_fab.fab$v_ufo := true;&lt;BR /&gt;open_status := $open (fab := file_fab)&lt;BR /&gt;$connect (rab := file_rab);&lt;BR /&gt;(* get channel number *)&lt;BR /&gt;&lt;BR /&gt;Why do the CONNECT?&lt;BR /&gt;That is not needed / wrong.&lt;BR /&gt;&lt;BR /&gt;&amp;gt;&amp;gt; file_size := file_fab.fab$l_alq;&lt;BR /&gt;&lt;BR /&gt;Why bother picking it up from the FAB?&lt;BR /&gt;Just set to the max (130) and just let $CRMPSC pick it up and do the right thing?&lt;BR /&gt;&lt;BR /&gt;&lt;A href="http://h71000.www7.hp.com/doc/82FINAL/4527/4527pro_028.html" target="_blank"&gt;http://h71000.www7.hp.com/doc/82FINAL/4527/4527pro_028.html&lt;/A&gt;&lt;BR /&gt;-pagcnt-&lt;BR /&gt;"... the specified page count is compared with the number of blocks in the section file; if they are different, the lower value is used. If you do not specify the page count or specify it as 0 (the default), the size of the section file is used."&lt;BR /&gt;&lt;BR /&gt;fwiw,&lt;BR /&gt;Hein.&lt;BR /&gt;</description>
      <pubDate>Thu, 30 Mar 2006 12:09:42 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-openvms/find-file-end-block-in-pascal/m-p/4970799#M33986</guid>
      <dc:creator>Hein van den Heuvel</dc:creator>
      <dc:date>2006-03-30T12:09:42Z</dc:date>
    </item>
    <item>
      <title>Re: Find file end block in pascal</title>
      <link>https://community.hpe.com/t5/operating-system-openvms/find-file-end-block-in-pascal/m-p/4970800#M33987</link>
      <description>Guys,&lt;BR /&gt;Sorry if my lack of points enthusiasm was not in line with your expectations.&lt;BR /&gt;As I mentioned I wrote the code in 1984, last modifed it in anyway in 1988, and have not used or seen a VAX in several years.&lt;BR /&gt;I was asking for a pascal example fo how to resolve the issue - I've been asked to find a solution as the original author, but I am so out of touch with the VAX stuff (I only work in Delphi these days) that I need some help with the specific code to write. The old code used the channel number as part of allocating the section (but after 20 years I don't know why I came to that conclusion).&lt;BR /&gt;Please be patient with an "oldie" who is struggling with half-remembered code from earlier times.&lt;BR /&gt;I'll follow the suggested links when I get back to the office tomorrow, and then allocate points appropriately.&lt;BR /&gt;Ken&lt;BR /&gt;</description>
      <pubDate>Thu, 30 Mar 2006 12:42:34 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-openvms/find-file-end-block-in-pascal/m-p/4970800#M33987</guid>
      <dc:creator>KenAdam</dc:creator>
      <dc:date>2006-03-30T12:42:34Z</dc:date>
    </item>
    <item>
      <title>Re: Find file end block in pascal</title>
      <link>https://community.hpe.com/t5/operating-system-openvms/find-file-end-block-in-pascal/m-p/4970801#M33988</link>
      <description>Not to worry about the points themself, we have plenty of those to spare :-).&lt;BR /&gt;I just used those as a tell tale sign that further help might be in order. &lt;BR /&gt;&lt;BR /&gt;The channel indeed must be passed to $CRMPSC to inform it about which pre-opened file to use.&lt;BR /&gt;&lt;BR /&gt;I suspect that between your old code, Bojan's directions, the 'wizard' example, and an adult beverage, you can figure out how to get to XAB$L_EBK in the XABFHC.&lt;BR /&gt;&lt;BR /&gt;Free advice... also check for XAB$W_FFB, to deal with EOF = byte 512 in block 1 versus byte 0 in block 2 if you catch my drift.&lt;BR /&gt;Or just add one to EBK :-) max it by ALQ&lt;BR /&gt;&lt;BR /&gt;Or don't do any, remove all the check code and use file_size := 130.&lt;BR /&gt;&lt;BR /&gt;2 decade old VMS code huh?&lt;BR /&gt;Well, It's like riding a bike :-)&lt;BR /&gt;&lt;BR /&gt;Cheers,&lt;BR /&gt;Hein.&lt;BR /&gt;</description>
      <pubDate>Thu, 30 Mar 2006 12:53:44 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-openvms/find-file-end-block-in-pascal/m-p/4970801#M33988</guid>
      <dc:creator>Hein van den Heuvel</dc:creator>
      <dc:date>2006-03-30T12:53:44Z</dc:date>
    </item>
    <item>
      <title>Re: Find file end block in pascal</title>
      <link>https://community.hpe.com/t5/operating-system-openvms/find-file-end-block-in-pascal/m-p/4970802#M33989</link>
      <description>Hein,&lt;BR /&gt;I had found that first link you googled before I posted, but for some reason I was only shown the question and the first part of the answer (not the example code), which would have got me closer, I think.&lt;BR /&gt;The example code I posted is in a user_action routine already.&lt;BR /&gt;I had the required beverage last night (when I had no access to the code), and this morning, I have access to the code, but no beverage.&lt;BR /&gt;Hopefully I can manage with 50% of the required assets.&lt;BR /&gt;I'll get back after I've had a go at solving the problem.&lt;BR /&gt;Thanks,&lt;BR /&gt;Ken</description>
      <pubDate>Fri, 31 Mar 2006 03:05:16 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-openvms/find-file-end-block-in-pascal/m-p/4970802#M33989</guid>
      <dc:creator>KenAdam</dc:creator>
      <dc:date>2006-03-31T03:05:16Z</dc:date>
    </item>
    <item>
      <title>Re: Find file end block in pascal</title>
      <link>https://community.hpe.com/t5/operating-system-openvms/find-file-end-block-in-pascal/m-p/4970803#M33990</link>
      <description>The simplest answer for me was to set the size when creating the section.&lt;BR /&gt;Code now works, and I can forget about vaxen again for a while...</description>
      <pubDate>Fri, 07 Apr 2006 04:23:11 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-openvms/find-file-end-block-in-pascal/m-p/4970803#M33990</guid>
      <dc:creator>KenAdam</dc:creator>
      <dc:date>2006-04-07T04:23:11Z</dc:date>
    </item>
    <item>
      <title>Re: Find file end block in pascal</title>
      <link>https://community.hpe.com/t5/operating-system-openvms/find-file-end-block-in-pascal/m-p/4970804#M33991</link>
      <description>Solution already noted (didn't realise that I should close and noted in one action)</description>
      <pubDate>Fri, 07 Apr 2006 04:29:59 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-openvms/find-file-end-block-in-pascal/m-p/4970804#M33991</guid>
      <dc:creator>KenAdam</dc:creator>
      <dc:date>2006-04-07T04:29:59Z</dc:date>
    </item>
  </channel>
</rss>

