Which of the three actions
is determined by one or
following: the type of
byte, the state of the
indicator, and whether the
examined is zero.
takes place
more of the
the pattern
significance
source digit
Pattern Bytes: There are four types of
pattern bytes: digit selector, signif­
icance starter, field separator, and
message byte. Their coding is as
follows:
Name Code
Digit selector 0010 0000 Significance starter 0010 0001 Field separator 0010 0010 Message byte Any other
The detection of either a digit selector
or a significance starter in the pattern
causes an examination to be made of the
significance indicator and of a source
digit. As a result, either the expanded
source digit or the fill byte, as appro­
priate, is selected to replace the
pattern byte. Additionally, encounter­
ing a digit selector or a significance
starter may cause the significance indi­
cator to be changed.
The field separator identifies individ­
ual fields in a multiple-field editing
operation. It is always replaced in the
result by the fill byte, and the signif­
icance indicator is always off after the
field separator is encountered.
Message bytes in the pattern are either
replaced by the fill byte or remain
unchanged in the result, depending on
the state of the significance indicator.
They may thus be used for padding, punc­
tuation, or text in the significant
portion of a field or for the insertion
of sign-dependent symbols.
Fill Byte: The first byte of the
pattern is used as the fill byte. The
fill byte can have any code and may
concurrently specify a control function.
If this byte is a digit selector or
significance starter, the indicated
editing action is taken after the code
has been assigned to the fill byte.
Source Digits: Each time a digit selec­
tor or significance starter is encount­
ered in the pattern, a new source digit
is examined for placement in the pattern
field. Either the source digit is
disregarded, or it is expanded to the
zoned format, by appending the zone code
1111 on the left, and stored in place of
the pattern byte.
Execution is as if the source digits
were selected one byte at a time and as
if a source byte were fetched for
inspection only once during an editing
operation. Each source digit is exam-
ined only once for a zero value. The
leftmost four bits of each byte are
examined first, and the rightmost four
bits, when they represent a decimal­
digit code, remain available for the
next pattern byte that calls for a digit
examination. When the leftmost four
bits contain an invalid digit code, a
data exception is recognized, and the
operation is terminated.
At the time the left digit of a source
byte is examined, the rightmost four
bits are checked for the existence of a
sign code. When a sign code is encount­
ered in the rightmost four bit
positions, these bits are not treated as
a decimal-digit code, and a new source
byte is fetched from storage when the
next pattern byte calls for a source­
digit examination.
When the pattern contains no digit
selector or significance starter, no
source bytes are fetched and examined.
Significance Indicator: The signifi­
cance indicator is turned on or off to
indicate the significance or nonsignif­
icance, respectively, of subsequent
source digits or message bytes. Signif­
icant source digits replace their corre­
sponding digit selectors or significance
starters in the result. Significant
message bytes remain unchanged in the
result.
The significance indicator, by its on or
off state, indicates also the negative
or positive value, respectively, of a
completed source field and is used as
one factor in the setting of the condi­
tion code.
The significance indicator is set to off
at the start of the editing operation,
after a field separator is encountered,
or after a source byte is examined that
has a plus code in the rightmost four
bit positions.
The significance indicator is set to on
when a significance starter is encount­
ered whose source digit is a valid deci­
mal digit, or when a digit selector is
encountered whose source digit is a
nonzero decimal digit, provided that in
both instances the source byte does not
have a plus code in the rightmost four
bit positions.
In all other situations, the signif­
icance indicator is not changed. A
minus sign code has no effect on the
significance indicator.
of an editing
is equal in
It is composed
bytes, and zoned
Result Bytes: The result
operation replaces and
length to the pattern.
of pattern bytes, fill
source digits.
If the pattern byte
and the significance
is a message byte
indicator is on,
Chapter 8. Decimal Instructions 8-7
the message byte remains unchanged in the result. If the pattern byte 1S a
field separator or if the significance
indicator is off when a message byte is encountered in the pattern, the fill
byte replaces the pattern byte in the
result.
If the digit selector or significance
starter is encountered in the pattern
with the significance indicator off and
the source digit zero, the source digit is considered nonsignificant, and the
fill byte replaces the pattern byte. If
the digit selector or significance star­
ter is encountered with either the
significance indicator on or with a
nonzero decimal source digit, the source
digit is considered significant, is
changed to the zoned format, and
replaces the pattern byte in the result. Condition Code: The sign and magnitude
of the last field edited are used to set
the condition code. The term "last
field" refers to those source digits, if
any, in the second operand selected by
digit selectors or significance starters
after the last field separator; if the
pattern contains no field separator,
there is only one field, which is
considered to be the last field. If no
such source digits are selected, the
last field is considered to be of zero
length. Condition code 0 is set when the last
field edited is zero or of zero length. Condition code 1 is set when the last
field edited is nonzero and the signif­
icance indicator is on. (This indicates
a result less than zero if the last
source byte examined contained a sign
code in the rightmost four bits.) Condition code 2 is set when the last
field edited is nonzero and the signif­
icance indicator is off. (This indi­ cates a result greater than zero if the
last source byte examined contained a sign code in the rightmost four bits.>
The figure "Summary of Editing
Functions" summarizes the functions of
the EDIT and EDIT AND MARK operations.
The leftmost four columns list all the
significant combinations of the four
conditions that can be encountered in
the execution of an editing operation.
The rightmost two columns list the
action taken for each case --the type
of byte placed in the result field and
the new setting of the significance
indicator.
Resulting Condition Code: o Last field zero or zero length
1 Last field less than zero
2 Last field greater than zero
3
8-8 System/370 Principles of Operation Program Exceptions:
Access (fetch, operand 2; fetch and
store, operand 1)
Data
Programming Notes
1. Examples of the use of the EDIT in­
struction are given in Appendix A.
2. Editing includes sign and punctu­
ation control, and the suppression
and protection of leading zeros by
replacing them with blanks or as­
terisks. It also facilitates pro­
grammed blanking of all-zero
fields. Several fields may be
edited in one operation, and numer­
ic information may be combined with
text.
3. In most cases, the source is short­
er than the pattern because each
four-bit source digit produces an
eight-bit byte in the result.
4. The total number of digit selectors
and significance starters in the
pattern always equals the number of
source digits edited.
5. If the fill byte is a blank, if no
significance starter exists in the
pattern, and if the source digit
examined for each digit selector is
zero, the editing operation blanks
the result field.
6. The resulting condition code indi­
cates whether or not the last field
is all zeros and, if nonzero,
reflects the state of the signif­
icance indicator. The significance
indicator reflects the sign of the
source field only if the last
source byte examined contains a
sign code in the rightmost four
bits. For multiple-field editing
operations, the condition code
reflects the sign and value only of
the field following the last field
separator.
7. Significant performance degradation
is possible when, with OAT on, the
second-operand address of EDIT
designates a location that is less
than the length of the first oper­
and to the left of a 2K-byte
boundary. This is because the
machine may perform a trial
execution of the instruction to
determine if the second operand
actually crosses the boundary. The
second operand of EDIT, while
normally shorter than the first
operand, can in the extreme case
have the same length as the first.
Previous Page Next Page