Source:
The constant has base, scale, mode, and precision attributes. It converts to the attributes of the target when they are independent of the source attributes, as in the case of assignment. See the specific target types of coded arithmetic data using the attributes of the constant as the source.
If an intermediate result is necessary, as in evaluation of an operational expression, the attributes of the intermediate result are the same as if a decimal fixed-point value of precision (N,0) had appeared in place of the string. (This allows the compiler to generate code to handle all cases, regardless of the attributes of the contained constant.) Consequently, any fractional portion of the constant might be lost. See the specific target types of coded arithmetic data using FIXED DECIMAL as the source.
It is possible that during the initial conversion of the character data item to an intermediate fixed decimal number, the value might exceed the default size of the intermediate result. If this occurs, the SIZE condition is raised if it is enabled.
If a character string representing a complex number is assigned to a real target, the complex part of the string is not checked for valid arithmetic characters and CONVERSION cannot be raised, since only the real part of the string is assigned to the target.
If the source is a null string or a string of one or more blanks, the target will be assigned the value zero. The CONVERSION condition will not be raised.
If the source string is longer than the allowable precision, bits on the left are ignored. If nonzero bits are lost, the SIZE condition is raised.
A null string gives the value zero.
Source:
Source:
Source:
Source:
The arithmetic character PICTURE data item is the character representation of a decimal fixed-point or floating-point value. The following descriptions for source to arithmetic character PICTURE target show those target attributes that allow assignment without loss of leftmost or rightmost digits.
Source:
fixed decimal (1+x+q-y,q) or float decimal (x)
where x>=CEIL(p1/3.32), y=CEIL(q1/3.32), and q>=y.
fixed decimal (x+q-q1,q) or float decimal (x)
where x>=p1 and q>=q1.
fixed decimal (p,q) or float decimal (p)
where p>=CEIL(p1/3.32) and the values of p and q take account of the range of values that can be held by the exponent of the source.
fixed decimal (p,q) or float decimal (p)
where p>= p1 and the values of p and q take account of the range of values that can be held by the exponent of the source.
fixed decimal (1+x+q,q) or float decimal (x)
where x>=ceil(n/3.32) and q>=0.
Source:
The rules for coded-arithmetic-to-character-string conversion are also used for list-directed and data-directed output, and for evaluating keys (even for REGIONAL files).
If p1<q1 or q1<0, a scaling factor appends to the right of the constant; the constant is an optionally-signed integer. The scaling factor appears even if the value of the item is zero and has the following syntax:
F{+|-}nnwhere {+|-}nn has the value of -q1.
The length of the intermediate string is p1+k+3, where k is the number of digits necessary to hold the value of q1 (not including the sign or the letter F).
If the arithmetic value is complex, the intermediate string consists of the imaginary part concatenated to the real part. The left-hand, or real, part is generated as a real source. The right-hand, or imaginary, part is always signed, and it has the letter I appended. The generated string is a complex expression with no blanks between its elements. The length of the intermediate string is:
2*p1+7 for p1>=q1>=0 2*(p1+k)+7 for p1<q1 or q1<0
The following examples show the intermediate strings that are generated from several real and complex fixed-point decimal values:
Precision Value String (5,0) 2947 'bbbb2947' (4,1) -121.7 'b-121.7' (4,-3) -3279000 '-3279F+3' (2,1) 1.2+0.3I 'bbb1.2+0.3I'
w, the length of the intermediate string, is p1+8. d, the number of fractional digits, is p1-1. s, the number of significant digits, is p1.
If the arithmetic value is complex, the intermediate string consists of the imaginary part concatenated to the real part. The left-hand, or real, part is generated as a real source. The right-hand, or imaginary, part is always signed, and it has the letter I appended. The generated string is a complex expression with no blanks between its elements. The length of the intermediate string is 2*p+17.
The following examples show the intermediate strings that are generated from several real and complex floating-point decimal values:
Precision Value String (5) 1735*10**5 'b1.7350E+0008' (5) -.001663 '-1.6630E-0003' (3) 1 'b1.00E+0000' (5) 17.3+1.5I 'b1.7300E+0001+1.5000E+0000I'
Source:
min(M,(p1-q1))
If (p1-q1) is negative or zero, the result is a null bit string.
The following examples show the intermediate strings that are generated from several fixed-point binary values:
Precision Value String (1) 1 '1'B (3) -3 '011'B (4,2) 1.25 '01'B
min(M,CEIL((p1-q1)*3.32))
If (p1-q1) is negative or zero, the result is a null bit string.
The following examples show the intermediate strings that are generated from several fixed-point decimal values:
Precision Value String (1) 1 '0001'B (2,1) 1.1 '0001'B
min(M,p1)
min(M,ceil(p1*3.32))
Nongraphic source is first converted to character according to the rules in Target: Character. The resultant character string is then converted to a DBCS string.
Source other than widechar is first converted to character according to the rules in Target: Character. The resultant character string is then converted to a widechar string.