|
Any ideas? Are these functions no longer supported? I called IBM support and he could not find ANY references to these functions at all. Is there a better way to access the IFS from RPG?
These functions are still supported. They're part of the ILE C runtime library, not system APIs. But, they're definitely supported in the context of ILE C -- though IBM probably doesn't expect people to call them from RPG.
Here's a link to the refence manual in the V5R3 info center where it documents those functions:
http://publib.boulder.ibm.com/infocenter/iseries/v5r3/ic2924/books/sc415607.pdfAlso, I use those functions every day from my RPG programs (albeit, I have my own prototypes, I didn't even realize that Jef had done an article on them!) I don't have any problems.
I suspect that you're somehow corrupting memory. Maybe by specifying a size incorrectly like Barbara suggested, but maybe some other way. Hard to know without seeing the code.
Is there a "better" way? Define "better.". There's a different way -- using the Unix-type APIs. This might be "better" in that they're system APIs, so IBM supports them across all ILE languages. However, there's no equivalent to fgets() for reading CR/LF terminated strings, so you have to roll your own. Also, the fopen/fgets, etc APIs will buffer the data as it's read, which greatly improves performance on sequential reads, whereas the POSIX APIs do not. So, I guess it really depends on what you're doing.
Regarding your other question about large file support... the O_LARGEFILE keyword tells the system to use 64-bit structures when the file is opened. Calling open64() actually does the same thing -- it sets the O_LARGEFILE flag for you, so you don't have to add it to the open. Otherwise, open64() and open() are identical.
When you do that, the parameters to read() and write() do not change. They do not use 64-bit numbers. Do you really need to read more than 2gb in a single call to read()?! Or write more than 2gb in a single call to write()? Don't forget, you can call those APIs in a loop.. you don't have to load everything into memory at once!
But, if you do want to access the whole stream file as a block of memory, you might try using mmap().
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.