Home > AS/400 Tips > iSeries programmer tips > Using SQL on System i to color source code and inline comments
iSeries 400 Tips:
EMAIL THIS
 TIPS & NEWSLETTERS TOPICS 

ISERIES PROGRAMMER TIPS

Using SQL on System i to color source code and inline comments


Narendra Devireddy
05.08.2008
Rating: -4.00- (out of 5)


iSeries news and advice
Digg This!    StumbleUpon Toolbar StumbleUpon    Bookmark with Delicious Del.icio.us    Add to Google


This tip was submitted by a reader, and reviewed and revised by John Blenkinsop for accuracy and thoroughness. A follow-up tip is planned by the author, but please let us know if you have any questions regarding this tip.

For all those programmers using emulators other than Client Access (and other similar advanced emulators), you can color your source code/inline comments using SQL. The color codes for some are as given below:

Red X'28'
White X'22'
Blue X'3A'
Pink X'38'
Turquoise X'34'

Code:

In SQL/400, create an alias of the source member you want to color in QTEMP. If I want to color source member PGM1 in QRPGSRC my SQL statement would be something like:

Query 1: CREATE ALIAS QTEMP/ALIAS# FOR LIB/QRPGSRC (PGM1)

The alias would enable us to access different members of file using SQL.

Query 2: UPDATE QTEMP/ALIAS# SET SRCDTA = SUBSTR(SRCDTA,1,4)||X'22'||SUBSTR(SRCDTA,6,94) WHERE SUBSTR(SRCDTA,7,1) = '*'

We are updating the source line by including hex color code in sixth byte of the source.

This query would change the color of all comment line to white.

Condition your query as you like based on any field SRCDTA, SRCSEQ, SRCDAT.

Query 3: DROP ALIAS QTEMP/ALIAS#

This drops the alias file created in QTEMP.

The table of valid hex values for display colors is shown below:
Hex Color
20 Green
21 Green, reverse image
22 White
23 White, reverse image
24 Green, underscore
25 Green, underscore, reverse image
26 White, underscore
27 Nondisplay
28 Red
29 Red, reverse image
2A Red, high intensity
2B Red, high intensity, reverse image
2C Red, underscore
2D Red, underscore, reverse image
2E Red, underscore, blink
2F Nondisplay
30 Turquoise, column separator
31 Turquoise, column separator, reverse image
32 Yellow, column separator
33 White, reverse image, column separator
34 Turquoise, underscore, column separator
35 Turquoise, underscore, reverse image, column separator
36 Yellow, underscore, column separator
37 Nondisplay
38 Pink
39 Pink, reverse image
3A Blue
3B Blue, reverse image
3C Pink, underscore
3D Pink, underscore, reverse image
3E Blue, underscore
3F Nondisplay
We encourage readers to submit a tip on use of the AS400 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




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


RELATED CONTENT
iSeries programmer tips
Date calculation commands for AS/400
There is very little RPG on System i can't do: From RPG nay to RPG yay!
Controlling spool files with APIs
System i document management tips
Selective SPOOLFILE copy to CSV files and e-mail
System i Resume Building 101
Web skills crucial to iSeries programmer professional development
System i no longer the stepchild of IBM's world
System i Web app dev for free
New i5/OS features announced as anticipation mounts

iSeries SQL commands and statements
Joining files using SQLRPGLE
Querying system catalog tables to determine table alias
Excluding characters from AS/400 DB2 SELECT statements prevents mapping errors
Using SQL syntax to override DB2 automatic column name generator on iSeries
Making a file with an automatic key in iSeries with DDS keyword
The SETOBJACC command
Determining relationships between tables and files in DB2 UDB
SQL Updates with functions
SQL statement history storage
Creating an SQL command to view two files as one
iSeries SQL commands and statements Research

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.

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