USING COPYRIGHT in the RPG Header
Following on from the COPYRIGHT PRIMER blog from a while ago I added a little extra function for CL as well. The extra function means that defining the copyright text in a variable as well as the COPYRIGHT means you can store the copyright statement at OBJECT level and also show it in program DUMPS as a variable
So, lets do the exact same thing for RPGLE
When a bound ILE program is created with multiple modules I tend to add the COPYRIGHT statement to the primary module and then just add a “modified by” or “version number to the other modules”. This lets me see the copyright but also easily see exactly what versions I am running, or testing, simply by issuing a DSPPGM command:
In this example the first three lines are from the primary CL module.
The next is from the PGM(DSPFLDRPG) *RPGLE module which has the modification comment only
So, the RPGLE copybook for the header might look like this:
ctl-opt
.. all your other header parms here ...
copyright('| DSPFLDRPG This is a Module that does stuff written by me')
NOTE: I use the ‘|’ character to separate my copyright statements. I just think its pretty. 😉
YET ANOTHER PESKY NOTE: regular RPGLE &VARIABLES are not shown in DUMPS until they are used so we can easily *fool* IBM i into using that variable by simply basing something over it – how about something like a lovely little pointer?
dcl-s $COPYRIGHT char(256)
inz('| DSPFLDRPG This is a Module that does stuff written by me');
dcl-s $COPYRIGHT_PTR pointer inz(%addr($COPYRIGHT));
*BOOM*
Now if the code ever dumps we will see the value called $COPYRIGHT in the DUMP as well 🙂
File . . . . . : QPPGMDMP Page/Line 15/17
Control . . . . . Columns 1 - 130
Find . . . . . . COPY
*...+....1....+....2....+....3....+....4....+....5....+....6....+....7....+....8....+....9....+....0....+....1....+....2....+....3
1961 '40404040404040404040404040404040404040404040404040404040404040404040404040404040'X
$COPYRIGHT CHAR(256) '| DSPFLDRPG This is a Module that does stuff written by me '
81 ' '
161 ' '
241 ' '
VALUE IN HEX '4F40C4E2D7C6D3C4D9D7C740E38889A24089A2408140D49684A4938540A38881A340849685A240A2'X
41 'A3A4868640A69989A3A385954082A840948540404040404040404040404040404040404040404040'X
81 '40404040404040404040404040404040404040404040404040404040404040404040404040404040'X
121 '40404040404040404040404040404040404040404040404040404040404040404040404040404040'X
161 '40404040404040404040404040404040404040404040404040404040404040404040404040404040'X
201 '40404040404040404040404040404040404040404040404040404040404040404040404040404040'X
241 '40404040404040404040404040404040'X
$COPYRIGHT_PTR POINTER SPP:C36801ED2F094340
$DAYSINSTALLED CHAR(5) ' ' '4040404040'X
$DISPLAY CHAR(52) ' '
VALUE IN HEX '40404040404040404040404040404040404040404040404040404040404040404040404040404040'X
41 '404040404040404040404040'X
$DONETHIS INDICATOR(1) '0' 'F0'X
$END INDICATOR(1) '0' 'F0'X
More...
F3=Exit F12=Cancel F19=Left F20=Right F24=More keys
String found in position 3.