$EDIT returns an alphanumeric value by editing the given field or literal according to the specified pattern.
This function has the following format:
{num‑literal}
$EDIT ({num‑field } [,PIC='edit‑pattern'])
{alpha‑field}
Specifies the numeric literal to edit.
Specifies the numeric field to edit.
Specifies the alphanumeric field to edit.
Specifies the format of the field or literal. The format can be any valid pattern and must be enclosed by quotes. In addition, an L in the first character of the edit‑pattern left‑justifies the result.
The maximum length of an edit pattern is 30 characters. Spaces found anywhere in the edit pattern are not suppressed.
The PIC= clause is required for an alpha‑field. If you do not specify a PIC= clause for a numeric field, the default edit pattern is PIC 9(n), where n is the number of integer places. For example, for a numeric field NUM_FLD with four integer and two decimal places, the function,
$EDIT(NUM_FLD)
is equivalent to,
$EDIT(NUM_FLD,PIC='9999')
If you assume that I is an unsigned numeric with three digits and two decimals, and J is a signed numeric field with six digits, for
SET I = 34.5 $EDIT (I)
the result is '034', and for
SET J = ‑123 $EDIT (J)
the result is '123'.
|
Copyright © 2015 CA Technologies.
All rights reserved.
|
|