IBM i Global

 View Only
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:

    /IF NOT DEFINED(QCMDEXC)
    /DEFINE QCMDEXC
    dcl-pr qcmdexc extpgm('QCMDEXC');
    cmdString char(32702) Const OPTIONS(*VARSIZE);
    cmdLength packed(15:5) Const;
    IGC char(3) Const OPTIONS(*NOPASS);
    end-pr;
    /ENDIF


    -Bob Cozzi


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

    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.  

    https://wiki.midrange.com/index.php/Category:RPG_Prototypes



    ------------------------------
    David Gibbs
    Owner / Administrator
    midrange.com

    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 https://ibm.diabetessucks.net.

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



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

    IBM Champion
    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.

    -Bob




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

    IBM Champion
    Posted Thu December 17, 2020 06:13 PM

    I have some stuff here already:http://www.scottklement.com/rpg/copybooks/

    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
    Director
    Profound Logic Software
    Oak Creek WI
    ------------------------------



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

    IBM Champion
    Posted Mon February 21, 2022 04:12 PM

    Hi Scott. The link https://www.scottklement.com/rpg/copybooks/ returns error 403 Forbidden "You don't have permission to access this resource."

    Thanks.



    ------------------------------
    Marco Riva
    project and developer manager
    Sirio Informatica e Sistemi SpA
    Milano
    mriva@sirio-is.it
    ------------------------------



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

    IBM Champion
    Posted Mon February 21, 2022 04:35 PM
    Sorry about that, the setting must've gotten lost when I changed web servers.   It should be fixed, now.

    ------------------------------
    Scott Klement
    Director
    Profound Logic Software
    Oak Creek WI
    ------------------------------



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

    IBM Champion
    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 (https://github.com/richardschoen/qshoni), 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 (http://mobigogo.net/files/docs/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
    ------------------------------



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

    Posted Thu December 17, 2020 06:47 PM
    Richard,

    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.

    -Bob




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

    IBM Champion
    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:
    SAVLIB LIB(LIB) DEV(*SAVF) SAVF(QGPL/TEMPSAVF)

    -Copy the library to the IFS 

    CPYFRMSTMF FROMSTMF('/QSYS.LIB/QGPL.LIB/TEMPSAVF.FILE')
    TOMBR('/tmp/protolib.savf')
    MBROPT(*REPLACE)  CVTDTA(*NONE)

    -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')
    TOMBR('/QSYS.LIB/QGPL.LIB/TEMPSAVF.FILE')
    MBROPT(*REPLACE)  CVTDTA(*NONE)

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

    -Restore library or restore objects if you saved with SAVOBJ
    RSTLIB SAVLIB(TEMPSAVF) DEV(*SAVF) SAVF(QGPL/TEMPSAVF)

    -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
    ------------------------------



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

    Posted Tue November 16, 2021 01:24 PM
    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
    ------------------------------



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

    IBM Champion
    Posted Tue November 16, 2021 04:44 PM
    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
    ------------------------------



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

    IBM Champion
    Posted Tue November 16, 2021 05:47 PM
    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 (http://www.iforgit.com) 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:
    https://www.seidengroup.com/2018/01/02/using-git-ibmi

    ------------------------------
    Richard Schoen
    ------------------------------



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

    Posted Wed November 17, 2021 09:59 AM

    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
    ------------------------------



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

    Posted Wed January 19, 2022 05:03 AM
    Git (and the various Git repository managers) bring in a load of source change tracking enhancements that we don't naturally have on the i. 

    my boss wrote a piece about why Git which is worth a read, it is used by something like 85% of the open systems development community, but our heritage developers have been missing out on it. It's one step towards modernising your approach to development and future proofing your applications.

    https://www.arcadsoftware.com/news-events/blog/why-git/

    I've not been using it for that many years but it does make your accountability a little more obvious to SOX/Audit teams, especially when they're already used to seeing this with the other minor platforms :)

    ------------------------------
    Adrian Tully
    ------------------------------



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

    IBM Champion
    Posted Wed November 17, 2021 03:48 AM
    Jeff, check out my video on GIT on IBM i https://www.youtube.com/watch?v=qzxV6f427hQ 

    You can find the rest of my IBM i videos at https://learning.formaserve.co.uk or my youtube channel https://www.youtube.com/c/FormaServeSystemsLtdLoughton

    Hope they help.

    ------------------------------
    Andy Youens
    IBM Champion & Member of IBM ISV Advisory Council
    ------------------------------



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

    Posted Thu January 13, 2022 05:57 AM
    Hi Andy and community users, 

    I'd like to start using git, I've the problem to tech to my colleagues the great value of git (this is sure a big problem). 

    Do you have any suggestions on how to migrate from seu dependant programming code to a src management tool like git?

    I love visual studio code and Code for IBM i extension written by Liam Barry.

    If I want to use git how do you suggest?
    Do I have to leave my source into source file, or the best way is to start using git as it should be used?
    Let me try to explain, we have thousand of source in many libraries, what I have to do? Copy all  of this to stream files,  commit it to a git server (we are trying gitlab)  and delete the source files?

    Anyone have experience into this kind of migration?

    we are about 12 programmers, and only 2 o 3 are prepared to use git and visual studio code, the others only know seu, and as usual for an RPG Programmers still continue to use RPG fixed... for they this evolution seems like to start as a junior programmer. this is a cultural problem.

    many thanks



    ------------------------------
    Paolo Salvatore
    ------------------------------



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

    IBM Champion
    Posted Thu January 13, 2022 09:10 AM
    First of all you can use Code for IBM i without git.  Just continue to leave your source in place in your libraries. 

    Everyone is happy.

    Similarly you can start using git in minutes with your classic source and SEU, PDM, RDi or VS Code with something like iForGit to start capturing source changes to git. (http://www.iforgit.com)

    Your source files remain as the primaries, but you commit changes to git to start getting change capture. Best of both worlds. 

    If you re-read the above stream of messages, anything else will be rolling your own utilities.

    Regards,
    Richard Schoen




    ------------------------------
    Richard Schoen
    ------------------------------



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

    Posted Tue January 18, 2022 02:34 PM
    A little late to the discussion, but I would like to mention one thing.  While a common source for pulling these prototypes would be nice, for those of us that have to deal with SOX audit rules and change management packages, this (any open source) would have to be easy to understand and justify that the security is in place to be allowed.  It's easier to setup reusable code in-house and get over these hurdles, especially when you don't have enough staff or younger ones that know it already.

    ------------------------------
    Mike Overlander
    ------------------------------



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

    Posted Fri March 11, 2022 07:38 AM
    Nice, idea, to keep it simple would be nice to have a fixed text URL for the distribution from where it is possible to refresh the include member needed.
    On recent machines with a rich PASE toolset is just a matter of pasting in PASE a one line like

    curl https://the.site.com/member.txt | Rfile -wQ "MYLIB/SRCPGM(MYMBR)"

    to reload a physical source file member from a URL.

    Or one can download a SAVF alternatively if one wish to use only the classical i shell.

    btw
    GIT is worth to learn, even basic commands.
    I personally copy each end of day changed members via SQL to IFS and then commit it to a free and well known git server on the internet.
    Basic, cheap, but sufficient for my needs (pretty much auditing and seeing the source evolution in time in case of problems).









    ------------------------------
    ace ace
    ------------------------------