Who am I and What this site is about.
I've been working in the midrange world for 30+ years. I've recently retired and I have been looking for something to fill my time. I've decided that one use for that time would be to try and put some of the knowledge and experience i've gained here in order that it would benefit others. I started in the mid eighties programming on PCs in a language called Workstation Basic. It was essentially a translation of IBM System 23 Basic. This BASIC was also used on the IBM S/34 and S/36. From there I went to programming on a MAI Basic Four machine (sometimes referred to as Business Basic). I then went on to programming and building a Novell PC network for a company that also was running an IBM S/36 which allowed to get my feet wet in the RPG world. After working on the S/36 for several years, in the summer of 87 I went to IBM's announcement of the "Silver Lake" Application System 400 (AS/400). The company was maxed out on their S/36 and immediately ordered a new AS/400. While we waited for our new machine to arrive, I spent several months traveling the country going to classes from IBM. By taking the classes ahead of time, I was able to get all the external file descriptions(DDS) created for our entire S/36 database thus allowing us to have all our files externally defined day one of our migration. Over the next several months myself and one other programmer completely re-wrote all of our RPG II programs to take advantage of RPG/400. I 20+ years working on the AS/400 almost exclusively and continued developing my skills with further versions of RPG (RPG IV, RPG ILE, and RPG/Free). Along the way I worked on several ERP and Sales systems. This includes working for a couple of software development companies. About 10 years ago I started working for a company that was using their AS/400 to power web applications and was able to learn HTML, JavaScript, and other web languages and techniques. These include Apache (web servers), the Websmart development tool, and various SQL packages.
If you have any questions, comments, or just something you would like to discuss, you can post messages to my WordPress Blog on Free RPG/i5 (AS/400) Tools Wordpress/Blog Page .
I will continue adding information and examples as time goes on, so please come back often.
Contact Us Via E-Mail
Reply to : 
Your name : 
Subject : 
The RPG Information Exchange Frequently Asked Questions
AS/400 FAQS Non-AS/400 FAQS

Q: What is an AS/400?
A: The AS/400 is the last/most recent hardware platform in IBM's midrange computers. The first of these was the System 3 followed by the System 32, the system 34, system 36, and the system 38 (you can learn more about them HERE .
Since being announced in 1987 it has been called by several different names:
Application System 400 (AS/400), IBM iSeries 400, and the i5.
The systems being sold today are significally different than the original machines. Today's machines are more like PC hardware. All software that ran on the original hardware will still run on today's machines. The primary programming language used is RPG IV, but it can also support RPG II, RPG III, PL1, COBOL, OCL, and CL.

Q: How do you return (output or In/out) values from an RPG program in a stored procedure to an external system (ie.. PHP or java)?
A: Although I'm sure there are many techniques, the one I use is to select the stored procedure results in a SQL & display them. You can use a second stored procedure as sort of a wrapper procedure. Click HERE to see an example.

Q: How do I chain to a file in RPG Free Format without defining a KLIST?
A: There Two methods:
  • Define a data-structure (equal to the key list) & use the %KDS bif to chain to the file.
  • List each field on the chain statement ie.. chain (field1:field2:field3) filename;

Q: How can I make all output from a specific program be listed under a single user?
A: Since the output is generated for the user that is currently running the job, the only way would be to submit the job for the specific user. Another way would be to change the user that is currently signed on. This can be accomplished by using the QSYGETPH api (to retrieve the specific userid inforation) & the QWTSETP api to actually change the current user that is signed on. I have created a utility to automate this, you can download it HERE

Q: How do I show the interactive source debugger screen in 132 column mode like it does when you debug a program VIA a service job?
A: You have to add an environment variable (ILE_DEBUGGER_1) with a value of ALLOW_WIDE_SCREEN. This is set for each job & will only remain active until you sign off. You can also remove the variable go back to 80 column mode. I have created a command that will toggle this variable back & forth. You can download it HERE

Q: How do I convert non-Free RPG to RPG Free?
A: IBM hasn't given us any free (good) solutions & I have not found any myself, but I have found a couple of other options:
  • There is an option in the WebSphere Development Studio Editor to convert RPG C-Specs to Free Format.
  • Linoma Software has a pretty good tool to convert RPG to Free Format (I have used it myself). You can download a free trial here .
  • I have also found a very useful resource here . Craig Rutledge's website has always been a good resource for me.
  • I will add more as I find them, otherwise I would say your best be is to re-write them.

Q: How do create/use a FTP script on the RPG/i5 (AS400)?
A: Essentially the FTP command on the AS400 works the same way it does on any other platform. All of the FTP functions are the same. You just need to understand how/where the FTP command gets/uses the script file(s). By default the FTP command on the AS400 will expect to find a file called INPUT that it will use for it's script and a file called OUTPUT that it will use for an output log. If the OUTPUT file does not exist, it will create it in QTEMP.
What you want to do in order to create a script for the FTP command is:
  1. Create a source member to use as a FTP script.
  2. Create a source member to use as a FTP log.
  3. Add FTP commands to your script member (an example can be found HERE ).
  4. Override the INPUT file/member to your script member
  5. Override the OUTPUT file/member to your log member
  6. Run the FTP Command (Pointing at the appropriate system)
You can look at your log file/member to debug any problems. I have created a tool that will automate this process.
It uses mostly CL, but it does have an RPG component that prompts for the target system. This tools also utilizes the edtsrc tool to create/build the script member.
I also have a tool that will generate a FTP script on your i5 for all the members in a source file ( ftpgen - Generate FTP Script File ). This can then be downloaded to your PC (along with the other members) and used to re-upload them later.

Q: How do I verify the contents of a field is numeric in RPG Free without using the TEST(N) opcode?
A: Since the TEST(N) is not supported in RPG Free, the best way I have found to accomplish the same thing is to, use the %Check BIF. You can do this with the following code:
if %Check('0123456789':YourField:1) <> 0;

In this example, "YourField" is the variable name and the "012345679" are the valid characters. The function will start searching from position one. If any character is found that does not exist in the valid character list, it will return the position of the invalid character. The example assumes that any value other than zero is invalid without regard to what/where it is.

Q: How do I keep Windows XP from treating Zip files as folders?
A: Turn it off:
  1. Select Run from the Start Menu.
  2. Type regsvr32 /u %windir%\system32\zipfldr.dll at the prompt, and click Ok.
  3. The change will take effect immediately, but you may have to restart Windows for all traces of the built-in ZIP support to disappear.
If, at any time, you wish to re-enable Windows XP's built-in ZIP support, just follow these steps:
  1. Select Run from the Start Menu.
  2. Type regsvr32 %windir%\system32\zipfldr.dll at the prompt, and click Ok.
  3. The change will take effect immediately, but you may have to restart Windows for all features of the built-in ZIP support to be available.
This and many more windows tips can be found at: Annoyances.org

Q: How can I determine what browser/operating system is being used on my web page?
A: While there are many ways to accomplish this, one of the most reliable methods I have found (it's what I use on this site) is to use the Navigator Object. You can click HERE to see an example.

Links to RPG Information Exchange's partners & friends
This page contains links to sites that operate independent of RPG Information Exchange & we are not responsible for their content. Although we attempt to maintain a high standard for the sites we partner with, occasionally things change without our knowledge. Please inform us if a link is broken or the content of a website no longer fits the description that is represented here.

If you would like us to add your page here, just send us the link and description (long and short) VIA the contactus button.
RPG Information Exchange - Mission
The purpose of this site is to help educate, inform, and provide a reference to novice and experienced programmers alike. Over time I will provide examples, samples and general information on RPG and other aspects of programming in today's midrange environment. I will include information from my experience and the experience of other professionals I am associated with.
If you have any questions, comments, or just something you would like to discuss, you can post messages to my WordPress Blog on Free RPG/i5 (AS/400) Tools Wordpress/Blog Page .
I will continue adding information and examples as time goes on, so please come back often.
i5 (AS/400) News Headlines

RPG Information Exchange's
Order Results 
Checking, Please Wait...