CL coding tip #74 – using [CTL-OPT COPYRIGHT] 

 July 26, 2017

By  NickLitten


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:

CL coding tip #74 - using [CTL-OPT COPYRIGHT]

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:

RPG Code Snippet 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));


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 
 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 
 $DAYSINSTALLED CHAR(5) ' ' '4040404040'X 
 $DISPLAY CHAR(52) ' ' 
 VALUE IN HEX '40404040404040404040404040404040404040404040404040404040404040404040404040404040'X 
 41 '404040404040404040404040'X 
 $END INDICATOR(1) '0' 'F0'X 
F3=Exit F12=Cancel F19=Left F20=Right F24=More keys 
String found in position 3.


IBM i Software Developer, Digital Dad, AS400 Anarchist, RPG Modernizer, Shameless Trekkie, Belligerent Nerd, Englishman Abroad and Passionate Eater of Cheese and Biscuits. Nick Litten Dot Com is a mixture of blog posts that can be sometimes serious, frequently playful and probably down-right pointless all in the space of a day. Enjoy your stay, feel free to comment and remember: If at first you don't succeed then skydiving probably isn't a hobby you should look into.

Nick Litten

related posts:

{"email":"Email address invalid","url":"Website address invalid","required":"Required field missing"}
__CONFIG_colors_palette__{"active_palette":0,"config":{"colors":{"cff50":{"name":"Main Accent","parent":-1},"a344d":{"name":"Accent Transparent","parent":"cff50"}},"gradients":[]},"palettes":[{"name":"Default","value":{"colors":{"cff50":{"val":"var(--tcb-skin-color-0)"},"a344d":{"val":"rgba(46, 138, 229, 0.85)","hsl_parent_dependency":{"h":210,"l":0.54,"s":0.78}}},"gradients":[]},"original":{"colors":{"cff50":{"val":"rgb(0, 178, 255)","hsl":{"h":198,"s":1,"l":0.5}},"a344d":{"val":"rgba(0, 178, 255, 0.85)","hsl_parent_dependency":{"h":198,"s":1,"l":0.5}}},"gradients":[]}}]}__CONFIG_colors_palette__

Get In Touch

I’m always looking for awesome input, feedback and critique!