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:
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?
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?
BY HIGHLIGHTING IN PDM!
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.
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 WitheringGnomes@gmail.com with the Subject Line of ITKE Blog Ideas
Thank you all and Have a Great Day!
Eric T. Witham