Software AG Products 2.4.1 | Reference Guide | Declaration Command | field-expressions | Multiple Value within a Periodic Group
 
Multiple Value within a Periodic Group
A multiple value field that occurs within a periodic group may be specified with its name or by specifying the periodic group name. If you specifies a name of a periodic group that contains multiple values, the record buffer definition will be as for a regular periodic group with occurrences for the multiple values, as well. For example:
@ADADCL6, EMPLOYEES, INCOME.
The record buffer definition is:
01 RECORD-BUF6.
02 G-INCOME6.
03 INCOME6 OCCURS 10.
04 CURR-CODE6 PIC X(3).
04 SALARY6 PIC 9(9) COMP-3.
04 BONUS6 PIC 9(9) COMP-3 OCCURS 8.
If you specify the name of the multiple value field, Adabas Pre-Compiler takes the occurrence number of both the multiple value and the periodic group from Predict. The multiple value field will be declared with level 3, while in level 2 the same field name will be declared having a prefix of "A-." For example:
@ADADCL4, EMPLOYEES, BONUS.
The record buffer definition is:
01 RECORD-BUF4.
02 A-BONUS4 OCCURS 10.
03 BONUS4 PIC 9(9) COMP-3 OCCURS 8.
If you wish to specify a certain range of the multiple value or a certain occurrence, add it to the field name with parenthesis. In this case, if the range does not start from the first occurrence, the field name in the record buffer will have an additional suffix of the range or the occurrence and the field in level 2 will have the same suffix.
If you wish to specify a certain range of the periodic group or a certain occurrence, specify the occurrences of the multiple value, as well.
The valid formats of using multiple value fields within a periodic group are:
MP
MP specifies range of occurrences of the multiple value within each of a range of occurrences of the periodic group. The occurrences of both multiple value and periodic group are taken from Predict as in the above examples.
MP(i)
MP(i) specifies a single occurrence of the multiple value within each of a range of occurrences of the periodic group. The occurrence number is represented by "I" and the range of occurrences of the periodic group is taken from Predict. The field name in the record buffer will have an additional suffix of "-" and the occurrence number. The same additional suffix will apply to the field in level 2. For example:
@ADADCL4, EMPLOYEES, BONUS(5).
The record buffer definition is:
01 RECORD-BUF4.
02 A-BONUS4-5 OCCURS 10.
03 BONUS4-5 PIC 9(9) COMP-3.
MP(i-j)
MP(i-j) specifies a range of occurrences of the multiple value within each of a range of occurrences of the periodic group. The range of the multiple value is represented by "i"-"j" and the range of the periodic group is taken from Predict. If the range of the multiple value does not start from the first occurrence, the field name in the record buffer will have an additional suffix of "-" followed by the range. The same additional suffix will apply to the field in level 2. For example:
@ADADCL5, EMPLOYEES, BONUS(2-5).
The record buffer definition is:
01 RECORD-BUF5.
02 A-BONUS5-2-5 OCCURS 10.
03 BONUS5-2-5 PIC 9(9) COMP-3 OCCURS 4.
MP(var)
MP(var) specifies a single occurrence of the multiple value within each of a range of occurrences of the periodic group.
The occurrence number is not fixed and is represented by a user-variable name, that should contain a numeric value at execution time. The range of the periodic group is taken from Predict.
The field name in the record buffer will not have any additional suffix and it may appear only once in a declaration. For example:
@ADADCL6, EMPLOYEES, BONUS(MCINDEX).
The record buffer definition is:
01 RECORD-BUF6.
02 A-BONUS6 OCCURS 10.
03 BONUS6 PIC 9(9) COMP-3.
The MCINDEX user-variable should contain the occurrence number before the read or update command.
MP(LAST)
MP(LAST) specifies the last occurrence of the multiple value within each of a range of occurrences of the periodic group. The range of occurrences of the periodic group is taken from Predict. Adabas returns the last occurrence of the multiple value for each occurrence of the periodic group in every record. The field name in the Record buffer will not have any additional suffix. This format is valid only for retrieval commands. For example:
@ADADCL61, EMPLOYEES, BONUS(LAST).
The record buffer definition is:
01 RECORD-BUF61.
02 A-BONUS61 OCCURS 10.
03 BONUS61 PIC 9(9) COMP-3.
MP(i(k))
MP(i(k)) specifies a single occurrence of the multiple value within a single occurrence of the periodic group. The occurrence of the multiple value is represented by "k". The field name in the record buffer representing the multiple value will have an additional suffix of "-" followed by the occurrence number "k". In level 2. the additional suffix will be "-" followed by the periodic group occurrence "i." For example:
@ADADCL5, EMPLOYEES, BONUS(6(2)).
The record buffer definition is:
01 RECORD-BUF4.
02 A-BONUS4-6.
03 BONUS4-2 PIC 9(9) COMP-3.
MP(i(k-1))
MP(i(k-1)) specifies a range of occurrences of the multiple value within the "i-"position occurrence of the periodic group. The range of occurrences of the multiple value is represented by "k"-"l."
The field name in the record buffer representing the periodic group (level 2) will have an additional suffix of "-" followed by "i." If the range of occurrences of the multiple value does not start from the first occurrence, the field name in the record buffer will have an additional suffix of "-" followed by the range. For example:
@ADADCL51, EMPLOYEES, BONUS(5(2-4)).
The record buffer definition is:
01 RECORD-BUF4.
02 A-BONUS4-5.
03 BONUS4-2-4 PIC 9(9) COMP-3 OCCURS 3.
MP(i(var))
MP(i(var)) specifies a single occurrence of the multiple value within the "i-"position occurrence of the periodic group. The occurrence number is not fixed and is represented by a user-variable name, that should contain a numeric value at execution time.
The field name in the record buffer representing the periodic group (level 2) will have an additional suffix of "-" followed by "i" and the multiple value name will have the same additional suffix. For example:
@ADADCL6, EMPLOYEES, BONUS(5(MCINDEX)).
The record buffer definition is:
01 RECORD-BUF6.
02 A-BONUS6-5.
03 BONUS6-5 PIC 9(9) COMP-3.
The MCINDEX user-variable should contain the occurrence number before the read or update command.
MP(i(LAST))
MP(i(LAST)) specifies the last occurrence of the multiple value within the "i-"position occurrence of the periodic group. Adabas returns the last occurrence of the multiple value in the "i-"position occurrence of the periodic group for every record.
The field name in the record buffer representing the periodic group (level 2) will have an additional suffix of "-" followed by "I" and the multiple value name will have the same additional suffix. This format is valid only for retrieval commands. For example:
@ADADCL62, EMPLOYEES, BONUS(5(LAST)).
The record buffer definition is:
01 RECORD-BUF62.
02 A-BONUS62-5.
03 BONUS62-5 PIC 9(9) COMP-3.
MP(i-j(k))
MP(i-j(k)) specifies a single occurrence "k" of the multiple value within each of a range of occurrences "i"-"j" of the periodic group.
The multiple value field name in the record buffer will have an additional suffix of "-" followed by "k." If the range of occurrences of the periodic group does not start from the first occurrence, the field name in the record buffer representing the periodic group (level 2) will have an additional suffix of "-" followed by the range. For example:
@ADADCL6, EMPLOYEES,BONUS(2-4(2)).
The record buffer definition is:
01 RECORD-BUF6.
02 A-BONUS6-2-4 OCCURS 3.
03 BONUS6-2 PIC 9(9) COMP-3.
MP(i-j(k-1))
MP(i-j(k-1)) specifies a range of occurrences "k" - "l" of the multiple value within each of a range of occurrences "i" - "j" of the periodic group.
If the range of occurrence of the multiple value does not start from the first occurrence, the field name in the record buffer representing the multiple value will have an additional suffix of "-" followed by the range "k"-"l".
If the range of occurrences of the periodic group does not start from the first occurrence, the field name in the record buffer representing the periodic group will have an additional suffix of "-" followed by the range "i"-"j". For example:
@ADADCL61, EMPLOYEES, BONUS(1-5(1-2))
BONUS(7-8(2-3)).
The record buffer definition is:
01 RECORD-BUF61.
02 A-BONUS61 OCCURS 5.
03 BONUS61 PIC 9(9) COMP-3 OCCURS 2.
02 A-BONUS61-7-8 OCCURS 2.
03 BONUS61-2-3 PIC 9(9) COMP-3 OCCURS 2.
MP(i-j(var))
MP(i-j(var)) specifies a single occurrence of the multiple value within each of a range of occurrences "i"-"j" of the periodic group. The multiple value occurrence number is not fixed and is represented by a user-variable name, that should contain a numeric value at execution time.
If the range of occurrences of the periodic group does not start from the first occurrence, the field name in the record buffer representing both the periodic group and the multiple value will have an additional suffix of "-" followed by the range "i"-"j". For example:
@ADADCL611, EMPLOYEES, BONUS(1-5(MINDEX)).
The record buffer definition is:
01 RECORD-BUF611.
02 A-BONUS611 OCCURS 5.
03 BONUS611 PIC 9(9) COMP-3.
The MINDEX user variable should contain the occurrence number before the read or update command.
MP(i-j(LAST)
MP(i-j(LAST) specifies the last occurrences of the multiple value within each of a range of occurrences "i"-"j" of the periodic group. Adabas returns the last occurrence for every element of the periodic group in every record. This format is valid only for retrieval statements.
If the range of occurrences of the periodic group does not start from the first occurrence, the field name in the record buffer representing the periodic group (level 2) will have an additional suffix of "-" followed by the range "i"- "j". The field name in the record buffer representing the multiple value will have the same additional suffix. For example:
@ADADCL71, EMPLOYEES, BONUS (3-6(LAST)).
The record buffer definition is:
01 RECORD-BUF71.
02 A-BONUS71-3-6 OCCURS 4.
03 BONUS71-3-6 PIC 9(9) COMP-3.
MP(var(k))
MP(var(k)) specifies a single occurrence of the multiple value within a singe occurrence of the periodic group.
The multiple value occurrence is fixed and is represented by "k." The periodic group occurrence is not fixed and is represented by a user variable name that should contain a numeric value at execution time. The field name in the record buffer representing the multiple value will have an additional suffix of "-" followed by the occurrence, while the field name representing the periodic group (level 2) will not have any additional suffix. For example:
@ADADCL612, EMPLOYEES, BONUS(PINDEX(4)).
The record buffer definition is:
01 RECORD-BUF612.
02 A-BONUS612.
03 BONUS612-4 PIC 9(9) COMP-3.
The PINDEX user variable should contain the occurrence number before the read or update command.
MP(var(k-l)
MP(var(k-l) specifies a range of occurrences "k"-"l" of the multiple value within a single occurrence of the periodic group. The periodic group occurrence is not fixed and is represented by a user-variable name that should contain a numeric value at execution time.
If the range of occurrences of the multiple value does not start from the first occurrence, the field name in the record buffer representing the multiple value will have an additional suffix of "-" followed by the range "k"-"l". The field name representing the periodic group (level 2) will not have any additional suffix. For example:
@ADADCL72, EMPLOYEES, BONUS(ICINDEX(2-5)).
The record buffer definition is:
01 RECORD-BUF72.
02 A-BONUS72.
03 BONUS72-2-5 PIC 9(9) COMP-3 OCCURS 4.
The ICINDEX user variable should contain the occurrence number before the read or update command.
MP(var1(var2))
MP(var1(var2)) specifies a single occurrence of the multiple value within a single occurrence of the periodic group. Both occurrences are not fixed and are to be different for every record according to the user variables var1 (the periodic group) and var2 (the multiple value). Those variables should contain a numeric value at execution time. The field names in the record buffer do not have any additional suffix. For example:
@ADADCL721, EMPLOYEES, BONUS(PINDEX(MINDEX)).
The record buffer definition is:
01 RECORD-BUF721.
02 A-BONUS721.
03 BONUS721 PIC 9(9) COMP-3.
The PINDEX and MINDEX user variables should contain the occurrence number before the read or update command.
MP(var(LAST))
MP(var(LAST)) specifies the last occurrence of the multiple value within a single occurrence of the periodic group. The occurrence of the periodic group is not fixed and is represented by a user variable name that should contain a numeric value at execution time. The field names in the record buffer do not have any additional suffix. This format is valid only for retrieval statements. For example:
@ADADCL722,EMPLOYEES,BONUS(PINDEX(LAST)).
The record buffer definition is:
01 RECORD-BUF722.
02 A-BONUS722.
03 BONUS722 PIC 9(9) COMP-3.
The PINDEX user variable should contain the occurrence number before the read or update command.
MP(LAST(k))
MP(LAST(k)) specifies a single occurrence of the multiple value within the last occurrence of the periodic group. The multiple value occurrence is fixed and is represented by "k". The field name in the record buffer representing the multiple value will have an additional suffix of "-" followed by "k". The field name is the record buffer representing the periodic group will not have any additional suffix. This format is valid only for retrieval statements. For example:
@ADADCL723,EMPLOYEES,BONUS(LAST(6)).
The record buffer definition is:
01 RECORD-BUF723.
02 A-BONUS723.
03 BONUS723-6 PIC 9(9) COMP-3.
MP(LAST(k-l))
MP(LAST(k-l)) specifies a range of occurrences of the multiple value "k"-"l" in the last occurrence of the periodic group. Adabas returns the last occurrence in every record. This format is valid only for retrieval statements.
If the range of occurrences of the multiple value does not start from the first occurrence, then the field name in the record buffer representing the multiple value will have an additional suffix of "-" followed by the range. For example:
@ADADCL8, EMPLOYEES,BONUS(LAST(2-4)).
The record buffer definition is:
01 RECORD-BUF8.
02 A-BONUS8.
03 BONUS8-2-4 PIC 9(9) COMP-3 OCCURS 3.
MP(LAST(var))
MP(LAST(var)) specifies a single occurrence of the multiple value within the last occurrence of the periodic group. The occurrence of the multiple value is not fixed and is represented by a user variable name, that should contain a numeric value at execution time. The field names in the record buffer will not have any additional suffix.
This format is valid only for retrieval statements. For example:
@ADADCL724,EMPLOYEES,BONUS(LAST(MINDEX)).
The record buffer definition is:
01 RECORD-BUF724.
02 A-BONUS724.
03 BONUS724 PIC 9(9) COMP-3.
The MINDEX user variable should contain the occurrence number before the read or update command.
MP(LAST(LAST))
MP(LAST(LAST)) specifies the last occurrence of the multiple value within the last occurrence of the periodic group in every record. This format is valid only for retrieval statements. The field names in the record buffer will not have any additional suffix. For example:
@ADADCL73, EMPLOYEES, BONUS(LAST(LAST)).
The record buffer definition is:
01 RECORD-BUF73.
02 A-BONUS73.
03 BONUS73 PIC 9(9) COMP-3.
MP(i(k-LAST))
MP(i(k-LAST)) specifies a range occurrences from "k" till the last occurrence of the multiple value within the "i-"position occurrence of the periodic group.
This format is valid only as the last item in the field expressions and only for retrieval statements. Actually Adabas Pre-Compiler will generate the range of occurrences until the 191st occurrence but Adabas will fill it only until the last occurrence exists for that occurrence of the periodic group.
The field name in the record buffer representing the periodic group (level 2) will have an additional suffix of "-" followed by "i". If the range of occurrences of the multiple value does not start from the first occurrence then the field name in the record buffer representing the multiple value will have an additional suffix of "-" followed by "k" followed by "-191". For example:
@ADADCL8, EMPLOYEES, BONUS(6(3-LAST)).
The record buffer definition is:
01 RECORD-BUF8.
02 A-BONUS8-6.
03 BONUS8-3-191 PIC 9(9) COMP-3 OCCURS 188.
MP(var(k-LAST))
MP(var(k-LAST)) specifies a range of occurrences from "k" till the last occurrence of the multiple value within a single occurrence of the periodic group. The occurrence of the periodic group is not fixed and is represented by a user variable name that should contain a numeric value at execution time. This format is valid only as the last item in the field expressions and only for retrieval statements.
Adabas Pre-Compiler will generate the range of occurrences until the 191st occurrence but ADABAS will fill it only until the last occurrence exists for that occurrence of the periodic group. The field name in the record buffer representing the periodic group will not have any additional suffix. If the range of occurrences of the multiple value does not start from the first occurrence, then the field name in the record buffer representing the multiple value will have an additional suffix of "-" followed by "k" followed by "-191 ". For example:
@ADADCL81, EMPLOYEES, BONUS(ICINDEX(1-LAST)).
The record buffer definition is:
01 RECORD-BUF81.
02 A-BONUS81.
03 BONUS81 PIC 9(9) COMP-3 OCCURS 191.
The ICINDEX user variable should contain the occurrence number before the read or update command.
MP(LAST(k-LAST))
MP(LAST(k-LAST)) specifies a range of occurrences from "k" to the last occurrence of the multiple value within the last occurrence of the periodic group. This format is valid only as the last item in the field expression and only for retrieval statements.
Actually Adabas Pre-Compiler will generate the range of occurrences until the 191st but ADABAS will fill it only until the last occurrence exists for the last occurrence of the periodic group. The field name in the record buffer representing the periodic group will not have any additional suffix. If the range of occurrences of the multiple value does not start from the first occurrence, then the field name in the record buffer representing the multiple value will have an additional suffix of "-" followed by "k" followed by "-191". For example:
@ADADCL811, EMPLOYEES, BONUS(LAST(1-LAST)).
The record buffer definition is:
01 RECORD-BUF811.
02 A-BONUS811.
03 BONUS811 PIC 9(9) COMP-3 OCCURS 191.
MP(COUNTi), MP(COUNTi-j)
MP(COUNTi), MP(COUNTi-j) specify the count of the multiple value within a specific occurrence of the periodic group or a range of occurrences of the periodic group. For every occurrence of the periodic group there is a count of the multiple value and the user may request the count of a specific occurrence or a range of occurrences. Adabas Pre-Compiler will generate a separate field for every count requested. In case of a range of counts, Adabas Pre-Compiler will generate a list of separate fields.
The field name in the record buffer will be the multiple value name with a prefix of "C- " and an additional suffix of "-" followed by the periodic group occurrence number. Forexample:
@ADADCL6, EMPLOYEES, BONUS(COUNT1)
BONUS(COUNT2-4).
The record buffer definition is:
01 RECORD-BUF6.
02 C-BONUS6-1 PIC 9(4) COMP.
02 C-BONUS6-2 PIC 9(4) COMP.
02 C-BONUS6-3 PIC 9(4) COMP.
02 C-BONUS6-4 PIC 9(4) COMP.
MP(COUNTLAST)
MP(COUNTLAST) specifies the count of the multiple value within the last occurrence of the periodic group. The field name in the record buffer will not have any additional suffix. For example:
@ADADCL61, EMPLOYEES, BONUS(COUNTLAST).
The record buffer definition is:
01 RECORD-BUF61.
02 C-BONUS61 PIC 9(4) COMP.