× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



Scott here are the values of the fields you requested.

GDATAPTR SPP: CD2C4C89050057D0
GDATAPTRSIZE 10240
GHANDLE 5

I removed the S_xxx.

Here is the section of code you might what to see:

// Read file to a pointer and write out that pointers contents
gDataPtr = %alloc(gDataPtrSize);
gBase64Ptr = %alloc(gDataPtrSize*2);
gBase64PtrSize = gDataPtrSize*2;
dou gBytes < 1;

gBytes = read(gHandle: gDataPtr: gDataPtrSize);
if gBytes > 0;
gEncDataLen =
Base64_encode(gDataPtr: gBytes: gBase64Ptr: gBase64PtrSize);
stdOut1(gBase64Ptr: gEncDataLen: qusec);
endif;
enddo;
dealloc gDataPtr;
dealloc gBase64Ptr;
gRC = close(gHandle);


Bruce "Hoss" Collins
Project Leader/System i Administration
AAA Cooper Transportation
(334) 671-3106




-----Original Message-----
From: midrange-l-bounces@xxxxxxxxxxxx [mailto:midrange-l-
bounces@xxxxxxxxxxxx] On Behalf Of Scott Klement
Sent: Wednesday, April 30, 2008 7:06 PM
To: Midrange Systems Technical Discussion
Subject: Re: Reading From an NFS

Hello Hoss,

When I open the file it returns a handle gHandle =
open(%trim(fnwithdir): O_RDONLY: S_IRWXU + S_IRWXG + S_IRWXO);

This isn't the problem, but... just a note: the S_xxx flags are not
going to be used in the above example. The S_xxx flags are only used
if
you specify O_CREAT. So the following code would be identical to what
you have:

gHandle = open(%trim(fnwithdir): O_RDONLY);


When I read the file gBytes is 0 Zero. gBytes = read(gHandle:
gDataPtr: gDataPtrSize);

What are gDataPtr and gDataPtrSize? How are they defined? What are
they set to?

Most commonly, an RPG program calling the read() API would look more
like this:

gBytes = read(gHandle: %addr(someVar): %size(someVar));

For certain, you can provide your own pointer and your own size
variable
instead of using a preexisting RPG variable -- but please make sure you
specify valid values for them... If you set them wrong, you could very
well have the issue you're describing (that it can't read the data)

However, aside from that, I don't see anything wrong. I tried your
code
(filling in the blanks as best I could) and was able to successfully
read a file from my NFS server. Granted, my NFS server is running
FreeBSD rather than Windows, but I don't see why that would matter...
--
This is the Midrange Systems Technical Discussion (MIDRANGE-L) mailing
list
To post a message email: MIDRANGE-L@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/midrange-l
or email: MIDRANGE-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at http://archive.midrange.com/midrange-l.



As an Amazon Associate we earn from qualifying purchases.

This thread ...


Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

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.