List,
 
As my e-mails flip between fixed and free, I'll leave that debate to others!
My question is related to pointers and input/output streams: What is the
BEST way to organise your data for writing/reading large amounts to/from an
IFS file/socket/Stdout(in)? subjective? Maybe. But there must be an approach
that is considered to be the most
robust/efficient/manageable/expeditious/...
 
I'll explain: Say I have 200k of data sitting on a pointer and want to write
that to an open file/socket/StdOut. Currently I would use %str - but this
has a limitation of referencing only 64k of data sitting on a pointer. How
do I reference data beyond that? I know I can create an array of pointers
and keep to 64k on each, but that's not the most manageable approach. Should
I simply use a second pointer to perform my write, and use pointer
arithmetic to move it along the data sitting on the first pointer - writing
64k at a time? Is there an easier (more beautiful/elegant) way than this?
 
Conversely, if I read data in from a file/socket/StdIn, and the data
exceeded 64k, how would I reference the data on the pointer beyond the 64k
limit? I know that this is more of a question about pointers but there must
be a lovely little dow/dou/for loop out there that does the business like a
charm.
 
Or should I dump %str completely and use another method of referencing the
data sitting on a pointer?
 
Background: Well, life seems to turn up the most unexpected little projects.
Only last week I was asking about the possibility of writing a HTTP server
in RPG, just so I could get under the covers and have a good look around
(and possibly learn something along the way). Well, on Wednesday (was it
only yesterday?) I was in a meeting discussing possible ways of transferring
data between two of our systems (one on an iSeries, the other on a HP Unix
box). We finally decided on using HTTP POST! So I get to write CGI programs
for the iSeries Apache web server AND I get to write a HTTP client in RPG to
post to the Unix web server. Boy did I smile all the way home yesterday!
Anyway, I have spent the whole of today creating a service program (based on
Scott Kleement's socket tutorial - copyrights and disclaimers still in place
Scott ;-)) to post data to a HTTP server - with the body of the text coming
from either an IFS xml file or directly from a pointer passed by the
application program bound to the service program. So I would love to know a
neat way of reading 64k+ of data from a pointer and sending it straight down
the pipe.
 
On a related note (if you're still reading <grin/>) can you create a socket
connection and leave it open for long periods of time? I would like to allow
the service program to create the socket and connect, but allow many sends
on the current open connection. Is that a good idea? Or should I close the
socket and re-open for every send?
 
Your advice would be most welcome.     
 
Cheers
 
Larry 

This thread ...


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

This mailing list archive is Copyright 1997-2026 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.