The L0 entry is used in positions 7 and 8 to indicate that the calculation is to be done during total time and is not dependent on the occurrence of a control break.
If indicators L1 through L9 are specified in positions 7 and 8, the calculation is processed at total time only when the specified indicator is on. Remember that, if L1 through L9 are set on by a control break, all lower level indicators are also set on. If positions 7 and 8 are blank, the calculation is done at detail time, is a statement within a subroutine, or is a declarative statement.
The following operations can be specified within total calculations with positions 7 and 8 blank: PLIST, PARM, KLIST, KFLD, TAG, DEFN, and ELSE. (Conditioning indicators in positions 9 through 17 are not allowed with these operations.) In addition, all the preceding operations except TAG and ELSE can be specified anywhere within the calculations, even between an ENDSR operation of one subroutine and the BEGSR operation of the next subroutine or after the ENDSR operation for the last subroutine.
The LR Indicator, if specified in positions 7 and 8, causes the calculation to be done during the last total time.
If there is a primary file but no secondary files in the program, the LR indicator is set on after the last input record has been read, the calculations specified for the record have been done, and the detail output for the last record read has been completed.
If there is more than one input file (primary and secondary), the RPG/400 programmer determines which files are to be checked for end-of-file by entering an E in position 17 of the file description specifications. LR is set on when all files with an end-of-file specification have been completely read, when detail output for the last record in these files has been completed, and after all matching secondary records have been processed.
When the LR indicator is set on after the last input record has been read, the control level indicators L1 through L9 are also set on. If the indicators L1 through L9 have not been defined by an entry in positions 59 and 60 of the input specifications or by *INxx when used in a result field, the indicators are set on when LR is on, but they cannot be used in other specifications.
An SR entry in positions 7 and 8 indicates that the specification is part of a subroutine. The SR entry is not required. Subroutine lines must appear after the total calculation specifications. The operation codes BEGSR and ENDSR serve as delimiters for a subroutine.
Positions 7 and 8 can contain AN or OR to define additional indicators (positions 9 through 17) for a calculation. Indicators in positions 9 through 17 contained in one line are always in an AND relationship. Indicators contained on more than one line can be a combination of AND and OR relationships. A maximum of seven AND/OR lines can be specified in one group.
The entry in positions 7 and 8 of the line immediately preceding an AND/OR line or a group of AND/OR lines determines when the calculation is to be processed. The entry in positions 7 and 8 on the first line of a group applies to all AND/OR lines in the group. A control level indicator (L1 through L9, L0, or LR) is entered for total calculations, an SR or blanks for subroutines, and a blank for detail calculations.
(C) Copyright IBM Corporation 1992, 2006. All Rights Reserved.