|
HP COBOL Reference Manual
5.3.47 SOURCE
Function
The SOURCE clause identifies a data item to be sent to an associated
printable item defined within a Report Group Description entry.
source-id
names an elementary item in the Data Division.
Syntax Rules
- If source-id is a Report Section item it must be either:
- A PAGE-COUNTER
- A LINE-COUNTER
- A sum counter that is part of the report within which the SOURCE
clause appears
- The Report Writer Control System (RWCS) moves the contents of
source-id to the printable item. source-id
definitions must conform to the rules for sending items in the MOVE
statement.
General Rule
The RWCS executes implicit MOVE statements specified by the SOURCE
clauses when it formats the print lines (just before it presents them).
Additional References
5.3.48 SUM
Function
The SUM clause establishes a Report Writer sum counter and names the
data items to be summed.
sum-name
names a numeric data item with an optional sign in the Subschema, File,
Working-Storage, or Linkage Sections, or another sum counter in the
Report Section.
detail-report-group-name
names a DETAIL report group.
control-foot-name
must reference a control-name in the report's CONTROL clause.
Syntax Rules
- A SUM clause can appear only in the description of a CONTROL
FOOTING report group.
- If there is no UPON phrase, any sum-name in the SUM clause
that is itself a sum counter must be defined either in the same report
group that contains this SUM clause or in a report group at a lower
level in the control hierarchy of this report.
If there is an UPON
phrase, sum-name must not reference a sum counter.
- If the associated report file connector is an external file
connector and if sum-name references a numeric data item in
the Subschema, File, Working-Storage, or Linkage Sections, then
sum-name must reference the same external data item in all
programs in the run unit.
- detail-report-group-name must be a control-name
in a CONTROL clause and must be the name of a DETAIL report group
described in the same report as the CONTROL FOOTING report group in
which the SUM clause appears.
- detail-report-group-name may be qualified by a report-name.
- control-foot-name must not be at a lower control level
than the associated control level for the report group in which the
RESET phrase appears.
If FINAL appears in the RESET phrase, FINAL
must also appear in the CONTROL clause for this report.
- The highest permissible qualifier for sum-name is the
report-name.
General Rules
- The SUM clause establishes a sum counter. At run time, the Report
Writer Control System (RWCS) adds the value in each sum-name
to the sum counter. This addition is consistent with the rules for
arithmetic statements.
- The UPON phrase provides for selective subtotalling. Subtotalling
occurs each time the RWCS processes the DETAIL report group referenced
by detail-report-group-name.
- If there is a RESET phrase, the RWCS will set the sum counter to
zero when the RWCS is processing the designated level of control
hierarchy. If there is no RESET phrase, the RWCS will set the sum
counter in the CONTROL FOOTING report group to zero when the RWCS
processes that report group.
The RWCS initially sets sum counters
to zero during the execution of the INITIATE statement for the report
containing the sum counter.
- The size of the sum counter is equal to the number of receiving
character positions defined in the PICTURE clause that accompanies the
SUM clause in the description of the elementary item.
- Only one sum counter exists for an elementary report entry,
regardless of the number of SUM clauses specified in the elementary
report entry.
- If the elementary report entry for a printable item contains a SUM
clause, the sum counter serves as a source data item. On a control
break, the RWCS moves the data from the sum counter to the printable
item for presentation according to the rules of the MOVE statement.
- If a data-name appears as the subject of an elementary report entry
that contains a SUM clause, the data-name is the name of the sum
counter; the data-name is not the name of a printable item that the
entry may also define.
- Procedure Division statements can alter the contents of sum
counters.
- During the execution of GENERATE and TERMINATE statements, the RWCS
adds the values in sum-name to a sum counter.
- The RWCS adds each individual sum-name into the sum
counter when it processes the CONTROL FOOTING report group defining the
sum counter.
Technical Notes
- The three categories of sum counter accumulation are as follows:
- Subtotalling
- Crossfooting
- Rolling forward
Subtotalling occurs only during execution of GENERATE statements
and after any control break processing but before processing of the
DETAIL report group. Crossfooting and rolling forward occur during the
processing of CONTROL FOOTING report groups.
- Subtotalling accumulates numeric data fields (sum-names)
into a sum counter. sum-name must not reference a sum counter
when subtotalling. If the SUM clause contains the UPON phrase,
sum-names are subtotalled when a GENERATE statement executes
for a DETAIL report group. If there is no UPON phrase,
sum-names are subtotalled when any GENERATE data-name
statement is executed for the report in which the SUM clause appears.
- Crossfooting accumulates sum counters (sum-name) from the
same CONTROL FOOTING report group into another sum counter. It is a
horizontal sum of sums.
Crossfooting occurs when a control break
takes place and when the CONTROL FOOTING report group is processed.
Crossfooting is performed according to the sequence in which sum
counters are defined within the CONTROL FOOTING report group. That is,
all crossfooting into the first sum counter defined in the CONTROL
FOOTING report group is completed, and then all crossfooting into the
second sum counter defined in the CONTROL FOOTING report group is
completed. This procedure repeats until all crossfooting operations are
completed. When one of the sum-names is the sum counter
defined by the Data Description entry in which that sum clause appears,
the initial value of that sum counter is used in the summing operation.
- Rolling forward accumulates sum counters (sum-name)
defined in lower level CONTROL FOOTING report groups into another sum
counter. It is a vertical sum of sums. A sum counter in a lower level
CONTROL FOOTING report group is rolled forward when a control break
occurs and at the time the lower level CONTROL FOOTING report group is
processed.
- If two or more sum-names specify the same sum counter,
then the sum counter is added as many times as the sum counter is
referenced in the SUM clause. It is permissible for two or more of the
sum-names to specify the same DETAIL report group. When a
GENERATE data-name statement for such a DETAIL report group is given,
the incrementing occurs repeatedly, as many times as the
sum-name appears in the UPON phrase.
Additional References
5.3.49 SYNCHRONIZED
Function
The SYNCHRONIZED clause specifies elementary item alignment on word
boundary offsets relative to a record's beginning. These offsets are
related to the size and usage of the item being stored.
Syntax Rules
- SYNC is an abbreviation for SYNCHRONIZED.
- The SYNCHRONIZED clause can be used only for an elementary item.
General Rules
- The SYNCHRONIZED clause aligns a data item in a record so that no
other data item occupies any character positions between the required
boundaries to the left and right of the data item.
- If the number of character positions needed to store the data item
is less than the number of positions between the required boundaries,
no other data items occupy the unused positions.
However, the
unused character positions are included in the size of those group
items:
- To which the elementary item belongs
- In which the elementary item is not the first subordinate item
The first elementary item in a group item always aligns on the same
boundary as the group item. In this case, any unused character
positions do not affect the size of that group item.
- The size of a SYNCHRONIZED data item equals the number of character
positions between its natural boundaries. Therefore, the LEFT and RIGHT
phrases have the same effect; they are equivalent to each other, and to
the SYNCHRONIZED clause with neither the LEFT nor RIGHT phrases.
- The SYNCHRONIZED clause does not change the size or operational
sign position of the data item it specifies.
- Each occurrence of the data item is synchronized if the clause
applies to a data item whose data description entry also has an OCCURS
clause, or to a data item subordinate to another data item whose data
description entry has an OCCURS clause.
Technical Notes
- The SYNCHRONIZED clause does not affect the alignment of DISPLAY
data items.
- The SYNCHRONIZED clause explicitly aligns COMP, COMP-1, COMP-2,
POINTER, and INDEX data items on boundaries that are related to the
size of the item.
One word COMP items are aligned on 2-byte
boundaries, longword items on 4-byte boundaries, and quadword items on
8-byte boundaries. All boundaries are relative to the beginning of the
record containing the data item.
- The following table shows the alignment for each data type that the
SYNCHRONIZED clause affects:
Data Type |
Boundary |
COMP (1 to 4 digits)
|
2-byte
|
COMP (5 to 9 digits)
|
4-byte
|
COMP (10 to 18 digits)
|
8-byte
|
COMP (19 to 31 digits)
|
16-byte
|
COMP-1
|
4-byte
|
COMP-2
|
8-byte
|
INDEX
|
4-byte
|
POINTER
|
4-byte (OpenVMS)
|
POINTER
|
8-byte (Tru64 UNIX)
|
|