ACCUM (A)
The ACCUM parameter accumulates specified fields in the input records. It can be used at any time and with any function. Accumulations may be used to total fields containing numeric character, packed decimal, or binary data. See SYSTOTAL Output for report examples.
The ACCUM parameter has two syntax forms for accumulating different data types:
Character or binary data accumulation syntax:
Packed decimal data accumulation syntax:
location
Any valid actual or relative input location can be used as long as it does not exceed the record size.
length
Length of the field to accumulate. This element is not specified when the data to accumulate is packed decimal. File-AID automatically determines the length of a packed field (For more information, see Packed Data). For character and binary data accumulations, the length must be specified. Maximum length values vary based on the type of data being accumulated as follows:
Character data
31 bytes
Binary data
8 bytes
data-type
Type of data to accumulate. This element is not specified when accumulating packed decimal data. For character and binary data accumulations, the data-type must be specified. Valid data-type values are:
C | Signed or unsigned numeric characters |
B | Binary |
BS | Binary signed. |
When accumulating character data (data-type = C), each record selected for accumulation must have valid numeric character data at the specified location. If invalid numeric data is found, an error is detected and processing is terminated.
When accumulating packed data, length and data-type need not be specified. However, each record selected for accumulation must have valid packed data at the specified location. If invalid packed data is found, an error is detected and processing is terminated.
For a binary data type “B”, a length of 8 is always signed. Lengths 1, 2, 3, and 4 are unsigned. Use a binary data type “BS” to have File-AID treat a length of 1, 2, 3, or 4 as a signed binary integer. The following table shows examples of interpreted data values.
Interpreted Hex Data Values for Sign
Data Value | Decimal Value |
|---|---|
Unsigned HEX 80 | 128 |
Signed HEX 80 | -128 |
Unsigned HEX 8000 | 32768 |
Signed HEX 8000 | -32768 |
Unsigned HEX 800000 | 8388608 |
Signed HEX 800000 | -8388608 |
Unsigned HEX FF | 255 |
Signed HEX FF | -1 |
Unsigned HEX FFFF | 65535 |
Signed HEX FFFF | -1 |
Unsigned HEX FFFFFF | 16777215 |
Signed HEX FFFFFF | -1 |
description
Optional description of accumulated fields that appears on the output report. A maximum of 25 alphanumeric characters can be entered; they must be enclosed in single quotes. If no description is specified, File-AID prints the field’s location as the description.
Example 1:
IF=(43,EQ,C’101’),ACCUM=(46,’BIN-101-WGT’)
Example 1 copies the input dataset while selecting records for accumulation that contain the string 100 or 101 in location 43. The records are selected by the IF parameters, and the ACCUM parameters total the packed field beginning in location 46. When executed, the totals appear on the SYSTOTAL dataset, and are labeled BIN-100-WGT and BIN-101-WGT.
Example 2:
IF=(14,EQ,C’01’),
ACCUM=(18,4,B,’JANUARY-1991’),
IF=(10,EQ,C’90’),
IF=(14,EQ,C’01’),
ACCUM=(18,4,B,’JANUARY-1990’)
Example 2 uses ACCUM with a TALLY function with more than one group of selection parameters. The first group of parameters selects all records that contain the characters 91 in location 10 and the characters 01 in location 14. The selected records are accumulated on the 4-byte binary field beginning in location 18. The resulting total is labeled JANUARY-1991. The second parameter group selects and accumulates the records for the total labeled JANUARY-1990.
Example 3:
OR=(1,EQ,C'D01'),AND=(120,NE,C'R'),
ACCUM=(2,2,C,'XYZ TOTALS')
Example 3 includes two selection sets. The first set locates any record with a value of 'C01' in position 1 and does not contain a value of 'R' in position 178. Since there is no action parameter for this first selection set, no accumulation takes place. The second selection set locates records that have a value of 'D01' in position 1 and do not contain a value of 'R'.