Previous Topic: VERSION StatementNext Topic: Using the Grouping Statement


Grouping Statement

Purpose

Grouping statements uniquely identify to the DDDL Generator the file or record definitions that have nonunique or synonymous names. Synonymous file (or record) definitions describe the same file (or record) but are referred to by different names. Nonunique file (or record) definitions have the same name but do not define the same file (or record).

Coding rules

The following rules apply to coding the grouping statement:

Syntax

                         ┌────────────────────────────────────────┐
                         │                   ┌───────────────────┐│
►►─┬─ FILE-GROUPING ───┬─▼─┬─ file-name ───┬─▼─ IN program-name ─┴┴───────────►◄
   └─ RECORD-GROUPING ─┘   └─ record-name ─┘

Parameter list

FILE-GROUPING/RECORD-GROUPING

Identifies the statement as a grouping statement and specifies whether the statement applies to files or records.

file-name/record name

Identifies the file or record to be grouped. The name must be specified exactly as it appears in one or more of the programs being processed.

IN program-name

Specifies a program in which file-name or record-name appears. Program-name must be the internal PROGRAM-ID or, if the LIBRARY parameter has been used to rename the program, the member-name.

The entry IN program-name can be repeated (see note below) to name different programs in which the specified file or record appears. Multiple specifications of IN program-name for a single file or record name mean that the file or record uses the same name and is identical in each of the programs named.

Additionally, the entire specification of file-name/record-name IN program-name can be repeated (see note below). Multiple entities of this specification indicate file or record synonyms. For example, the file name INPFILE in the program TRAN and file name INPUT in program T2 both refer to the same file; INPFILE and INPUT are file synonyms.

Note: Up to a total of five program names can be specified in a single grouping statement. Each of the program names can be associated with different file or record names (that is, by repeating the entire specification or file-name/record-name IN program-name). Alternatively, multiple program names can be associated with the same file or record (that is, by creating only the specification of IN program-name for a single file or record).

Sample

The sample grouping statement shown below specifies the maximum allowable number of program names (that is, 5):

FILE-GROUPING INPFILE IN PROG1 IN PROG2 IN PROG3
 INPUT IN PROG4 TRANFILE IN PROG5

The names INPFILE, INPUT, and TRANFILE all refer to the same file, but these names appear in different programs. INPFILE refers to the file in the programs PROG1, PROG2, and PROG3; INPUT refers to the file in PROG4; TRANFILE refers to the file in PROG5.