Purpose
You can set a temporary result to be a specific numeric value. This is often useful in performing calculations.
Syntax Diagram
The following is the syntax for the SET statement when you want to set the result to a numeric literal value.
►►─ SET ─ result ─┬─────────┬─ =numeric-literal ──────────────────────────────►◄ └─ (n.d) ─┘
Explanation
The following explains the preceding keywords.
Assigns a name to the new result. A result name can be up to 32 alphanumeric characters. The first character of the name must be alphabetic.
Specifies the precision (the specific number of digits before and after the decimal) of the result, overriding the default precision. (n.d) indicates that the result contains n integers and d decimals. The total of n + d cannot exceed 18 digits.
For example, (9.2) specifies a result with nine integer positions and two decimal positions. The total number of digits is 11.
Assigns a numeric constant value to the result. A unary plus (+) or minus (-) sign can precede the value. A numeric-literal can be up to 18 numbers (integers and decimals).
Note: If DECPT=COMMA in the System Option Table, the numeric literal must be enclosed in quotes. See your CA Dataquery Administrator with any questions about system options.
Sample
The name assigned to a result can be used in subsequent statements as shown in the following example.
FIND 10 CAI-SLSHST-REC ROWS
WITH SHIP-QTY > 100
RELATED BY SLMN-ID TO CAI-ORDERS-REC
SET NET-COST (8.2) = CAI-ORDERS-REC SHIP-QTY * UNIT-PRICE
SET DISCOUNT-PCT = .06
SET DISCOUNT (5.2) = NET-COST * DISCOUNT-PCT
SET DISCOUNT-COST (8.2) = NET-COST - DISCOUNT
PRINT FROM CAI-ORDERS-REC ORD-ID
FROM CAI-SLSHST-REC ITM-ID
SHIP-QTY
UNIT-PRICE
NET-COST
DISCOUNT
DISCOUNT-COST
|
Copyright © 2014 CA.
All rights reserved.
|
|