SPECIFICATION TYPES


RPG programs consist of statement specifications. Specifications provide the layout of each area of the RPG program. For example, the calculation specification defines where each component of a calculation statement belongs. The most common specifications include those listed in Table 1.1.

Table 1.1: RPG IV Specifications

Specification Type

Identification

Common Name

Control

H in position 6

Header spec or H-spec

File

F in position 6

File specs or F-specs

Definition

D in position 6

Definition specs or D-specs

Input

I in position 6

Input specs or I-specs

Calculation

C in position 6

Calc specs or C-specs

Output

O in position 6

Output specs or O-specs

Procedure

P in position 6

P-specs

Although no single specification is required by every program, when more than one type is used (as is normally the case in RPG programs), the specifications must appear in a specific sequence. The exception is the procedure specification. The procedure specification defines the beginning and end of a subprocedure—a kind of subroutine or subprogram in RPG. Table 1.2 lists all the RPG specifications and the correct sequence.

Table 1.2: RPG Specification Sequence

Header specification

File specifications

Definition specification

Input specifications

Calculation specifications

Alternate calculation specification

Output specifications

Procedure specification

**FTRANS

File translation table

**ALTSEQ

Alternate collating sequence

**CTDATA

Compile-time array data

End-procedure specification

The calculation specification and the alternate calculation specification can be intermixed without regard for one another. The RPG compiler determines which calculation specification is being used by inspecting the operation code. Table 1.3 lists descriptions of each RPG IV specification. For more information on each specification form, see chapter 2.

Table 1.3: Specification Description

Position 6

Description

H

Header specification. This specification is used to establish the default behavior of the program. For example, the format of date and time variables and of compiler options is specified here. In addition, the compiler's parameters and options may be specified on the Header specification.

F

File specification. This specification is used to define each input and output device file to the program. The type of device on which the file is or will be located (e.g., DISK, PRINTER, or WORKSTN) and the type of access that is required (e.g., input, output, update, or delete) are among the items defined by the F specification.

D

Definition specification. This specification is used to declare the data used in the program. Data structures, stand-alone fields, arrays, tables, named constants, and pointer variables are among the items declared with the Definition specification.

I

Input specification. This specification describes input file record formats—input field locations.

C

Calculation specification. This specification describes the calculations (computations) that are to be performed. The order in which, and the conditions under which, the calculations are to be performed is also specified here. This is where the actual work of the program is performed.

O

Output specification. This specification describes the output file record formats, output field locations, and printer-file control (i.e., spacing and skipping).

P

Procedure specification. This specification is used to declare a subprocedure within an RPG source program. A subprocedure is used to create functions (similar to built-in functions) or bound procedures.




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