+Happy New Year 2018

+Happy New Year 2018. One of my new years resolutions was to write cleaner code, and in the spirit of out with the old and in with the new

I already use the RPG COPYRIGHT statement and the CL COPYRIGHT STATEMENT to store the copyright message and (more importantly to me) the Version or Release number of this code.

But we want the copyright shown in DUMPS

Lots of IBM i shops have old AS400 and iSeries RPG applications that have evolved over the years. They are still using the good old fashioned compile time array (aka table) technique to store COPYRIGHT information in their RPG and RPGLE programs.Happy New Year 2018

Perhaps, 2018 is the time to upgrade this old RPGLE Compile Time Array technique with a newer dcl-s statement technique?

Out with the old and in with the new from RPGLE Arrays to DCL-S Copyrights

It’s less code, simpler to write, saves a lot of time and therefore money 😉

Upgrading the COPYRIGHT technique in RPG and CL

Add a member(copyright) to a standard copybook:

dcl-s CopyrightCompanyName varchar(256)
 inz('Application Version x.y Copyright © SOMETHING LLC 2018 -
 Program Property of SOMETHING LLC. All Rights Reserved.');

dcl-s Copyright_ptr pointer inz(%addr(CopyrightCompanyName));

The CopyrightCompanyName variable is the copyright and the Copyright_ptr pointer tricks IBM I into flagging it as used, so it shows in program dumps without having to MOVE or EVAL.

Then each program just has one line in it

/include copyright

• No need for array definition
• No need for c-spec move statement
• No Need for footer table in each program
• No code changes needed if copyright is updated — copybook member(copyright) will be automatically picked up as each program is recompiled

The same technique can be used for CLLE programs using CLP INCLUDE and the same copyright statement in a CL copybook.

The CL Looks like this:

 VALUE('Application Version x.y Copyright © SOMETHING LLC 2018 -
 Program Property of SOMETHING LLC. All Rights Reserved.')


I hope that helps somebody else out there suffering from post christmas blues. Or at least gives you some food for thought.

Talking about food… where is that Turkey Sandwich??

Jon Paris

For RPG – not CL sadly – you could change the definition to use Ctl-Opt Copyright(‘This is mine all mine!!’);

Has the added advantage that there are standard system commands that will show you the value. i.e. DSPMOD mylib/mymod DETAIL(*COPYRIGHT) or DSPPGM with DETAIL(*COPYRIGHT) and DSPSRVPGM DETAIL(*COPYRIGHT).

I think I am right in saying that the information if coded this way cannot be hacked as it would screw up some checksum or other in the program whereas changing a variable would not have that effect.

P.S. Have only just rediscovered your blog – which as another ex-Brit I find very refreshing. But how the heck do I subscribe to be notified of new posts?


Thanks Jon, I like the ‘copyright’ statement but I wish IBM would extend the COPYRIGHT function to include another field (version) because I frequently use that to see which version/release/mod# of code I’m using.

Most corporate sites I do work for want a dumpeable variable in their code as well…. hence this little blog. 😉

There should be a SUBSCRIBE button down on the bottom left side of the blog. I might snoop around to find a plugin that makes it more obvious.

Jon Paris

Found the subscribe button – easy once you know it is there!

As to version – I have always included the version in the copyright. I don’t disagree that it would be a “nice to have” but it is not something RPG could do alone – the whole system would have to add it so that it can be pulled up by the same mechanisms that pull up the Copyright info. I think the copyright data shows up in an object dump – but that’s not normally something folks want to look at.

Comments are closed