Sign in

docs RPG Reference

Declarative Operations

Declarative Operations

The declarative operations are shown in the following table.

Table 1. Declarative Operations

OperationTraditional SyntaxFree-Form Syntax
Define FieldDEFINE (Field Definition)LIKE or DTAARA keyword on definition specification
Define Key* KFLD (Define Parts of a Key) * KLIST (Define a Composite Key)(not allowed)
Identify Parameters* PARM (Identify Parameters) * PLIST (Identify a Parameter List)PR definition specification
TagTAG (Tag)(not allowed)

The declarative operations do not cause an action to occur (except PARM with optional factor 1 or 2); they can be specified anywhere within calculations. They are used to declare the properties of fields or to mark parts of a program. The control level entry (positions 7 and 8) can be blank or can contain an entry to group the statements within the appropriate section of the program.

The DEFINE operation either defines a field based on the attributes (length and decimal positions) of another field or defines a field as a data area.

The KLIST and KFLD operations are used to indicate the name by which a composite key field may be referred and the fields that compose the composite key. A composite key is a key that contains a list of key fields. It is built from left to right, with the first KFLD specified being the leftmost (high-order) field of the composite key.

The PLIST and PARM operations are used with the CALL and CALLB operations to allow a called program or procedure access to parameters from a calling program or procedure.

The TAG operation names the destination of a branching operation such as GOTO or CABxx.