HP RPG/XL Programmer's Guide (30318-90001)

1-5
initialized and the 1P and L0 indicators are turned on. All
files are prepared for processing and all preexecution-time
tables and arrays are read into memory. First-page alignment is
performed for printer files and all output controlled by the 1P
indicator is written. A record is read from each primary and
secondary input file. The program is now ready to begin the
main logic cycle.
2 Heading and Detail-Time Output
This begins the main logic cycle. The RPG program writes all
heading and detail records whose conditions are satisfied.
(Heading records are identified by an H in the Type Field of the
Output Specification; detail records are indicated by a D in the
Type Field.) The program tests the status of all halt
indicators (and halts if any are turned on), and turns off all
record-identifying and control-level indicators that are on.
All overflow indicators that were turned on before the last
detail calculations (done in Step 8) are turned off. RPG also
tests the LR indicator for end-of-program status and transfers
to Step 6 if this indicator is on.
_______________________________________________________________
NOTE The term "detail-time" used throughout this manual
collectively refers to detail-time calculations (occurring
in Step 8) followed by detail output (occurring in this
step).
_______________________________________________________________
3 Record Input
If there are no primary or secondary files, control goes to Step
6; otherwise, a record is read from the current file. If it is
end-of-file, control skips to Step 4. If the record has an
invalid record type or is in the wrong sequence and columns
56-71 of the Header Specification contains a pre-response to the
error, the pre-response is performed. If there is an error and
no pre-response is entered, the response comes from the operator
(session mode) or the job file (job mode).
4 Record Selection
If the program has just one input file, the next record from
that file is selected for processing. If the program has more
than one input file, the record is selected as follows:
a. If a file is FORCEd (uses the FORCE Calculation
Specification operation), the next record from that file is
selected.
b. If any input records without matching fields have been
read, the highest-priority record among them is chosen.
Primary file records have greatest priority, followed by
secondary file records in the order that they are entered in
the File Description Specifications.
c. If all input records have matching fields and the input
sequence is ascending, the lowest-sequenced record is chosen.
If all input records have matching fields and the input
sequence is descending, the highest-sequenced record is
chosen. If the matching fields are the same, the record with
the highest priority (see Step 4b.) is selected.
5 Control Break Check
If a control break occurs, the appropriate control-level
indicator and all lower-level indicators are turned on.
6 Total-Time Operations
If this is the first record with control level fields, the
program skips total-time operations. But, if this is not the