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, Contributor
05.08.2008
Rating: -3.81- (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 Search400.com expert 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 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




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



RELATED CONTENT
iSeries programmer tips
Enhancing RPG with external SQL stored procedures
Tracking data changes on IBM i with triggers
Introduction to SQLRPGLE on IBM i: Making a report
Implementing a browser interface in COBOL: Displaying database fields
Taking advantage of CL advancements, starting with V5R3
TAATOOL: Useful tools for programmers on IBM i
Implementing a browser interface in COBOL: Creating your graphic Web page
Implementing a browser interface in COBOL: Getting started
Making the most of RPG data handling on IBM i
Groovy programming on IBM i

iSeries SQL commands and statements
Enhancing RPG with external SQL stored procedures
Tracking data changes on IBM i with triggers
Introduction to SQLRPGLE on IBM i: Making a report
Making the most of RPG data handling on IBM i
When is the YES option for 'reuse deleted files' function the best choice?
Monitoring members 'stuck' within a physical file on an EDI system
Creating a host variable of the 'where in' statement in SQL
SQL server error message -321
Choose which column names are returned via ODBC when working with DB2 files
Convert a numeric physical file to a character in SQL without leading zeros
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.



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