- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - OpenVMS
- >
- Re: Find file end block in pascal
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Discussions
Discussions
Forums
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО03-30-2006 12:31 AM
тАО03-30-2006 12:31 AM
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.
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.
Can anyone provide a simple example?
The current code is:
file_fab.fab$v_ufo := true;
open_status := $open (fab := file_fab)
$connect (rab := file_rab);
(* get channel number *)
sec_chan := file_fab.fab$l_stv;
file_size := file_fab.fab$l_alq;
IF file_size > 130 THEN
lib$signal (lin_filetoobig, 2, %stdescr f_name [f_no], file_size);
Thanks
Ken
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО03-30-2006 01:30 AM
тАО03-30-2006 01:30 AM
Re: Find file end block in pascal
Welcome to the VMS forum!
You must use the File Header Characteristic XAB (XABFHC). My Pascal is very rusty so I try to explain:
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.
After the SYS$OPEN service you have:
In the xab$l_ebk you get the end block and in xab$w_ffb the last byte of the file.
Bojan
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО03-30-2006 03:58 AM
тАО03-30-2006 03:58 AM
Re: Find file end block in pascal
How come your are not 100% happy with the result (as suggested by the points)?
Please share and maybe we can help you better.
There are plenty of examples floating around of how to allocate an XAB and hook it up. Google quickly found:
http://h71000.www7.hp.com/wizard/wiz_4996.html
There a standard pascal open is used, the fab address requested, an XAB connected and $display used to ask RMS to fill in details.
It turns out that a default PASCAL open already hooks up an XABFHC, so you could perhaps pre-open and walk fab --> xabfhc --> 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.
http://h71000.www7.hp.com/doc/82final/6140/6140pro_012.html
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)..."
You may also want to check out using a "USER_ACTION" pascal OPEN option to hav the RTL to a maximum of work.
hth,
Hein.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО03-30-2006 04:07 AM
тАО03-30-2006 04:07 AM
Re: Find file end block in pascal
some code using xab$l_ebk/xab$w_ffb in the
Info-ZIP Zip source. Look in (the seldom
used) [.VMS]VMS_IM.C.
http://www.info-zip.org/
http://www.info-zip.org/Zip.html
http://www.info-zip.org/Zip.html#Sources
[...]
Quality not guaranteed, of course.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО03-30-2006 04:09 AM
тАО03-30-2006 04:09 AM
Solutionfile_fab.fab$v_ufo := true;
open_status := $open (fab := file_fab)
$connect (rab := file_rab);
(* get channel number *)
Why do the CONNECT?
That is not needed / wrong.
>> file_size := file_fab.fab$l_alq;
Why bother picking it up from the FAB?
Just set to the max (130) and just let $CRMPSC pick it up and do the right thing?
http://h71000.www7.hp.com/doc/82FINAL/4527/4527pro_028.html
-pagcnt-
"... 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."
fwiw,
Hein.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО03-30-2006 04:42 AM
тАО03-30-2006 04:42 AM
Re: Find file end block in pascal
Sorry if my lack of points enthusiasm was not in line with your expectations.
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.
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).
Please be patient with an "oldie" who is struggling with half-remembered code from earlier times.
I'll follow the suggested links when I get back to the office tomorrow, and then allocate points appropriately.
Ken
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО03-30-2006 04:53 AM
тАО03-30-2006 04:53 AM
Re: Find file end block in pascal
I just used those as a tell tale sign that further help might be in order.
The channel indeed must be passed to $CRMPSC to inform it about which pre-opened file to use.
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.
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.
Or just add one to EBK :-) max it by ALQ
Or don't do any, remove all the check code and use file_size := 130.
2 decade old VMS code huh?
Well, It's like riding a bike :-)
Cheers,
Hein.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО03-30-2006 07:05 PM
тАО03-30-2006 07:05 PM
Re: Find file end block in pascal
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.
The example code I posted is in a user_action routine already.
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.
Hopefully I can manage with 50% of the required assets.
I'll get back after I've had a go at solving the problem.
Thanks,
Ken
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО04-06-2006 09:23 PM
тАО04-06-2006 09:23 PM
Re: Find file end block in pascal
Code now works, and I can forget about vaxen again for a while...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО04-06-2006 09:29 PM
тАО04-06-2006 09:29 PM