Home > AS/400 Tips > iSeries programmer tips > The Lazy Coder talks about highlighting your code
iSeries 400 Tips:
EMAIL THIS
 TIPS & NEWSLETTERS TOPICS 

ISERIES PROGRAMMER TIPS

The Lazy Coder talks about highlighting your code


Andrew Borts
10.20.2004
Rating: -3.29- (out of 5)


Digg This!    StumbleUpon Toolbar StumbleUpon    Bookmark with Delicious Del.icio.us   


Problem
More Information

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.

Solution
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 www.wrkdbf.com 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.

Value

Description

X20

Normal (for Returning screen attributes)

X21

Reverse Image

X22

BOLD & BRIGHT

X23

BOLD & BRIGHT & REVERSE

X24

Underline

X28

RED

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?

SWEET!

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.


Rate this Tip
To rate tips, you must be a member of Search400.com.
Register now to start rating these tips. Log in if you are already a member.




Digg This!    StumbleUpon Toolbar StumbleUpon    Bookmark with Delicious Del.icio.us   


RELATED CONTENT
iSeries CL programming
An automated CL method of moving a query from AS/400 to Excel
Changing user password expiration
Eight steps for creating program documentation using AS/400 utilities
DAYSPAST CLLE program for AS/400: Compares object creation date with today's date
Advanced Job Scheduler help
How do I retrieve the source for an output queue description to put in to a CL program?
Top 10 programmer tips YTD
Ways to put QSHELL to work in your day-to-day programming life
Writing to a file from CL -- revisited
Code examples to determine future end of month based on any given date

iSeries Tools & Utilities
Take control of your iSeries
Vendors announce new products at fall COMMON
How does Sarbanes-Oxley affect you?
Top 10 Administrator Tips
CA Express utility helps you manage SSL certificates
Windows XP SP2 causes problem for iSeries Access
WebFacing v5.1.2 may save a lot of money
Users speak out on lack of iSeries apps
20 FTP tips in 20 minutes
Web-based report writing with Datavision

iSeries programmer tips
What is an integrated database?
An automated CL method of moving a query from AS/400 to Excel
Using SQL on System i to create multicolored comment lines
Eight steps for creating program documentation using AS/400 utilities
DAYSPAST CLLE program for AS/400: Compares object creation date with today's date
Coloring source lines with COBOL and using a shortcut from within PDM
Date calculation commands for AS/400
There is very little RPG on System i can't do: From RPG nay to RPG yay!
Using SQL on System i to color source code and inline comments
Controlling spool files with APIs

RELATED RESOURCES
2020software.com, trial software downloads for accounting software, ERP software, CRM software and business software systems
Search Bitpipe.com for the latest white papers and business webcasts
Whatis.com, the online computer dictionary

DISCLAIMER: Our Tips Exchange is a forum for you to share technical advice and expertise with your peers and to learn from other enterprise IT professionals. TechTarget provides the infrastructure to facilitate this sharing of information. However, we cannot guarantee the accuracy or validity of the material submitted. You agree that your use of the Ask The Expert services and your reliance on any questions, answers, information or other materials received through this Web site is at your own risk.



iSeries Security - Security Tools, Physical Security and System Security
HomeNewsTopicsITKnowledge ExchangeTipsBlogsAsk the ExpertsMultimediaWhite PapersProducts
About Us  |  Contact Us  |  For Advertisers  |  For Business Partners  |  Site Index  |  RSS
SEARCH 
TechTarget provides enterprise IT professionals with the information they need to perform their jobs - from developing strategy, to making cost-effective IT purchase decisions and managing their organizations' IT projects - with its network of technology-specific Web sites, events and magazines.

TechTarget Corporate Web Site  |  Media Kits  |  Reprints  |  Site Map




All Rights Reserved, Copyright 1999 - 2008, TechTarget | Read our Privacy Policy
  TechTarget - The IT Media ROI Experts