Monday, August 11, 2008

To change the Color of source code in RPG program

Here's a tip many people may not be aware of. When we are coding the programs we put a lot of comments to explain logic or functionality, instead of putting these comments in green color, generally we will prefer to put them in different colors. For doing this some people will use tools some will do programmatically. Instead of doing so we can add some colors to our program by using simple Client Access keyboard mapping.

Let us see how we can do this..
? Click on the "MAP" button ? Click on any key, for example I want to map my ALT + R for red color ? So click on R and type APL 28 in the box provided against Alt and save the settings. ? Now go to the source line, which you want to make in RED. Put your cursor just before the first word of the line and press ALT + R and enter, the source line will be displayed red in color.
For different colors follow this table:
APL 20 - Green

APL 21 - Green RI
APL 22 - White
APL 23 - White RI
APL 24 - Green UL
APL 25 - Green RI UL
APL 26 - White UL
APL 27 - ND
APL 28 - Red
APL 29 - Red RI
APL 30 - Blue
APL 31 - Blue RI
APL 32 - Yellow
APL 33 - Yellow RI
APL 34 - Blue UL
APL 35 - Blue UL RI

By using this technique we can change the colors for member text too... take option 13 and F4 for member you want to change the color first, then put your cursor just before the first letter in the text and press corresponding color key and press enter. Now you can see your member text will be displayed in different color.

SUBFILES

What Are Subfiles?
According to IBM, a subfile is a group of records that have the same record format and are read from and written to a display station in one operation. As the term suggests, a subfile is not a file; rather, it is a temporary place to store data of the same format to be used by a display file program.

Why Use Subfiles?
Subfiles are useful when you want to list multiple, similar records on a display. An additional beauty of subfiles is that you can define them such that the number of records to be displayed fits on one display or exceeds the number of lines available on the display, allowing the user to scroll, or page, through the data. Subfiles also allow you an effective means of manipulating data in a database file.
Subfiles allow you to display lists of similar data that can extend beyond what fits on one screen. In most situations, this added capability would cost you something, but not with subfiles. They make it easier to create display applications, which, in turn, will make you more productive. Subfile programs are easy to write and maintain because much of the work is done for you in the data definition specifications (DDS). Most of the time, you can change the characteristics of a subfile program without modifying the RPG code driving it.