blog icon indicating copy to clipboard operation
blog copied to clipboard

Why git? Moving source (members)

Open worksofliam opened this issue 5 years ago • 0 comments

Moving your source code to git is one of the biggest jumps a company can make. While it is a risk, it’s also one of the best moves a company can take to improve the development workflow.

What is nice is that you can do it at your own pace. Another nice thing is that the ILE compilers copy/include mechanisms can support both source members (QSYS) and stream files (IFS). For example, in RPG, /COPY or /INCLUDE can include sources from both file systems, no matter where the parent source is maintained.

This means, you can move source into an IFS stream file and all the existing ‘member copies’ will still work.

/COPY QRPGLEREF,MYPROTOS
/COPY 'source/headers/protos.rpgle'
/COPY QRPGLEREF,OTHERPROTO

Something to remember is that even if you do not succeed at your first attempt at moving to git: you still have your source members to fall back on. Before you even start moving members, I would make sure you do not have any open change requests to make sure you have the latest version of the source code you are copying.

Actually doing the work

I find this order to be efficient for me:

  1. Create a bare (master) repo and clone it (see here about creating bare repos)
  2. Copy all source members into relevant IFS directories. This means members in QRPGLESRC should go into a QRPGLESRC directory in the project folder, etc.
  3. git add --all and git commit -m "Init commit"
  4. git push to push it up to the main repo.

It’s up to you to decide how to move the source members. The usual case is to write a program that copies each member into the correct folder and to also give it the correct extension (which is part of the source member).

People should only ever clone, push, pull, etc from the ‘master’ repo. In the future, you may also want to host your repo off platform and in the cloud so it’s easier to maintain across multiple platforms.

Building

Once you have started tracking all the source, you need to figure out how to build everything from the IFS. There will be another post for build tools, but if you don’t want to learn how to integrate with a build tool yet (this should be required after everything is steady) then you should create a CL to build all of the sources into a library using the correct compile commands.

Most of the ILE compilers have a SRCSTMF parameter to specify the source streamfile, but there are some that don’t (CRTDSPF for example). I suggest you take a look at CRTFRMSTMF to work around this until IBM fix this issue.

As of IBM i 7.3 with PTF SI66740, CRTCLMOD, CRTBNDCL, and INCLUDE have support for using stream files as well as members. (thanks Scott!)

Build tools

  • make
  • GNU Make intro.

worksofliam avatar Jul 07 '19 02:07 worksofliam