Trail: PROIV Documentation > Developer > PROIV Developer > Developing Functions > Events and Logic > PIC

 

 

Purpose

PIC converts data from numeric or alphanumeric to alphanumeric, with editing.
 

Syntax

variable = PIC (operand,mask)
 

Operation

operand is any valid alphanumeric or numeric constant, variable, or expression.

mask
 is any valid alphanumeric constant, variable, or expression representing the mask (e.g.ZZZ9.99, XX-XXX-XX, YYYY-YY).  

In a numeric edit mask, ‘Z’ is the zero suppression character, and ‘9’ represents the position of a digit.  

In an alphanumeric edit mask, ‘X’ and ‘Y’ represent the positions of characters.  Any other characters are displayed as literals.  X’ causes the alphanumeric to be left justified within the mask, and ‘Y’ right justified.  ‘X’ and ‘Y’ are mutually exclusive within a single mask.

 

Remarks

Numeric editing is done in two steps.  The numeric value is moved to an area containing the picture mask.  Decimal alignment, rounding (based on the number of decimal positions contained in the edit picture mask), and the editing process are performed.  The edited data is moved, left justified, to the resultant value.

Alphanumeric editing is done in two steps. The alphanumeric value is moved, right justified if the ‘X’ mask character is used and left justified if the ‘Y’ mask character is used, to an area containing the picture mask.  Truncation occurs if the mask is not large enough to edit all characters in the value.  The result is moved, left justified, to the RESULT field.

The original edit picture mask is unaltered during numeric and alphanumeric edit processes.

 

Example

Assume  #A = 100 , #B = 897.651, #C = 876.00-, #D = 12345678, $T = ‘237139’
EDITED is an alphanumeric file variable with a maximum length of 7
&$SPEC = ‘$$$$9.99’.

EDITED = PIC(#A,’99999’)           sets EDITED to ‘00100’
EDITED = PIC(#A,’99999999’)      sets EDITED to ‘0000010’ - #A’s value of 100 is right justified to the edit mask of eight characters, then left justified to the EDITED field of seven characters.

EDITED = PIC(#D,’99999’)           sets EDITED to ‘45678’ – truncation occurs because the edit mask is smaller than the value in #D.

EDITED = PIC(#B,&$SPEC)          sets EDITED to ‘ $897.6’ – the RESULT field is shorter than the edit mask, so the right-most character is truncated.

EDITED = PIC($T,’XX-XXXX’)     sets EDITED to ‘23-7139’
EDITED = PIC($T,’XX-XX’)         sets EDITED to ‘71-39’
EDITED = PIC($T,’YY-YY’)          sets EDITED to ‘23-71’

#A = PIC(#D,’9999’)                 is invalid because the RESULT field is defined as numeric.
$T = PIC(#C,123)                     is invalid because the edit picture mask is defined as a numeric.
 

Comment on this topic

Topic ID: 520100

 
 
 

Table of Contents

Index

Glossary

-Search-

Back