RPG4 (or RPGLE as its sometimes known) has a neat and little used header specification command called ‘COPYRIGHT’
Presumably, this h-spec function was originally implemented by IBM so that software houses can embed their object copyright within the program source. But us RPG developers are a resourceful lot, and the H SPEC COPYRIGHT statement is an excellent way of storing the current modification version of any given program object.
Sometimes, I am working on a version of a program and planning on making many changes during the coming days or maybe weeks. For structured testing of these code versions, or to allow a different colleague to work on a ‘code-frozen’ earlier version, I might want to store the iterative versions in different levels of a testing environment. You could do this by changing the program object description to add a version number V1.1, V1.2, V1.3, V2 etc But this it can be far too easy to have a fat finger moment, or to just forget.
So, how do we control versions in RPG?
Simples — using the COPYRIGHT H-SPEC actually embeds the version number within the program object itself.
By adding the H COPYRIGHT comment into the first line of code, means we can look at the compiled version (and of course the related source code if you have it) and clearly see the version number. For example, adding something like:
H COPYRIGHT('My Company © 2017 YADA YADA | Nick Litten V1R1 last changed July 2017')
to a program and compile it.
This text is free-format and can contain a character literal with a maximum length of 256.
So, when you issue a DSPPGM (program-name) you see the comment embedded in the actual program object itself. Here is an example from the Projex4i Toolkit:
Super useful and easy way of recording the source code changes.