Midware Ltd.

RPG IV Language Elements

Home
Services
News
AS/400
Employment

Sign-up for e-mail notifications

Take our weekly poll

Dow Jones Intraday

Nasdaq Intraday

 

 

There are several changes you'll immediately notice when editing RPG IV programs with the Source Entry Utility.


Case-tolerance

If you experiment with changing the RPG IV source code, one of the first things you'll notice is that RPG IV is case-tolerant.  Note that being case-tolerant is different from being case-sensitive.  Variable names, op-codes, etc. are recognized as being the same regardless if they're upper-case, lower-case or mixed-case.  For example, each of the three examples below are considered the same:

Z-ADD    *ZERO     ITEMNUMBER
z-add    *zero     itemnumber
z-add    *zero     ItemNumber

Note that case-tolerance does not apply to literals within quotes.  For example:

call     'PROGRAM'

is NOT the same as:

call     'Program'

As with many of the features in RPG IV/ILE, usage of capitalization is left to your discretion.  You may want to establish a capitalization standard for your shop.  One word of caution however, not all programmers are efficient typists.  Try to establish your standards so they don't inhibit programming productivity.  My personal preference is to only use capitalization to improve readability of program field names and imbedded SQL statements.


Long field names

One of the most appreciated features of RPG IV is the ability to use long field names.  RPG III had a restriction of 6 characters for field names.  This led to some very cryptic naming conventions, especially for multi-level break reports.

You'll be happy to know that field-name length restrictions have virtually been eliminated.  As of V4R5 the maximum field length is 4,096 characters!  Keep in mind however that RPG is still a positional language to some extent however.  Field names longer than 15 characters - although allowed - require a continuation specification, and therefore may become awkward to use.  It's generally a good idea to keep field name lengths to a maximum of about 12-13 characters.

The long field name lengths allow also for easier adapting of standards which may include field name prefixes.  As an example, you may want to prefix all program-described fields with a "@", and all display-file fields with a "#".  RPG IV also now allows and underscore ("_") as part of a field name (it cannot be the first character however).  These combined features allow for very readable naming conventions - "@Apr_Unit_Total" instead of "UNTL04".


Now, we'll cover the differences in each of the RPG IV specification types.  Aside from layout changes to accommodate larger field names, O-specs (output) remained relatively unchanged and therefore are not covered.  A new D-spec was added to RPG IV that replaces most of the functionality of the I-spec (input specifications) and eliminates the E-specs (tables/arrays).

H-specs (control specifications)
F-specs (file specifications)
D-specs (data specifications)
C-specs (calculation specifications)

  Back to OPM vs. ILE Next to H-specs 
 
Home Feedback Contents Search

Send mail to midware@midwareservices.com with questions or comments about this web site.
Copyright © 2000 Midware, Ltd.

Last Modified:  August 18, 2000