In previous sections we have seen that data may be
moved from one area to another either unchanged in
byte structure or with packing or unpacking being
performed; or, data may be edited as it is moved.
Editing is very much like unpacking data except that
two additional functions are performed as the data is
unpacked. The editing instruction can (1) suppress
leading zeros to a predetermined location in the
edited field and (2) insert editing characters as the
data is moved to the edited field.
A data field to be edited is assumed to be in valid
e., each half-byte is a valid num-
eric (0-9) except the rightmost half-byte which is a
Data is moved from this packed field to a receiving
field that controls the insertion of the numeric digits
(half-bytes) . The numeric digits are unpacked as
they are transferred to the edited field.
The receiving field (edit mask) consists of charac-
ters to be inserted as editing symbols such as the
comma, decimal point, and asterisk, for example.
In addition, the following characters are control
characters in the edit mask: (Hexadecimal format
of byte shown.)
X'20' - DIGIT SELECT
This character is placed in the edit mask where
desired to insert a digit from the packed field. The
digit is inserted unless it is a leading insignificant
zero and a Significance Start character has not been
X'21' - SIGNIFICANCE START
This character serves the same function as the Digit
Select character with one added function; it specifies
that all of the following digits are to be inserted from
the packed field even if one or more leading zeros
are still present.
X'22' - FIELD SEPARATOR
This character is used for editing multiple fields; it
specifies the end of one and the start of another field
and resets the edit operation for the beginning of
To illustrate the editing functions, assume that a
packed field has the following format and value:
and that the field is to be edited so that leading zeros
will be suppressed.
To do this, allocate an edit mask as follows:
Hexadecimal characters are used because some of
the bytes cannot be represented by a character
The first character of the mask is a fill character;
it replaces digit select (X'20') and editing symbols
in the mask until one of the following conditions
The first non-zero numeric digit is encountered
in the packed (sending) field.
A Significance Start character has been encoun-
tered in the edit mask (receiving) field.
The fill character also replaces all remaining posi-
tions in the edit mask when a plus sign is encountered
in the packed (sending) field unless processing mul-
tiple packed fields.
To illustrate the above example, assume the edit
mask above has been assigned the following mem-
00 01 02 03 04 05 06 07 08
00 01 02 03
00 02 37 8+