Chapter 2: Specification Formats


A somewhat rigid language, RPG is not a completely free-form language like PL/I, COBOL, C, or Java. RPG requires a different statement format for each area of the program. These formats are known as RPG specification forms. When writing RPG programs, a general knowledge of each type of specification format is necessary. A specification format guides the programmer in writing specific areas of the RPG program. Most other languages—such as PL/I, COBOL, and C—require only one specification; RPG requires several.

SPECIFICATION TYPES

This chapter describes each RPG specification format type. While chapter 1 introduces the various RPG specification forms, Table 2.1 lists a summary of the RPG IV specifications. RPG source programs can contain any number of specifications. When more than one specification form is used, they must appear in the order listed in Table 2.2.

Table 2.1: RPG IV Specification Types

Specification Type

Identification

Common or Alternate Name

Control

"H" in column 6

Header spec or H-spec

File description

"F" in column 6

File-spec or F-spec

Definition

"D" in column 6

D-spec

Input

"I" in column 6

Input specs or I-spec

Calculation

"C" in column 6

Calc spec or C-spec

Output

"O" in column 6

Output spec or O-spec

Procedure

"P" in column 6

Procedure spec or P-spec

Table 2.2: RPG Specification Sequence

Header specification

File specifications

Definition specification

Input specifications

Calculation specifications

Output specifications

Procedure specification

Definition specification

Calculation specifications

Procedure specification

**

File translation table

**

Alternate collating sequence

**

Compile-time array data

If the specifications do not appear in this order, the RPG compiler generates a severe error and the program is not created. As listed in Table 2.2, after the final specification, additional information about tables, array, collating sequencing, and file translation can be included in the program. Double asterisks in columns 1 and 2 indicate the beginning of a file translation table, alternate collating sequence table, or compile-time table and array data. Compile-time table and array data is used frequently in RPG. Alternate collating sequence and file translation tables are normally not used.




The Modern RPG IV Language
The Modern RPG IV Language
ISBN: 1583470646
EAN: 2147483647
Year: 2003
Pages: 156
Authors: Robert Cozzi

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net