HP OpenVMS Systems Documentation
An elementary numeric move to a numeric-edited receiving item is considered an elementary numeric-edited move. The sending item of an elementary numeric-edited move can be numeric, numeric-edited, or alphanumeric. When the sending item is numeric-edited, de-editing is applied to establish the item's unedited numeric value, which may be signed; then the unedited numeric value is moved to the receiving field. Alphanumeric sending items in numeric-edited moves are considered unsigned DISPLAY usage integers.
Plus sign (+)
Minus sign (--)
For a complete description of these symbols, refer to the HP COBOL Reference Manual.
The numeric-edited move operation first converts the sending item to DISPLAY usage and aligns both items on their decimal point locations. The sending item is truncated or zero-filled until it has the same number of digit positions on both sides of the decimal point as the receiving item. The operation then moves the sending item to the receiving item, following the HP COBOL editing rules.
Table 2-3 illustrates several of these functions, which are invoked by the statement:
MOVE FLD-B TO TOTAL-AMT.
Assume that FLD-B is described as S9999V99. Note that the caret (^) indicates an assumed decimal point in Table 2-3. In all but two of the examples, the sign of FLD-B is leading separate. Trailing overpunch signs (the sign of the number encoded into the rightmost digit) are used in the other two FLD-B data examples.
|PICTURE String||Contents After MOVE|
The currency symbol ($ or other currency sign) and the editing sign
control symbols (+ and --) are the only floating symbols. To float a
symbol, enter a string of two or more occurrences of that symbol, one
for each character position over which you want the symbol to float.
2.6.3 Subscripted Moves
Any item (other than a data item that is not subordinate to an OCCURS clause) of a MOVE statement can be subscripted, and the referenced item can be used to subscript another name in the same statement.
The HP COBOL arithmetic statements allow programs to perform
arithmetic operations on numeric data. Large values present various
problems, and COBOL command qualifiers can help resolve or mitigate
them. The following sections discuss these topics.
2.7.1 Temporary Work Items
HP COBOL allows numeric items and literals with up to 31 decimal digits on Alpha and I64, and up to 18 decimal digits on VAX. (See Section 2.7.2 for more specific information.) It is quite easy to construct arithmetic expressions that produce too many digits.
Most forms of the arithmetic statements perform their operations in temporary work locations, then move the results to the receiving items, aligning the decimal points and truncating or zero-filling the resultant values. The actual size of a temporary work item (also called an intermediate result item) varies for each statement; it is determined at compile time, based on the sizes of the operands used by the statement and the arithmetic operation being performed. Should the temporary work item exceed the maximum size, truncation occurs.
On Alpha and I64 systems, the maximum temporary work item size is 31 digits for standard arithmetic and for native CIT4 arithmetic, and is 38 digits for some operations using native float or native CIT3. <>
On VAX systems, the situation is different. The temporary work item has two forms, a scaled integer form and a software floating-point form. The scaled integer form has a maximum size of 31 numeric digits for a program compiled with the /INSTRUCTION_SET = DECIMAL_STRING or GENERIC qualifier, and a maximum of 38 digits for /INSTRUCTION_SET = NODECIMAL_STRING. When the compiler determines that the size of the intermediate result exceeds the maximum scaled integer size, it uses a software floating-point intermediate item and keeps the most significant 18 digits (for all settings of the /INSTRUCTION_SET qualifier). <>
Programs should not arbitrarily specify sizes significantly larger than the values actually anticipated for the lifetime of the application. Although the generous limits in HP COBOL are useful for many applications, specifying many more digits than needed is likely to add extra processing cycles and complexity that is wasteful.