- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - OpenVMS
- >
- A Little Help With PHP VMS File Reads
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
тАО12-06-2006 07:46 PM
тАО12-06-2006 07:46 PM
A Little Help With PHP VMS File Reads
If I use file() I just get everything in index 0 of the array.
If I use file_get_contents, there's nothing to show where one record ends and another begins. I'd have to hard-code the record length to read the file properly.
fread() is the closest I get to processing the records, as it carries a LF through into the resultant data.
When I try these out on variable length files, I get NULL, ETX (End Of Text), NULL between the records.
Does anyone have any sample scripts, or can tell me the proper method of reading both fixed-length and variable length files by record?
Thanks, Rob.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО12-06-2006 09:11 PM
тАО12-06-2006 09:11 PM
Re: A Little Help With PHP VMS File Reads
manual, but I'd be pretty amazed if it had
the ability to deal well with any file format
other than sequential (with Stream_LF records
being the safest).
I'd guess that you're just seeing the byte
stream, which is not what you'd want on the
more exotic file formats.
Perhaps you could use the "system" function
to run a real (RMS-aware) program which could
do the I/O and pass the data back.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО12-06-2006 09:16 PM
тАО12-06-2006 09:16 PM
Re: A Little Help With PHP VMS File Reads
Wim (1 year and 7 days without PHP)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО12-06-2006 09:17 PM
тАО12-06-2006 09:17 PM
Re: A Little Help With PHP VMS File Reads
But I would go for the solution of Steven. You can even use DCL.
Wim (1 year and 7 days without PHP)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО12-06-2006 09:22 PM
тАО12-06-2006 09:22 PM
Re: A Little Help With PHP VMS File Reads
If you can tell me where I can get a free VMS ODBC driver for RMS , I'd be happy to try that.
Rob.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО12-06-2006 10:52 PM
тАО12-06-2006 10:52 PM
Re: A Little Help With PHP VMS File Reads
>> I'm trying to use PHP to read an index, fixed-length file.
I think you mean an "RMS Indexed file with fixed length records", not an index, not a fixed length file like you wrote. Correct?
To be sure can you post a reply with DIR/FULL output included or attached?
RMS Indexed file _can_ contain just text, but in a pinch contain 'binary' data such that inserting arbetrary record seperators would be silly. No sequence would be safe, some just more likely to be safe. It would need a record size mechanisme or something. So slurping the file with file_get_contents should never work (imho) for variable length records. For fixed length records, as long as you can figure out, or just know, the record length the program knows how to interpret the buffer as multiple record-sizes chunks.
The 'file' interface however promisses to return a record per aray element. I'm surprised to learn it does not.
My guess is that it was (accidently) told that it should not make record boundaries visible. In RMS terms that would be record-attributes = NONE. Try changing that to indicate record boundaries are meaningfull by using: $ set file/attr=rat=cr ...
(to set back: $ set file/attr=rat=none ...)
If I am right, and we are talking about rms indexed files, then going ODBC would be insane (just mho). Why build up a whole stack of relation access methods to get the plain data whne that data is plainly accessible on the box?! Call out to a simple C program calling RMS SYS$GET, SPAWN a task to convert the data to a stream_lf file, or use DCL to access indexed file records.
>> We're talking about reading thousands of records, so DCL or running a shell command is not an option - that's why I'm trying to do this in PHP!
Are you sure? Did you try? The RMS indexed file access code is thousands of instructions per record. A few hunderd more from DCL vs a few dozen more for a C program might not make that much difference. Adding an odcb layer (with client server architecture?) will add multipel thousands of instruction of overhead per record... probably much more than DCL. For simple read-read-read, DCL will do fine, and it can doe keyed reads as well. The main overhead it does is to call translate-logical on the stream name every time again.
>> If you can tell me where I can get a free VMS ODBC driver for RMS , I'd be happy to try that.
Try DCL first. It's free.
Regards,
Hein van den Heuvel
HvdH Performance Consulting.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО12-07-2006 02:50 AM
тАО12-07-2006 02:50 AM
Re: A Little Help With PHP VMS File Reads
solution when the whole problem is not known,
but consider that it's possible to write a
C (or other language) program which can read
an RMS indexed file, do some work, and spew
HTML. Such a program could do a good deal of
(potentially efficient) file I/O with only
one process creation.
Many things are possible.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО12-07-2006 08:52 AM
тАО12-07-2006 08:52 AM
Re: A Little Help With PHP VMS File Reads
There are 2 examples on http://vmspython.dyndns.org/
JF
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО12-07-2006 09:52 AM
тАО12-07-2006 09:52 AM
Re: A Little Help With PHP VMS File Reads
A DCL command does not create another process. Some DCL commands like the OPEN/READ/WRITE/CLOSE do not even activate a program. Doing this type of file access in DCL is not that bad performancewise.
/Guenther
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО09-03-2007 03:28 AM
тАО09-03-2007 03:28 AM
Re: A Little Help With PHP VMS File Reads
Just joking of course.
There are mutterings that future versions of PHP may have RMS support in them, but I may not be around long enough to see it.
Rob.