Problem solve Get help with specific problems with your technologies, process and projects.

The Lazy Coder talks about highlighting your code

Can't tell the difference between your comments and your program? It's time to highlight some of it.


More Information

Your SEU screen is flexible, but it's not a mind reader. It's limited in that you can't perform hexadecimal manipulation of the source. Why do we need that? Well, the way to put highlighting in your code is to sacrifice ONE byte to send a signal to the 5250 stream that convinces it that you've changed the current display attribute. That single byte is VERY important because you can't put ANYTHING in that spot. So where do we start? Why, with DULL LIFELESS CODE!!

What's the problem here? Well, we have some HIGHLIGHTING opportunities:

  1. The Comment doesn't stand out
  2. IF/Then Statements could be a little more visible

Here's how to fix that. Open your favorite database editor and open the source member. Don't have a database editor that can handle HEX value editing? No problem. Years ago, I had the pleasure of working with Bill Reger, author of WRKDBF, one of the MOST POWERFUL and FREE (uh, yeah, FREE!) iSeries database editors. It's VERY powerful, comes with a money-back guarantee (giggle), and is so WELL written -- it's been unchanged since 2000. Go to and download and install this fantastic utility. (All examples in this article use this utility.)

OK -- commercial's over. So, what do we do now? Here's a SHORT list of good highlighting values.




Normal (for Returning screen attributes)


Reverse Image









There are more values, but the above is the "best of." However, I'll show you what source looks like with all the values from 20 to 39 (Hex 40 is a space) displayed.

Wow! Pretty snazzy, huh? You can use these values in ANY 5250 application. Just remember: You sacrifice one byte to turn the attributes on and off (that's two bytes total). So, if you have the room, you highlight the screen without needing to program indicators or manipulate the DDS file for the display.

In the first example you see the sentence, "it's GREEN!!! not RED!!!" When I'm done, the sentence will read, "it's GREEN!!! notX29REDX20!!!" Note the X20 to END the attribute to turn the screen BACK to normal.

The screen is WRKDBF. While editing the record, the HEX editor was used by Hitting F8 -- entry is UP/DOWN format. (Note the exploded Example.)

What does our source look like now?


Now highlight the WHOLE line of comments.

COOL! I changed the Byte to the left of the "T" in "There's" to a HEX 22 -– the HIGHLIGHT attribute. More coolness. Let's look at it!

Dang, that's cool!

Now, for your IF/ELSE/ENDIF statement you need to know one trick. Unless the 5250 stream SEES the attribute change, the display will NOT change. Because of that, you'll need to MOVE your SEU display a little by hitting the F19 button. This will shift it to the left. In this example, I changed the Byte to the LEFT of the C statement to highlight my IF/ELSE/ENDIF statements.

OK -- this is a LITTLE ugly, but you see the difference ONLY when you move the margin over a little. Clearly you need to salt this to taste, but you can see a definite benefit to using this technique.

Hit F11 to move the code back into place.

Fun stuff. Enjoy WRKDBF. It's a GREAT solidly written utility -- and it contains an un-delete function, too. If you REALLY love it, send Bill a comment. If you see him at COMMON or any other event, BUY HIM DINNER! Tell him the Lazy Coder recommended it. See ya next month!

About the author: Andrew Borts is webmaster at United Auto Insurance Group in North Miami, Fla. He is often a frequent speaker at COMMON and is past president of The Southern National Users Group, an iSeries-AS/400 user group based in Deerfield Beach, Fla.

You're looking through your programs, and you realize you can't tell the difference between the comments and the program. Squinting at the screen just doesn't help (I know -– I tried!) but you need to make sure you can see what's happening quickly so you can make modifications quickly. You boss is looking at your screen and can't tell the difference either, so he may be missing the important bits that YOU need to emphasize for him.

Dig Deeper on iSeries CL programming

Start the conversation

Send me notifications when other members comment.

Please create a username to comment.