AS/400 Programming Tips, Tricks, & Techniques

Apr 24 2013   8:07PM GMT

Make your Documentation *SHINE*

Eric Witham Eric Witham Profile: Eric Witham

Greetings Everyone,

I realize this is a topic that may have been discussed a long time ago, but I have some changes that may prove useful and less time-consuming to setup.

What i’m talking about is Highlighting your Source Code.

Please note that I don’t use Mocha. It’s not for me. I’m a Client Access guy all the way. In this post I’m going to be referring to the keyboard mapping function within Client Access.

Now, obviously you can’t highlight the Active source code because the compiler is going to expect the syntax to not have any hexadecimal values on the line. So basically, you can only highlight Commented Source code. Which is fine, because that’s how we write our documentation.
First, let’s take a look at how this works:

There are hexadecimal values that can be used to change the attribute of a character. You can figure out what they are the hard way, by tracking them down in the settings of Client Access or trolling through boards and forums, or you can take a look at the Member I created below:

Attribute Legend
Basically, I have this listed out in 3 columns: The 1st being the description of the Attribute, the 2nd is my personal mapping of these attributes and the 3rd is the Hex Value for these attributes.
When I first started highlighting my documentation and commented out source, I didn’t realize that I could use this directly in a program while I was coding it without having to copy in a line from this member. It used to be that I always kept a member named @@ATR in my QTESTSRC file and when I needed to highlight code, I would copy in the line, remove the text and keep put a CR on it. Then on the code I wanted highlighted, I marked it with OO in loops in the sequence number area in order to overwrite my code.

After reading an article years ago on Search400 I found that I was able to modify the actual keyboard mapping file and insert it that way. Boy was that a pain in the butt. I did it once and saved the file and took it with me to every job that I had.

Now I know better.

You certainly don’t have to go in and modify some keyboard mapping script file and attempt to stay sane through all that mumbo-jumbo.
Why don’t you Developers do this right now? You’re obviously reading this to learn something new, or to see if there is a new take on something you already know how to do.

Simply go into your Keyboard mapping Functions screen within Client Access by clicking the Remap Keyboard Functions button. Or you could go to EDIT>PREFERENCES>KEYBOARD…
Once you’re there, click the Button that says Customize.
Click on the letter W
On the bottom right-hand side of the screen there will be an area labeld Change Current Actions for Selected Key
In the text box designated for Ctrl type the following:  apl 22
In the text box designated for Alt type the following:  apl 23
In the text box designated for CtrlShift type the following:  apl 26

Save your changes and exit the Keyboard Mapping Area.
Just as a precaution, make sure that the Keyboard Mapping file you changed is the one shown in the window where you originally hit Customize.

Go into an RPGLE Source Member
Insert a line and make it a Commented Line of source code.
Place your cursor in the position directly BEFORE the Asterisk.
Hold the Ctrl Button down and hit W, then ENTER.

You have some highlighted Source code.

Other than documentation comments, why else would you use this other than to seem flashy? I’m glad you asked.

I’m sure just about everyone has had to follow a Programmer whose skills do not in fact, pay the bills.
Multiple lines of code commented out with an asterisk followed by more un-commented code, no blank lines in between to save your eyes, things like that.

Well, if you place apl 28 in the Ctrl area for the letter R you can put your cursor on the specification letter, hit Ctrl + R and bam, you have a Red line of commented code.

How much easier is it to figure out what lines of code are actually seen and processed by the compiler without making your eyes go nuts as you troll through 5000 lines?

Much Easier.

This can be done in any source member. In my CLLE programs, I put the highlighted code character after the /* and then before the */ i put a green colored character code in there.
Even better, let’s say you have a big project you’re working on which means multiple programs. You can only take certain programs so far and you had to name them in a numeric fashion. How do you remember which ones you need to go back to for testing, for additional logic because you need to add new business rules and the person with the answers isn’t there, or which programs you already analyzed during your investigative process?


Check it out, just insert a blank space on the Text line and in that position, hit Ctrl+W for White or Ctrl+B for Blue, even block highlight it, or make it blink red. Do what you want!

Below are some examples for you to check out.

The most important lesson in this is to have fun in your organizational OCD tantrums. I know i sure do.

Highlighting Commented out Source
Commented out
Highlighting the Source Headers in CLLE/CLP with Notes to make you remember before Deployment
CLLE example

Highlighting in PDM so you know what member needs your attention and which one doesn’t
PDM Example

Highlighting RPGLE Source Code
RPGLE Example

Again, Thank you everyone who takes the time to read these articles I put up.
If you have a specific topic you’d like me to discuss and expand on, please let me know via with the Subject Line of ITKE Blog Ideas

Thank you all and Have a Great Day!

Eric T. Witham

3  Comments on this Post

There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when other members comment.
  • TomLiotta
    'Colorizing' source needs to be done with care. Editing can be done with SEU in a green-screen environment, but it is more and more often done in an IDE (Integrated Development Environment) on a PC.By inserting hex characters in records that are defined as printable text, some IDEs can be messed up when those source members are downloaded. Be sure you understand how each hex bit pattern might translate between platform encodings. The IDEs commonly also already have automated colorizing rules that can make self-colorizing irrelevant or even contradictory..As long as the source is guaranteed never to transfer to a different system, including downloads, colorizing as fine. Whenever a second platform becomes likely, it can be trouble, especially when it becomes necessary to scan every source member in a system and to remove each individual problem character..Use caution with the process..Tom
    125,585 pointsBadges:
  • Eric Witham
    As you can see this is SEU in a Green-Screen environment NOT using an IDE. I have yet to meet anyone in an AS/400 shop in NYC/NJ who doesn't use SEU in a green-screen environment. With that said, this more likely than not doesn't apply to those using an IDE, which was why I put that I am using Client Access in the beginning of this article. I don't recall speaking about using a second platform or anything else like that. If you have more information to add to this topic, please write an article in the blog about it. However, this article was specific to the platform, environment and software, since it's a quite common one. 
    690 pointsBadges:
  • TomLiotta

    Yes, it is specific to the green-screen. That's a given.

    But a point of my comment is that companies are bought by other companies or that development methods can change or that expansion brings secondary sites, even international ones that may share code even though systems have different CCSIDs. Many developers ignore those possibilities, yet they happen. Being prepared can save a lot of time.

    ITKE serves international members, not just NYC/NJ. Many are beginners. They should have details that might affect their decisions.

    Personally, I have various source members that have skeleton lines of all available colors. I use them as template sources when I want to colorize a part of a new source member of my own. So, it's not an absolute hard rule even for me. I do, however, pick and choose. Running into the problem once was enough for me.


    125,585 pointsBadges:

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

Share this item with your network: