Home > AS/400 Tips > iSeries programmer tips > Using SQL on System i to create multicolored comment lines
iSeries 400 Tips:
EMAIL THIS
 TIPS & NEWSLETTERS TOPICS 

ISERIES PROGRAMMER TIPS

Using SQL on System i to create multicolored comment lines


Narendra Devireddy, Contributor
08.25.2008
Rating: -3.82- (out of 5)


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


In addition to what I wrote about in my tip, Using SQL on System i to color source code and inline comments, it is also possible to have multicolored lines for comments using SQL, like the one shown below:

[IMAGE]

The key to this is inserting hexadecimal codes in the byte prior to the text.

For instance, if you want to highlight some part of the text for source program PGM1 in source file QRPGSRC in library LIB1, use the following queries:

CREATE ALIAS QTEMP/ALIAS# FOR LIB1/QRPGSRC (PGM1)

Now taking the example of the above text, get the position of the text, * on the left is in position 7, M (of MODIFICATION) is in Position 11, D (of DESCRIPTION) is in position 41 and * on the right is in position 70.

If we insert hexadecimal codes into the bytes before the text, we can get multicolored lines.

Position of insertions:
For * Insert White (X'22') in position 6
For M insert Blue (X'3A') in position 10<


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


RELATED CONTENT
iSeries programmer tips
Groovy programming on IBM i
EGL Rich UI on IBM i: Do you Dojo?
Running PHP open source applications: NOBODY needs authority
Programming for the Web on the IBM i, what is possible
Using geocoding on AS/400 to enhance your Web presence
The best technologies and tools for System i programmers in 2009
Seven IBM i project lessons learned in 2008
Documenting nested program structures on the AS/400
What is an integrated database?
An automated CL method of moving a query from AS/400 to Excel

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


br> For D insert Red (X'28') in position 40
For * on right insert White (X'22') in position 69 The query should be built like this:

After the query, the line will appear as below:

[IMAGE]

Although the query looks quite complex, it's simple once you understand that the first parameter in SUBST should be position of character and the second parameter should be the difference between the next position of insertion and the position of the character.

The query shown in the example is done on a source file with a length of 112 (100 bytes for SRCDTA). If your source file length is different, change your query accordingly.

Use this query only if your alias is not created in QTEMP. Otherwise it is optional.

DROP ALIAS QTEMP/ALIAS#

Please note:

We encourage readers to submit a tip on use of the AS/400 system for potential publication. Just click on "Submit a Tip" below.

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.


Submit a Tip




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 technology professionals with the information they need to perform their jobs - from developing strategy, to making cost-effective purchase decisions and managing their organizations' technology projects - with its network of technology-specific websites, events and online magazines.

TechTarget Corporate Web Site  |  Media Kits  |  Site Map




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