Code for IBM i with Source Orbit, and BOB The Better Object Builder
Have you ever found yourself staring blankly at a piece of technology, wondering why it won't do what you want it to do? Or maybe you've spent hours trying to troubleshoot an issue, only to discover that the solution was right there in the manual all along. Reading the manual might not be the most exciting activity, but it's definitely a lot more fun than banging your head against a wall!
While Source Orbit may turn a blind eye to project structure, it strictly upholds its source code rules with an iron fist.
Source must be named with the correct extensions. Here is the list of the current extensions straight from the Source Orbit main page:
Extension | Extension meaning | Notes |
---|---|---|
sqlrpgle | RPGLE (SQL) | Can use .pgm notation |
rpgle | RPGLE | Can use .pgm notation |
clle | CLLE | Can use .pgm notation |
cl | CLLE | Can use .pgm notation |
clp | CL (OPM) | Should be renamed to clle |
pf | Physical File | Table |
lf | Logical File | View/Index |
dspf | Display File | |
prtf | Printer File | |
msgf | Message filee | |
sql | Any SQL object | Type determined by create statement |
table | SQL table | Expects CREATE TABLE |
view | SQL view | Expects CREATE VIEW |
index | SQL index | Expects CREATE INDEX |
alias | SQL alias | Expects CREATE ALIAS |
sqlalias | SQL alias | Expects CREATE ALIAS |
sqlprc | SQL procedure | Expects CREATE PROCEDURE |
sqludf | SQL function | Expects CREATE FUNCTION |
sqludt | SQL table function | Expects CREATE FUNCTION |
sqltrg | SQL trigger | Expects CREATE TRIGGER |
sqlseq | SQL sequence | Expects CREATE SEQUENCE |
bnd | Binder source | |
binder | Binder source | Should be renamed bnd |
cmd | Command |
The system object name is the basename of the source file
Source name | Resulting object |
---|---|
LCUS.LF | LCUS.FILE |
CUS.PF | PCUS.FILE |
dothing.cmd | DOTHING.CMD |
pos123.dspf | POS123.FILE |
faq500.rpgle | FAQ500.MODULE |
faq401.pgm.sqlrpgle | FAQ401.PGM |
faq500.bnd | FAQ500.SRVPGM |
Examples
If the name of your source member includes .pgm
, then it will become a program. If your source name does not include .pgm, then it will become a module, cmd, dtaara, etc.
We can easily control what is compiled using the Rules.mk File. Here you can see I am saying (a) compile the module from helloworld.rpgle, (b) create a ILE PGM containing that module and then (c) set the TEXT for that PGM to 'Simple Hello World RPG Program'
Or we can use Binder source (.bnd
/.binder
) for service programs because Source Orbit will scan the binder source to find the exported functions/procedures from modules inside the project.
File Name Goodies
Usually, the file's basename doubles as the object name. However, Source Orbit takes a spin on this and conjures up a deterministic object name derived from the file name itself:
Source name | Resulting object | Note |
---|---|---|
abcd.rpgle | ABCD.MODULE | No change |
ab_cd.pgm.rpgle | AB_CD.PGM | No change |
thisIsASuperLongName.pgm.clle | TIASLN.PGM | First character plus following capitals |
FetchUserData.cmd | FUD.CMD | All capitals from file name |
ua_fetchUserData.sqlrpgle | UAFUD.MODULE | Prefix, followed by first post-prefix character plus following capitals |
ART200D-Work_with_Article.DSPF | ART200D.FILE | Support for ibmi-bob file name |
My Preferred Naming Standard
I like the IBM i BOB naming standard of an upper case object name (up to 10 chars) followed by a dash (hyphen) and then the object description.