GLOBAL
GLOBAL uses the global area provided by Data Solutions for calculations on multiple fields and/or multiple records. You can use this exit to save (STORE) the data from one or more fields into the global area. You can then associate the GLOBAL exit with a different data field to retrieve (FETCH) the saved data into that field.
The first time this exit receives control from Data Solutions, it initializes all the global areas. The numeric fields are set to zero and the character field to spaces. The following table describes the parameter positions for the GLOBAL field exit. When entering the GLOBAL parameters, the following applies: Function codes must be left-justified, blank-filled, and uppercase. Alpha values must be uppercase. Multi-column values must be left-justified.
GLOBAL Parameters
Function Code | Position | Value Description |
---|---|---|
STORE | 1-5 | STORE function code: Save data from the record in a global area. |
6 | Specify a valid area designator for the destination field: C Global character area (see description for 7-9). The total maximum length is 166 bytes. 1 - 9 Global numeric area. Choose from nine separate global areas. | |
7-9 | Specify the global character area starting position. This field is only valid when position 6=’C’. blank The default starting position is one. 1-166 Specific starting position. The maximum length is 166 bytes. The field is not allowed to extend beyond position 166. | |
FETCH | 1-5 | FETCH function code: Move data from a global area into the record. |
6 | Specify a valid area designator for the source field: C Global character area (see description for 7-9). The total maximum length is 166 bytes. 1 - 9 Global numeric area. Choose from nine separate global areas. | |
7 | U Store value in record as unsigned. The default is signed. | |
7-9 | Specify the global character area starting position. This field is only valid when position 6=’C’. blank The default starting position is one. 1-166 Specific starting position. The maximum length is 166 bytes. If the record field length is longer than the implied global length (167 - starting position), the remaining record positions are unchanged and padding does not take place. | |
RESET | 1-5 | RESET function code: Clear/reset the specified global area(s). |
6-15 | You may specify up to 10 areas: C Set global character area to spaces (166 bytes). 1 - 9 Set specified global numeric area to zeros. Choose from nine separate global areas. | |
ACCUM | 1-5 | ACCUM function code: Accumulate a field into a global area. |
6 | Specify a valid area designator for the destination field: 1 - 9 Global numeric area. Choose from nine separate global areas. | |
INIT | 1-5 | INIT function code: Set the designated area to the specified number. |
6 | Specify a valid area designator for the area to initialize: R Initialize the field in the data record. 1 - 9 Initialize the specified global numeric area. Choose from nine separate global areas. | |
7-25 | Specify a number value to move to the specified area. The number must be an integer, from 1-18 digits, and without commas or a decimal point. Signed numbers are allowed. The sign may be a separate trailing or leading position or the last digit may contain an embedded sign. | |
ADD | 1-5 | ADD function code: Add the specified number to the designated area. |
SUB | 1-5 | SUB function code: Subtract specified number from designated area. |
6 | Specify the results field: R Update the field in the record. The results in the record are based on the original sign in the record (unsigned remains unsigned). 1 - 9 Update a global numeric area. Choose from 9 separate global areas. | |
7-25 | Specified number. Value added to or subtracted from the specified area. Number must be an integer, from 1-18 digits, and without commas or a decimal point. Signed numbers are allowed. The sign may be a separate trailing or leading position or the last digit may contain an embedded sign. All designated areas are treated as integers. Decimal places implied by any associated PICTURE are ignored. | |
MULT | 1-5 | MULT function code: Multiply designated area by specified number. |
DIV | 1-5 | DIV function code: Divide designated area by specified number. |
6 | Specify the results field: R Update the field in the record. The results in the record are based on the original sign in the record (unsigned remains unsigned). 1 - 9 Update a global numeric area. Choose from 9 separate global areas. | |
7-26 | Specified number. Multiply or divide the specified area by this value. Number may contain a decimal point but no commas are allowed. The integer portion may be from 0 -12 digits. The decimal fraction may be from 0 - 6 digits. Signed numbers are allowed. The sign may be a separate trailing or leading position or the last digit may contain an embedded sign. The results are rounded to the nearest integer. All designated areas are treated as integers. Decimal places implied by any associated PICTURE are ignored. | |
CALC | 1-5 | CALC function code: Perform the specified calculation using specified areas. |
6 | Specify the results field: R Update the field in the record. The results in the record are always signed. 1 - 9 Update a global numeric area. Choose from 9 separate global areas. | |
7-25 | Specify the calculation formula. Specify the designated area(s) and operator(s) in the pattern AOAOAOAO...A. A Designated area. (See position 6 values 'R' OR '1' - '9') You may specify up to 10 designated areas. O Operator. Valid operators are: + ADD - SUBTRACT
/ DIVIDE You may specify up to 9 operators and 10 areas. Calculations are performed left to right in the order specified. All numbers are treated as integers. Decimal places implied by any associated PICTURE are ignored. |
Record Output Field Format
- Character fields may be 1 - 166 bytes.
- Binary (COMP) fields may be 2, 4, or 8 bytes long.
- Numeric (EXTERNAL,DISPLAY) fields can be 1 - 18 digits, must be numeric, and may include an embedded trailing sign.
- Packed (COMP-3) fields can be 1 - 18 digits (1 - 10 bytes) and may have an embedded trailing sign. The value must be numeric.
Computing a Sum in the Same Record
Summarizing Multiple Records
Reducing decimal places
All record fields have two implied decimal places.
Increasing Decimal Places (Percentage)
Field 1 and 2 are integers. Field 3 is a percentage (2 decimal places).
Combining Character Fields