Earlier this year, I created a no-charge sockets library for the iSeries. This library is named iSockets and is being used by some iSeries shops to access remote Web services from within their own RPG IV programs.
Recently, several users expressed an interest in modifying the code in iSockets to suit their custom requirements. To satisfy these requirements, I recently posted an update to iSockets on its Web site, iSockets.net.
The users wanted the ability to, with a single call to iSockets, access their remote Web services partner and receive the information into an RPG IV field.
The original version of iSockets allowed this but was restricted to some arbitrary length on the returned value. The updated version has eliminated the length restriction by requiring the address of a variable to be specified as a parameter instead of the parameter itself. This allows you to use %ALLOC() or other methods to allocate storage and pass that storage location (which could also be a memory-map file) to the procedure.
Here's the simplified code:
D szHTML S 4000A
D szBytesRtn S 10I 0
/free
nBytesRtn = PostUrldata('www.google.com':
'index.html' : *OMIT:
%addr(szHtml):%size(szHtml) )
/end-free
In this example, I'm pulling the main page from google.com into the RPG field named szHTML. The address of szHTML is passed to the POSTURLDATA subprocedure along with the maximum length that the variable can hold.
The number of iSockets users today is unknown since I don't require registration when you download the *SRVPGM object. But I can tell you it is a worldwide phenomenon—and it's free!
Bob Cozzi is a programmer/consultant, writer/author, and software developer of the RPG xTools, a popular add-on subprocedure library for RPG IV. His book The Modern RPG Language has been the most widely used RPG programming book for nearly two decades. He, along with others, speaks at and runs the highly-popular RPG World conference for RPG programmers.



Business users want new applications now. Market and regulatory pressures require faster application updates and delivery into production. Your IBM i developers may be approaching retirement, and you see no sure way to fill their positions with experienced developers. In addition, you may be caught between maintaining your existing applications and the uncertainty of moving to something new.
IT managers hoping to find new IBM i talent are discovering that the pool of experienced RPG programmers and operators or administrators with intimate knowledge of the operating system and the applications that run on it is small. This begs the question: How will you manage the platform that supports such a big part of your business? This guide offers strategies and software suggestions to help you plan IT staffing and resources and smooth the transition after your AS/400 talent retires. Read on to learn:
LATEST COMMENTS
MC Press Online