Visual Studio Code for IBM i - Source Code Naming Standards

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:

ExtensionExtension meaningNotes
sqlrpgleRPGLE (SQL)Can use .pgm notation
rpgleRPGLECan use .pgm notation
clleCLLECan use .pgm notation
clCLLECan use .pgm notation
clpCL (OPM)Should be renamed to clle
pfPhysical FileTable
lfLogical FileView/Index
dspfDisplay File
prtfPrinter File
msgfMessage filee
sqlAny SQL objectType determined by create statement
tableSQL tableExpects CREATE TABLE
viewSQL viewExpects CREATE VIEW
indexSQL indexExpects CREATE INDEX
aliasSQL aliasExpects CREATE ALIAS
sqlaliasSQL aliasExpects CREATE ALIAS
sqlprcSQL procedureExpects CREATE PROCEDURE
sqludfSQL functionExpects CREATE FUNCTION
sqludtSQL table functionExpects CREATE FUNCTION
sqltrgSQL triggerExpects CREATE TRIGGER
sqlseqSQL sequenceExpects CREATE SEQUENCE
bndBinder source
binderBinder sourceShould be renamed bnd
cmdCommand

The system object name is the basename of the source file

Source nameResulting object
LCUS.LFLCUS.FILE
CUS.PFPCUS.FILE
dothing.cmdDOTHING.CMD
pos123.dspfPOS123.FILE
faq500.rpgleFAQ500.MODULE
faq401.pgm.sqlrpgleFAQ401.PGM
faq500.bndFAQ500.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 modulecmddtaara, etc.

  • mypgm.rpgle becomes a MYPGM.MODULE object
  • mypgm.pgm.rpgle becomes a MYPGM.PGM object

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'

creating the helloworld with SO naming standards

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 nameResulting objectNote
abcd.rpgleABCD.MODULENo change
ab_cd.pgm.rpgleAB_CD.PGMNo change
thisIsASuperLongName.pgm.clleTIASLN.PGMFirst character plus following capitals
FetchUserData.cmdFUD.CMDAll capitals from file name
ua_fetchUserData.sqlrpgleUAFUD.MODULEPrefix, followed by first post-prefix character plus following capitals
ART200D-Work_with_Article.DSPFART200D.FILESupport 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.

Visual Studio Code for IBM i - Source Code Naming Standards 1
source orbit naming compiled example
{"email":"Email address invalid","url":"Website address invalid","required":"Required field missing"}
>