Newsletters   Subscriptions  Forums  Store   Career  Media Kit  About Us  Contact  Search   Home 
fhg
Volume 4, Number 41 -- December 8, 2004

RPG IV Comment Blocks

Hey, Ted:


Conditional compilation directives (/IF DEFINED) have two good uses that I have not seen mentioned in any of the midrange-oriented e-mail newsletters. Maybe you would like to tell your readers who work in RPG shops about them.

One good way to use a conditional compilation directive is to comment-out large sections of source code. Here's an example.

 /if defined(TheFollowingIsCommentedOut)
C                    eval      *in21 = *on
C                    eval      *in22 = *off
C*                   eval      *in23 = *on
C                    if        *in24
C                    exsr      DoSomething
C                    exsr      DoSomethingElse
C                    endif
 /endif

I prefer this technique to that of commenting out each line individually. For one thing, it's quicker to insert two lines of compiler directives than to key an asterisk (*) into column 7 of a lot of lines. Another thing I like is that I won't accidentally remove the asterisk in column 7 of the third line if I have to reactivate this section of source code at a later date.

I also like to use conditional compilation directives when including blocks of documentation in my source code. The following section of source code explains the meanings of the values of a customer invoicing option field.

  /if defined(TheFollowingIsAComment)

   Invoicing options:

     Generate the appropriate type of invoice
     according to the invoicing option code.

     E - email
     F - fax
     I - mail
     X - do not send an invoice to the customer

  /endif

You can use the full source line for documentation with this approach, but the source code editor may not like it. SEU will not complain if the comments start in column 8 or after.


Each of these examples works because I never define conditions called TheFollowingIsAComment or TheFollowingIsCommentedOut. Any series of characters, even garbage, works as long as no condition is defined by that name. Worrywarts may prefer to undefine the condition to be sure.

 /undefine TheFollowingIsCommentedOut
 /if defined(TheFollowingIsCommentedOut)

--Cletus the Codeslinger


Click here to contact Ted Holt by e-mail.

Sponsored By
PRODATA COMPUTER SVCS

iDBU with mySeries, do you?

We brought you DBU database utility.
And now...

DBUnifier for on-demand applications
RSP RPG Server Pages for web-enablement
STE Stored Procedure Test Environment
SQL/Pro query & reporting tools

All NEW ServerProven products which are
virtually FREE with IBM's rebate offering!
Hurry to WIN a safari (drawing Dec 31st)
www.prodatacomputer.com
Email sales@prodatacomputer.com
Call 800.228.6318


Technical Editors: Howard Arner, Joe Hertvik, Ted Holt,
Shannon O'Donnell, Kevin Vandever
Managing Editor: Shannon Pastore
Contributing Technical Editors: Joel Cochran, Wayne O. Evans, Raymond Everhart,
Bruce Guetzkow, Marc Logemann, David Morris
Publisher and Advertising Director: Jenny Thomas
Advertising Sales Representative: Kim Reed
Contact the Editors: To contact anyone on the IT Jungle Team
Go to our contacts page and send us a message.


THIS ISSUE
SPONSORED BY:

ProData Computer Svcs
WorksRight Software
Guild Companies


BACK ISSUES

TABLE OF
CONTENTS
RPG IV Comment Blocks

Controlling PC Access

Admin Alert: Use Fix Central to Order iSeries PTFs on CD-ROM


The Four Hundred
Choose Wisely: High Availability Performance and Reliability Issues

OS Solutions Relies on Remote Journaling for New HA Offering

Server Market Grows in the Third Quarter

Four Hundred Stuff
LTO 3 Tape Makes Its Way to Market

Profound Launches RPG-to-Web Conversion Tool for the Masses

FormSprint Gets a New PDF Archive

Four Hundred Monitor


Copyright © 1996-2008 Guild Companies, Inc. All Rights Reserved.
Guild Companies, Inc. (formerly Midrange Server), 50 Park Terrace East, Suite 8F, New York, NY 10034
Privacy Statement