Copyright © TIBCO Software Inc. All Rights Reserved
Copyright © TIBCO Software Inc. All Rights Reserved


Chapter 3 Tools : $UNPIC

$UNPIC
Determines the original value submitted given a masked value produced by $PIC and the display mask that produced it. (F)
Invocation
value = $UNPIC(picval, mask)
 
The original value submitted to $PIC. Its syntax is V (variable-length character string).
Usage Notes
$UNPIC reverses the function of $PIC:
picval=$PIC(value, mask)
value=$UNPIC(picval, mask)
For information on mask elements and terminology, refer to $PIC.
picval
You can omit the following in picval:
picval can have leading zeros with message characters between them; it cannot have other fill characters (asterisks or blanks) with message characters between them.
Sign of a Value
The sign of a value is determined by all or one of the following:
A user input positive (+) or negative (-) sign preceding the basic string in picval (allowed only if there is a sign holder in the mask)
Any number of fill characters can be entered in the conditional right string of picval, provided they are not ambiguous (for example, when a user-supplied negative (-) sign conflicts with the positive value implied by the presence of fill characters). $UNPIC fails if it cannot with certainty determine the sign associated with a value. A similar failure occurs if the presence of a conditional right string conflicts with a user-supplied positive (+) sign.
Effect of Display Masks
If there is no basic string in the mask or if the basic string is in the mask and not in picval, $UNPIC returns a null value.
If the picval is inconsistent with the mask because of an overflow either before or after the decimal point, $UNPIC fails. $UNPIC truncates only if the mask has a decimal separator and the digits being truncated are all decimal zeros.
$PIC/$UNPIC Inconsistencies
In some cases, the display mask causes values to be truncated or information to be lost when $PIC is used. In cases such as the following, inconsistencies occur:
$PIC(-123, '999') returns '123' (information is lost)
$UNPIC('123', '999') returns '123' instead of '-123'
$PIC(0.345, '9V.99') returns '0.34' (truncation occurs)
$UNPIC('.34', '9V.99') returns '0.34' instead of '0.345'
$PIC(0, 'CDN$ZZ') or $PIC('', 'CDN$ZZ') returns CDN$  (0 and null produce the same mask)
Examples
Below are some examples of $PIC values and the $UNPIC values that result:

Copyright © TIBCO Software Inc. All Rights Reserved
Copyright © TIBCO Software Inc. All Rights Reserved