- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - OpenVMS
- >
- Emulating locks created by a BASIC program in C/C+...
Operating System - OpenVMS
1753328
Members
5030
Online
108792
Solutions
Forums
Categories
Company
Local Language
юдл
back
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
юдл
back
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
Blogs
Information
Community
Resources
Community Language
Language
Forums
Blogs
Go to solution
Topic Options
- 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
тАО08-22-2007 04:35 AM
тАО08-22-2007 04:35 AM
Well, it's time to get to the crux of the matter. We have several hundred programs, each statically compiled at various dates with no chance of recompiling them all without opening a whole can of worms. Some of the key routines managing the access to the fixed-length 512 byte record files that they share are still written in BASIC because we have not figured out how to make compatible locks in C++.
So my question is, how do I emulate the locks that BASIC makes in C or C++? I have attached a test program to reproduce the kind of access performed by our BASIC routines.
I remember trying to make this work many years ago for a different project using sys$qio + sys$enq and failed. My hazy recollection is that the locks didn't match those created by BASIC, so the experiment failed. I'm anxious not to make the same mistake this time.
Thanks,
Ben
So my question is, how do I emulate the locks that BASIC makes in C or C++? I have attached a test program to reproduce the kind of access performed by our BASIC routines.
I remember trying to make this work many years ago for a different project using sys$qio + sys$enq and failed. My hazy recollection is that the locks didn't match those created by BASIC, so the experiment failed. I'm anxious not to make the same mistake this time.
Thanks,
Ben
Solved! Go to Solution.
3 REPLIES 3
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО08-22-2007 04:47 AM
тАО08-22-2007 04:47 AM
Solution
Ben,
The locks DO NOT depend on the language. If you are seeing "incompatible" locking, then the two implementations are accessing the files differently.
Using SYS$QIO and SYS$ENQ is most definitely NOT the way to achieve the desired interoperable result.
The desired result will be achieved by using the RMS libraries to access the file. RMS can be invoked implicitly through the C/C++ runtime (which can be cumbersome for other than straight sequential files), or it can be invoked directly, with all of the facilities being fully available.
I am on a break between meetings, so I do not have a chance to go digging through the BASIC documentation. What is needed is to look up and analyze the information about the file organization (as shown in the attached sources) and do the accesses in the same way. It will work.
I have to get ready for my meeting now, if I have been unclear, or can be of additional assistance, please let me know.
- Bob Gezelter, http://www.rlgsc.com
The locks DO NOT depend on the language. If you are seeing "incompatible" locking, then the two implementations are accessing the files differently.
Using SYS$QIO and SYS$ENQ is most definitely NOT the way to achieve the desired interoperable result.
The desired result will be achieved by using the RMS libraries to access the file. RMS can be invoked implicitly through the C/C++ runtime (which can be cumbersome for other than straight sequential files), or it can be invoked directly, with all of the facilities being fully available.
I am on a break between meetings, so I do not have a chance to go digging through the BASIC documentation. What is needed is to look up and analyze the information about the file organization (as shown in the attached sources) and do the accesses in the same way. It will work.
I have to get ready for my meeting now, if I have been unclear, or can be of additional assistance, please let me know.
- Bob Gezelter, http://www.rlgsc.com
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО08-22-2007 04:56 AM
тАО08-22-2007 04:56 AM
Re: Emulating locks created by a BASIC program in C/C++
"organization virtual" ?! Yuck!
Anyway, those are simply RMS Fixed Length record files with RMS Record access services: SYS$GET, SYS$PUT (with RAB$V_UIF... double yuck)
>> So my question is, how do I emulate the locks that BASIC makes in C or C++? I
You don't emulate.
You just use direct calls to RMS to access the file/record.
SYS$OPEN... SYS$GET... SYS$PUT.
No ifs, else, or buts about it.
(I'll be happy to consult on details as needed :-)
Hope this helps some,
Hein van den Heuvel (at gmail dot com)
HvdH Performance Consulting
Anyway, those are simply RMS Fixed Length record files with RMS Record access services: SYS$GET, SYS$PUT (with RAB$V_UIF... double yuck)
>> So my question is, how do I emulate the locks that BASIC makes in C or C++? I
You don't emulate.
You just use direct calls to RMS to access the file/record.
SYS$OPEN... SYS$GET... SYS$PUT.
No ifs, else, or buts about it.
(I'll be happy to consult on details as needed :-)
Hope this helps some,
Hein van den Heuvel (at gmail dot com)
HvdH Performance Consulting
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО08-22-2007 04:57 AM
тАО08-22-2007 04:57 AM
Re: Emulating locks created by a BASIC program in C/C++
Thanks for the clarification. As I said, it *was* a different project with different goals in mind (qio was a requirement for that project,) and it was many years ago. I wasn't even thinking of trying the same thing today. That being said, the memory of that earlier failure was making me feel a bit leery of tackling locks again.
In any event, I think I may have already answered my own question using the OpenVMS Freeware 'findlocks' utility and the test program supplied by David Jones as a response to my earlier inquiry:
http://forums1.itrc.hp.com/service/forums/questionanswer.do?threadId=1153251
If I run test.bas to lock a block in block.tmp, I see it the lock for vbn=1, id=0. Then I run David's bio_test.c and see it block on the lock until I press Enter to release it. Success!
So I'm feeling much better about proceeding now. Many thanks to everyone who has helped bring me this far.
Ben
In any event, I think I may have already answered my own question using the OpenVMS Freeware 'findlocks' utility and the test program supplied by David Jones as a response to my earlier inquiry:
http://forums1.itrc.hp.com/service/forums/questionanswer.do?threadId=1153251
If I run test.bas to lock a block in block.tmp, I see it the lock for vbn=1, id=0. Then I run David's bio_test.c and see it block on the lock until I press Enter to release it. Success!
So I'm feeling much better about proceeding now. Many thanks to everyone who has helped bring me this far.
Ben
The opinions expressed above are the personal opinions of the authors, not of Hewlett Packard Enterprise. By using this site, you accept the Terms of Use and Rules of Participation.
News and Events
Support
© Copyright 2024 Hewlett Packard Enterprise Development LP