Expand all | Collapse all

IBM i API Prototypes in RPG free

  • 1.  IBM i API Prototypes in RPG free

    Posted Wed December 16, 2020 04:36 PM
    Hi Everyone,
    I'm putting together a set of /INCLUDE members that contains the Prototypes for IBM i APIs.
    The C language has these in the H file in QSYSINC but for 30 years IBM has failed to add them to QCPYSRC (or even QRPGLESRC) in QSYSINC.
    Over the last 30 years, I've been prototyping the ones I've used and now I am, as needed, converting them to the free format RPG syntax.

    I'm trying to figure out if I should just post them on my website for download or if there's a public place that IBM sponsors where everyone can get into it without being a member of this club or group or a customer of company xyz?

    I've got most of the commonly used APIs already prototyped and many have been converted to free format. I am currently working on the more complex Message QMH* APIs.
    I see this as a living document until everything that people actually use has been published.

    As an example, here's the correct QCMDEXC prototype in free format:

    dcl-pr qcmdexc extpgm('QCMDEXC');
    cmdString char(32702) Const OPTIONS(*VARSIZE);
    cmdLength packed(15:5) Const;
    IGC char(3) Const OPTIONS(*NOPASS);

    -Bob Cozzi

  • 2.  RE: IBM i API Prototypes in RPG free

    IBM Select
    Posted Thu December 17, 2020 02:16 PM
    Edited by David Gibbs Thu December 17, 2020 02:16 PM

    FWIW: There has been an effort to create RPG prototypes on the midrange wiki.

    David Gibbs
    Owner / Administrator

    I'm riding in the American Diabetes Association's Tour de Cure to raise money for diabetes research, education, advocacy, and awareness. You can make a tax-deductible donation to my ride by visiting

    You can see where my donations come from by visiting my interactive donation map ... https:/ (it's a geeky thing).

  • 3.  RE: IBM i API Prototypes in RPG free

    Posted Thu December 17, 2020 05:45 PM

    Perhaps a GitHub repository ?

    Great place for all general code samples to live.

    Richard Schoen

  • 4.  RE: IBM i API Prototypes in RPG free

    Posted Thu December 17, 2020 05:53 PM
    I was thinking more along the lines of an easy to get to resource. I know GIT is the current "cool" thing but such a tiny percentage of actual shops have staff that even know what that is. But I'm all for it if there a CL command we can build that says:

    GetFromGit SRCMBR(QUSROBJD) SRCFILE(MYLIB/QCPYSRC) RMTLOC('/blah,blah,blah,blah') ...

    I'm not a fan of making people learn "Garage Linux" just to load source. But if there's an ease CL command to pull it down. Let's go with that.


  • 5.  RE: IBM i API Prototypes in RPG free

    Posted Thu December 17, 2020 06:13 PM

    I have some stuff here already:

    I like the idea of having a git repo for this very much, and would be willing to contribute to that.   To solve the problem of users not being familiar with git, I'd say we should do "releases" from the git repo, just as you would with open source software.  These would then not require the use of git, it could be downloaded and installed onto IBM i  (I've had success with writing a windows installation package that uses FTP to install onto IBM i -- very easy to use.)   Of course, the option of cloning/pulling via git would also be possible for those who do have the knowledge, or who would prefer not to use a Windows-based installation program (such as Mac or Linux users).

    Another nice idea would be to have a shell script in the repo that could be used to move all the source from IFS into source members.  That way, those who prefer the IFS would have it there directly from git, and those who prefer the source member approach could get it there very easily.

    Scott Klement
    Profound Logic Software
    Oak Creek WI

  • 6.  RE: IBM i API Prototypes in RPG free

    Posted Thu December 17, 2020 06:31 PM

    You don't need to be a Linux or QSH/PASE/bash junkie to use Github effectively.

    I use Github a couple of ways:

    -I put binary save files in some cases such as with my QSHONI utility (, which would be probably the equivalent of a release as Scott mentioned. Load save file, run build CL and it creates the objects. 

    I even have a Windows based installer that I share with those who might be uncomfortable with dropping a save file into the IFS, calling CPYFRMSTMF and doing a RSTLIB. 

    -I also put source samples in some cases. And I will probably do this more in conjunction with shell scripts and make files for deployment going forward because if you supply it in the Git repo, you can have it build the library as well all from the QSH/PASE/bash shell. Plus I am also doing "Garage Linux" development.

    With source samples, the code can actually be copied directly from Git into a source member in RDI or SEU (Ugh).

    -I also offer a commercial Git client for IBM i source management with Git, appropriately titled: iForGit ( which works similar to what you were describing, however the intended audience is customers who want to keep their source in source files, yet want to start versioning stuff in Git as well to get out of the member copy and rename business. 

    I guess it all comes to who your audience is for the code samples you're providing and how much support you have to give them for installation.

    But I would suggest Github as the new way of doing things if your open sourcing code.

    And also doing some more "Garage Linux" if you're not retiring any time soon :-)

    Richard Schoen

  • 7.  RE: IBM i API Prototypes in RPG free

    Posted Thu December 17, 2020 06:47 PM

    I hear ya. However, the example I like to use is an old Aaron Bartel article where the latest cool thing he was promoting (don't really recall what it was at the moment, Git, Yum, Ruby, alphabet soup etc.) was So Easy. And then he went on to outline the "27 steps" to install it.

    For example I can write an SQL UDTF that returns the content from an IBM i API using inline C code. I can do in my sleep.

    But while there is a growing number of people who spell QShell as "QSH" on this system, I don't think its peaked.
    Also, just to be a dick... :) In CL, you can specify TOFLR('/home/cozzi/prototypes') rather that trying to determine which 1-character "flag" whomever wrote whatever it is we're using today decided was a cool letter to use (was it upper/lower case?)

    I suppose Scott's idea (as is normally the case) is the best solution. All those things he mentions are easy to build if they aren't built already. So perhaps some how we can put stuff on GIT and do releases. Now I'm lost at that point because the most I've worked with GIT is to create a user Id several years ago and post a little bit of code. Looked cute.


  • 8.  RE: IBM i API Prototypes in RPG free

    Posted Thu December 17, 2020 07:07 PM
    Edited by Richard Schoen Thu December 17, 2020 07:08 PM

    Things with open source on i have actually come a long way since Aaron pioneered a lot of this stuff for us. 

    Jesse and the IBM team have done a great job at making the open source stuff much more consumable. 

    You probably already know how to do this, but here's the low tech way I package up a save file for distribution these days:

    Packaging library into a save file

    -Package all the source in a library with a build CL and no objects built.

    -Create temp savf: CRTSAVF QGPL/TEMPSAVF

    -Save the library or objects to a save file:

    -Copy the library to the IFS 


    -Upload or zip and upload to your web site, github or wherever you please.

    Restoring library from the web

    -Download savf or zip file, unzip and place in the IFS /tmp or other directory through favorite file transfer method of choice.

    CPYFRMSTMF FROMSTMF('/tmp/protolib.savf')

    ** This will even auto-create the save file I believe

    -Restore library or restore objects if you saved with SAVOBJ

    -Create your build program or objects per instructions. I use a CL program called SRCBLD in mine.

    The process is so much easier these days. 

    Then you don't really need Github. 

    Just instructions and a web site or Github site to hang it on. You Github site could have a single readme and a copy of your binary save file like I do with QSHONI. 

    Anyway you know my thoughts on the topic :-)

    Richard Schoen

  • 9.  RE: IBM i API Prototypes in RPG free

    Posted 15 days ago
    I for one, have no idea what GIT is, what it is, how to get to it, or even what it looks like, and I have been on this platform for almost 40 years. I have only heard of it.

    Jeff Drayer

  • 10.  RE: IBM i API Prototypes in RPG free

    Posted 15 days ago
    Git is just another revision control system.
    It has taken over the entire world, pretty much.
    It's based on having the full repository locally and pushing and pulling the changes to upstream and downstream repos.
    It runs in the IFS on IBM i.
    If you're not retiring in 2022, you might as well get to know it :)

    Jack Woehr
    IBM Champion 2021

  • 11.  RE: IBM i API Prototypes in RPG free

    Posted 15 days ago
    Jack I was thinking something similar :-)

    Not trying to rip on old developers (like myself), but if you haven't heard about Git then you must have limited exposure to IBM i content or are planning on coasting in to retirement as Jack mentions.

    Even though I have been in the industry 38 years I consider myself a lifelong learner and still continue to do current and leading edge stuff like providing an IBMi centric git client ( to help older devs start using git quickly.

    Also the web is filled with great content. Just google: ibmi and git

    Here's an interesting link on the Seiden web site:

    Richard Schoen

  • 12.  RE: IBM i API Prototypes in RPG free

    Posted 14 days ago

    Shameless plug - we use IFORGIT in our shop and would recommend it for anyone looking to use and begin to understand Git - almost without having to use or understand Git. It's basically plug and play. If you struggle with source control in any way, shape or form, you would benefit immediately. 

    Add in that the cost is reasonable, the support excellent, and you are well on your way. 

    As an aside, we use a good chunk of the alphabet soup previously mentioned (yum, git, node.js, python, etc.), in combination with the original alphabet soup maker, IBM. To great success. <One note on Aaron's content specifically: While he was an inspiration for our shop in many ways, these tools are VASTLY improved since the days when he was literally hacking away at expanding our options. Revisit if you haven't.> 

    I also enjoy thinking of this from both perspectives (because we have both seasoned and brand new developers) - trying to get the "cool" kids to use the tried and true IBM i functionality is just as difficult as the other way around. 

    Point being, there is value to be found in all of it with the right mindset. Dismissing any option out of hand is simply destructive. Especially within this community where we need every one of us to keep this thing sailing.  

    James Hodgkinson

  • 13.  RE: IBM i API Prototypes in RPG free

    Posted 15 days ago
    Jeff, check out my video on GIT on IBM i 

    You can find the rest of my IBM i videos at or my youtube channel

    Hope they help.

    Andy Youens
    IBM Champion & Member of IBM ISV Advisory Council