I am currently developing a CGI program (using RPG) which will output an email which contains a URL to another program which allows the user to click on the link to easliy access the program. I have got the RPG program woorking fine and the email is generated however the only hicup is that i have had to hardcode the URL into the program so that it can be written to the email contents.
My dilema now is that when i move the program between three different evironments (development, quality, and production) i am required to change the hardcoded section of code. I have been playing around with C procedures and trying to implement these within the RPG to try and retrieve the IP address of hostname, however i am struggling to find a solution as everything i have come across needs one to retrieve the other (ie need IP address to retrive the host name and vice versa). Is there a procedure that API which i can use which will simply identify the HOSTNAME or IP Address for the AS400.
The three environments are located to two separate machines, development and quality on one machine and production on another, obviously there are two difference IP address for the two machines and the only difference between the development and quality URL's is that the Quality URL contains a port number, i have determine who to extract the port number being used, am just struggling on the IP address or host name.
Any help would be greatly appreciated.
Thanks in advance.