RPG/i5 Tools - FREE RPG/i5 (AS400) software downloads.  This site has examples (source) of many utilities that use APIs and procedures.  Most of them are written with Free Format RPG IV/ILE and take advantage of RPG/i5 (AS400) service programs.

Try Sticky Password Manager
The Free RPG/i5 (AS400) Tools Frequently Asked Questions

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
    OBRDBF FILE(INPUT) TOFILE(QGPL/QFTPTXT) MBR(YourMember)
  5. Override the OUTPUT file/member to your log member
    OBRDBF FILE(OUTPUT) TOFILE(QGPL/QFTPTXT) MBR(YourMember)
  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.

Q: How do I keep Windows XP from treating Zip files as folders? (Ok so this has nothing to do with the i5(AS400), It just annoys the crap out of me!)
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 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;
   "DO SOME CODE";
endif;

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.

The Free RPG/i5 (AS400) Tools website consists of various tools. Most of these tools are iSeries (AS400) related & in source format. Some of the tools have been uploaded by others & some of the tools are just tools/utilities I have found over the years to be useful. You can download any of these tools for free by pressing the button below.
Load RPG/i5 Tools - FREE RPG/i5 (AS400) software downloads.  This site has examples (source) of many utilities that use APIs and procedures.  Most of them are written with Free Format RPG IV/ILE and take advantage of RPG/i5 (AS400) service programs. Main Website