Getting Started

RPG Metrics can analyse RPG source without requiring you to upload source code to the web application.

Recommended beta workflow: use the IBM i Agent. The agent scans RPG source locally on IBM i, creates the XLSX report locally, and sends calculated metrics only to the RPG Metrics dashboard when dashboard sync is enabled.

IBM i Agent Mode

This is the recommended workflow for IBM i teams.

  • RPG source is scanned locally on IBM i
  • XLSX reports are generated locally on IBM i
  • Dashboard sync is optional
  • When dashboard sync is enabled, only calculated metrics are sent to RPG Metrics
  • Source code does not need to be uploaded to the web application
Local-only mode

The agent can also be used without dashboard sync. In local-only mode, it produces a basic local XLSX report on IBM i and does not send metrics to the dashboard.

Manual upload mode

Manual upload may still be used for simple tests, but the IBM i Agent is the preferred workflow for real IBM i source libraries.

The IBM i Agent is currently available as a beta package for selected users.

Log in or create an account, then use the Feedback button to request the IBM i Agent beta package.

The beta package includes:

  • agent.py
  • agent.conf.example
  • requirements.txt
  • README.md
  • local scanner modules
  • local XLSX report writer
The package does not include credentials. You generate your own agent token from your RPG Metrics profile page.

Copy the agent package to the IFS. A typical location is:

/home/metrics-agent

Create a Python 3.9 virtual environment and install the requirements:

cd /home/metrics-agent
/QOpenSys/pkgs/bin/python3.9 -m venv .venv
source .venv/bin/activate
python -m pip install --progress-bar off -r requirements.txt

Copy the example config:

cp agent.conf.example agent.conf

Update the key settings in agent.conf:

AUTH_REFRESH_TOKEN=<your refresh token>
IBMI_IFS_PATH=/home/devuser/metrics-sources
REPORTS_PATH=/home/metrics-agent/reports
POLL_INTERVAL=60

Generate your agent token from your RPG Metrics profile page and paste it into agent.conf.

The agent watches the folder configured by IBMI_IFS_PATH. Create stream files in that folder using CPYTOSTMF.

Personal scan example
CPYTOSTMF FROMMBR('/qsys.lib/&l.lib/&f.file/&n.mbr')
    TOSTMF('/home/devuser/metrics-sources/&l_&f_&n.&t')
    STMFOPT(*REPLACE) CVTDTA(*AUTO)
    DBFCCSID(*FILE) STMFCCSID(*STDASCII)
Team scan example
CPYTOSTMF FROMMBR('/qsys.lib/&l.lib/&f.file/&n.mbr')
    TOSTMF('/home/devuser/metrics-sources/TEAM_&l_&f_&n.&t')
    STMFOPT(*REPLACE) CVTDTA(*AUTO)
    DBFCCSID(*FILE) STMFCCSID(*STDASCII)

The agent supports these filename formats:

  • LIBRARY_SOURCEFILE_MEMBER.TYPE
  • TEAM_LIBRARY_SOURCEFILE_MEMBER.TYPE

Supported source types include:

  • RPG
  • SQLRPG
  • RPGLE
  • SQLRPGLE
  • RPGFREE

The IBM i Agent writes local XLSX reports to:

/home/metrics-agent/reports/

Reports are organised by team, library and source file.

The local report can include:

  • Summary metrics
  • Source line analysis
  • Cyclomatic complexity hotspots
  • RPG Free compatibility findings

If dashboard sync is enabled, calculated metrics are also visible on the View Files page.

The dashboard shows:

  • Cyclomatic Complexity
  • Maintainability Index
  • Comment Percentage
  • RPG Free compatibility counts
  • Hotspots and trends, depending on enabled features
The XLSX report is generated locally on IBM i. The dashboard stores calculated metrics only.

To request the IBM i Agent beta package or submit feedback, log in or create an account.