First, you need to load the REXXINET.DLL add-on as so:
OPTIONS "C_CALL" LIBRARY rexxinet
Next, you should set the InetErr and InetHeading variables for how you would like error handling. Here we set them so that RexxInet functions raise an ERROR condition when they fail, and the name of the Inet function that failed is prepended to the error message.
InetErr = "ERROR" InetHeading = 1Finally, you need to call InetOpen to initialize RexxInet in preparation of calling some of its other functions. Because we've set the RexxInet functions to raise ERROR, then we can CATCH it for any problem:
DO InetOpen() /* If InetOpen fails, we do the following. */ CATCH ERROR /* Display an error message box, and end the script. */ CONDITION("M") RETURN END
If you think that RexxINet can connect to the internet without knowing anything about the enduser's internet access, think again. The good news is that, if the user has already setup his computer for internet access, then you're all set. In other words, if he's got Internet Explorer (or some other internet software that knows how to properly save its settings to the Window registry) setup and working with his internet provider, then RexxInet will find those settings and be able to utilize them.
The bad news is that, if the user doesn't already have his computer setup for internet access, or if you need to deal with something called "proxy servers", then you may have a bit more hassle getting a connection to the internet. (For proxy servers, see the notes in InetOpen).
We'll assume that the user's computer is setup, and proxy servers are not needed. It is best to put all of the above at the start of your script, since this needs to be done once only. Any child scripts you call will not need to duplicate the above initialization. So, you need do the above only at the start of your main script (and your child scripts will be able to call Inet functions too).