Previous Topic: SET During Record SelectionNext Topic: SKIPn Command


SET During Report Printing

(Area 4A)

This format of the SET command functions the same way during report printing as during record selection. The intention is to move data from one location to another. The differences are the timing of the execution of the movement and the types of data that can be processed.

Since the movement is performed during the printing of the reports, this format of the command can appear only within the report definition group. In addition, the data movement pertains only to the particular report in which it is coded.

You can specify data movement to be performed at detail time, total time, or both. When data is moved at detail time, input to the operation can be from the GSA and from the Hit File. When data is moved at total time, input can also be from field accumulators or control break values.

The SET during report printing command is coded as follows:

►►─┬──────────┬─ SET ─┬─ (D) ──┬──────────────────────────────────────────────►
   └─ label: ─┘       ├─ (DT) ─┤
                      └─ (T) ──┘

 ►─┬─ result ────────┬─ = ─┬─ fieldname ───────────────────┬──────────────────►
   ├─ result(n1.n2) ─┤     ├─ &'alphanumeric literal' ─────┤
   └─ result(n1) ────┘     └─ &numeric constant ───────────┘

 ►─┬─────────────────────────────────────────────────┬─┬─────────┬────────────►◄
   └─┬─ HEADING ─┬─ ' heading 1 ' ─┬───────────────┬─┘ └─ ROUND ─┘
     └─ HDG ─────┘                 └─ 'heading 2' ─┘
D

Specifies that the system is to perform data movement at detail time during printing of the report.

DT

Specifies that the system is to perform data movement at both detail time and total time.

T

Specifies that the system is to perform data movement at total time, (when a control break occurs).

result

Specifies the name of the field to which the data is moved. The field must reside in the GSA and be a packed decimal or an alphanumeric field.

result(n1.n2)

Specifies a user-supplied field name to which data is moved. Use of this parameter implicitly defines the field to contain the final result. The field generates in packed decimal format and resides in the GSA.

When the precision clause (n1.n2) does not follow the field name specifications, the Reporting Facility automatically calculates the precision of the result based on the attributes of the sending field. n1 and n2 indicate that the field is to contain n1 integers and n2 decimals, respectively.

The value of n1+n2 must be greater than 0 but not exceed 15. This field truncates if you are accumulating and the value exceeds 15. If the field contains no integers, n1 must not be 0. If no decimals are necessary, n2 must be 0.

result(n1)

Specifies a user-supplied field name to which data is moved. Using this parameter implicitly defines the field to contain the result.

The field is generated as an alphanumeric field and resides in the GSA. n1 indicates the length of the field, in bytes, and must not exceed 256. When you omit n1 and the field name denoted by result is not predefined, a field is generated with the same length as the sending field.

fieldname

Specifies the name of a predefined scalar variable or array element, residing in either the input record area or the GSA, to be moved to the result field. In other words, this is the sending field. When the field name is prefixed with an ampersand (&), the value is to be taken during report printing from the final presort of the GSA or the result field of a previously executed SET or COMPUTE command.

&numeric constant

Specifies an absolute numeric constant to be moved to the result field. It can be any valid numeric literal. The receiving field of the SET operation must be defined as numeric, packed decimal, zoned decimal, binary, or unsigned binary.

&'alphanumeric literal'

Specifies an alphanumeric constant, enclosed in apostrophes, as the sending field. When used, the result field must be defined as alphanumeric.

HEADING

Is an optional separator used to denote that subsequent literals are to be interpreted as headings. Heading specifications are valid only when the result field of the SET operation is being implicitly defined. HDG can be used in place of HEADING.

'heading 1' 'heading 2'

Allows you to assign one or two heading lines to the result field when the field is implicitly defined in the SET command. The heading lines appear as column headings if the field is printed in a report. If you omit the parameter and implicitly define the result field, the Reporting Facility assigns the field name as heading line 1, with no second heading line.

ROUND

Optionally defines whether the result will be rounded before being placed into the result field. For rounding to occur, the computed value must have more decimal places than the result field. The default is not to round.

Note the following:

Example

Examples of using the SET command during report printing:

  SET(D) RESULT-FIELD EQ &100.5 ROUND
  
  SET(T) RESULT-FIELD EQUAL TO (INPUT-FIELD)

  SET(DT) ALPHA-FIELD(7) TO &'ABCDEFG' HDG 'ALPHA' 'FIELD' ROUND

  SET(T) ALPHA-FIELD-A(7) = (ALPHA-FIELD-B)