Developer > RPG

Developer


Source Version Control With i5-OS CL

RPG - Source Version Control With i5-OS CL

Print Email

In February, I introduced free-source version control for RPG code using Subversion (SVN), an open-source versioning tool (www.ibmsystemsmag.com/i5/february08/
developer/19751.aspx
). Building on that article, I want to delve into the capabilities of client-side SVN by creating some foundational, easy-to-use tooling so it feels like a more natural tool set when used on the IBM* System i* platform. I’ll cover how to make SVN available to you at a native i5/OS* CL level versus the QShell approach used in my first article.

I discovered I’d opened a can of worms after the first article because making SVN work on the System i platform as I needed requires a fair amount of programming. So I rolled up my sleeves and wrote the better part of a new open-source project that I’m creatively calling System i SVN Client. This article will not only cover the additional functionality being offered in this new open-source project, but also will guide you through the approach I took so you can apply it to other needs in your shop.

I’ve made the entire project available for download (http://mowyourlawn.com/files/iSVN_v1.0.zip), including a save file for the System i platform and install instructions.

To start things off, let me reiterate that the SVN client we’re using (SVNKit.org) is based on Java* technology. The best approach I’ve found to get decent speed is to submit the Java to a batch job and do all communication via keyed data queues. Basically the Java sits in the batch job waiting on the keyed data queue for SVN commands to execute. With this approach, there’s only one JVM* started up on your System i server, whereas other approaches would require JVM startup for each programmer using the SVN tooling on each session they were logged into.

Architectural Details

For further detail on the architecture, see Figure 1, where I lay out the necessary System i objects and resources used to do full-loop SVN communication. The numbers indicate the order of occurrence and the arrows show data-flow direction.

Step 1 uses the Start SVN (STRSVN) command to release the Java process to batch. Looking at the source of STRSVNC.CLLE (available in my download), you can see this is simply using the Submit Job (SBMJOB) and Run Java (RUNJVA) commands to accomplish the task. Note the .jar files have fully qualified IFS paths, leaving nothing up to relative paths that may be pointed at your home directory. The readme.txt file included with the download contains the following command, which is used to start the Java batch job process. Make sure to add library SVN to your library list before executing this command.

STRSVN DQLIB(SVN) DQNAM(SVNDQ) JVADQWAIT(-1) JVADBG(TRUE) JVADBGFLR(‘/java/svn/logs/’)

After running STRSVN, you can review the Java job using the Work With Active Jobs (WRKACTJOB) command and see the results as in Table 1.

At this point, you’re ready to communicate with the remote SVN repository. Our free repository from the first article is Assembla (www.assembla.com) but any Subversion repository will do—even one located on your System i platform.

Step 2 shows the use of SVN Command (SVNCMD). This command sends SVN commands verbatim to the remote SVN server via the SVNKit software running in the Java batch job. For example, the following command checks out an SVN project from assembla.com:

SVNCMD CMD(‘checkout http://svn2.assembla.com/svn/svn1//
java/svn/svn_local --username mowyourlawn --password greeneggs’)

To learn more about SVN commands, consult the excellent—and free—book “Version Control with Subversion” (http://svnbook.red-bean.com).

Upon running SVNCMD, the SVNCMDR RPG program will read physical file SVNCFG and appropriately place an entry on data queue SVNDQ containing the SVN command we wish to execute (Step 3). SVNCMDR will then wait for responses from the Java batch job sent via SVNDQ (Step 7) and write the results to the user’s job log (Step 8). Note that “responses” is plural. SVN will issue multiple messages that are captured on the Java side and sent back to SVNCMDR via SVNDQ with a message identifier of “MSG.” When SVNCMDR receives this type of message, it sends it to the user’s job log and then waits on the data queue to receive more messages. When a “SUCCESS” or an unknown message ID is received, the looping process in SVNCMDR will end and control will return to the programmer.

Next page: >>

Page 1 2

Aaron Bartell is an RPG and Java developer for www.krengeltech.com. Aaron can be reached at aaronbartell@mowyourlawn.com.

Buyers Guide

Browse products and services for Developer.



Advertisement