pc.m Processing Code/Restore Processor


Command pc.m Processing Code/Restore Processor
Applicable release versions: AP
Category Restore Processor (84)
Description a "masking" conversion used for both numeric and text string formatting.

This conversion is quite complex because nearly all of the elements available in its syntax are optional. The elements are listed in the order that the system evaluates the expression. If an element is going to be used, it must be in the same order shown. Each of the elements available is discussed below.

Note that the spaces in the syntax listing are just to provide visual relief -- there are no spaces allowed in the conversion, except for literal spaces (those between quotation marks or with a parenthesized format mask).

The elements include:

just indicates the justification of the string. May either be "l" for left, and "r" or "d" for right justified. Left justification is used primarily for text strings. Right justification is typically used to process decimal numbers.

precision indicates the number of decimal positions to print after the decimal point. It must be between 0 (zero) and 9. When omitted, this defaults to 0 (zero). If 0 (zero) is assumed or specified, no decimal point is printed.

scalefactor indicates the power to which the value is to be descaled. It must be between 0 (zero) and 9. There is no default value.

When a "precision" is specified without a "scalefactor", the "scalefactor" defaults to the "precision" value. ("mr2" is identical to "mr22").

z (a literal "z") suppresses leading zeros (i.e., 0003 becomes 3) and thereby supresses zero balance fields.

, (comma) inserts commas in the thousands and millions position on output.

signcodes alter the normal handling of negative numbers, with the exception of the "d" signcode. Their functions are as follows:
c negative values are followed by "cr".
d positive and zero values are followed by "db".
e negative values are enclosed in angle brackets "<value>". Zero values have a blank preceding and following them.
m negative numbers are followed by a - (minus) sign.
n suppresses (leading) minus sign on negative numbers.

$ appends a "dollar sign" to the value prior to justification.

format.mask may be any combination of literals and special "fill" operators listed below.

#n fills with "n" blanks.
*n fills with "n" asterisks.
%n fills with "n" zeros.

The format.mask may itself be enclosed within parentheses. When it is enclosed in parentheses, any alphabetic characters (and all punctuation characters except "#", "%", "*") may be specified as literal strings.

When masking decimal numbers, the "precision" and "scaling" can be used to round numbers. For example, an internally stored number is "56789". This number has 4 implied decimals. The mask, "mr4", indicates that both the "scalefactor" and "precision" are 4. This gives a result of "5.6789".

The "precision" and "scalefactor" need not be the same. Consider the situation where this number is to be scaled by 4 places, but the result needs 2 decimals of precision. The conversion to accomplish this is, "mr24". Passing "56789" through the conversion, "mr24", first scales by 4 and then rounds to 2 decimals resulting in the decimal number, "5.68".
Syntax m{just} {{precision} {scalefactor}} {z} {,} {signcode} {$} {format.mask}
This chart shows the effect of taking a data value and passing it through the 
"oconv" function:

data        conversion           output data  

12345       mr2                  123.45
12345       mr02                 123
123456      mr2,$                $1,234.56
123456      mr02,$               $1,235
0           mrz                  (none)
0           mr2,z$               (none)
123456      mr2,e                1,234.56
123456      mr2,d                1,234.56db
-123456     mr2,e                <1,234.56>
-123456     mr2,c                1,234.56cr
-123456     mr2,m                1,234.56-
-123456     mr2,n                1,234.56
123456      mr24,                12.35
123456      mr02,$               $1,235
-123456     mr2,$                -$1,234.56
-123456     mr2,e$               <$1,234.56> 
-123456     mr2,c$               $1,234.56cr
123456      mr2,c$               $1,234.56
123456      mr(%10)              0000123456
123456      mr2(%10)             0001234.56
123456      mr(*10)              ****123456
123456      mr2(*10)             ***1234.56
123456      mr2,$*12             ***$1,234.56
7145551212  ml((###)###-####)    (714)555-1212
7145551212  ml(###-###-####)     714-555-1212
7145551212  ml(#3-#3-#4)         714-555-1212
123456      mr2$(#10)            $  1234.56
123456      mr2($#10)              $1234.56
123456      mr(#3 plus #3)       123 plus 456
123456      mr24                 12.35
Related processing.codes