Programming Note
The TRANSLATE AND TEST is useful for scanning an in­
put stream and locating delimiters. The stream can
thus be rapidly broken into statements or data fields
for further processing.
ED 55 DE L
Bl I B2 78 1516 19 20 31 32 35 36 47
The format of the source (the second operand) is
changed from packed to zoned and is edited under
control of the pattern (the first operand). The edited
result replaces the pattern.
Editing includes sign and punctuation control and
the suppressing and protecting of leading zeros. It
also facilitates programmed blanking of all-zero fields. Several numbers may be edited in one operation, and
numeric information may be combined with text.
The length field applies to the pattern (the first op­
erand). The pattern has the unpacked format and may
contain any character. The source (the second oper­
and) has the packed format and must contain valid
decimal digit and sign codes. The left four bits of a
byte must be 0000-1001; the codes 1010-1111 are
recognized as a data exception and cause a program
interruption. The right four bits are recognized as
either a sign or a digit.
Both operands are processed left to right one char­
acter at a time. Overlapping pattern and source fields
give unpredictable results.
The character to be stored in the first operand field
is determined by three things: the digit obtained from
the source field, the pattern character, and the state
of a trigger, called the S trigger. One of three actions
may be taken:
1. The source digit is expanded to zoned format
and is stored.
2. The pattern character is left unchanged.
3. A fill character is stored. S Trigger: The S trigger is used to control the stor­
ing or replacing of source digits and pattern charac­
ters. Source digits are replaced when zero suppression
or protection is desired. Digits to be stored in the re­
sult, whether zero or not, are termed significant. Pat­ tern characters are replaced or stored when they are
significance-dependent (such as punctuation) or sign­
dependent (such as credit symbols). The S trigger
also is used to record the sign of the source number
and set the condition code accordingly.
The S trigger is set to the zero state at the start of
the operation and is subsequently changed depending
upon the source number and the pattern characters. Pattern Character: Three pattern characters have a
special use in editing. They are the digit-select char­
acter, the significance-start character, and the field­
separation character. These three characters are re­
placed, either by a source digit or by a fill character;
their encoding is shown in the next table.
1. The digit-select character causes either a source
digit or the fill character to be inserted in the result
2. The significance-start character has the same
function but also indicates, by setting the S trigger,
that the foll0'Ying digits are significant.
3. The field-separator character identifies individual
fields in a multiple-field editing operation. The char­
acter is replaced by the fill character. The S trigger is
set to zero, and testing for a zero-field is then re­
4. All other pattern characters are treated in a com­
mon way: If the S trigger is one, the pattern character
is left unchanged; if the S trigger is zero, the pattern
character is replaced by the fill character.
If the pattern character is either a digit-select or a
significance-start character, the source digit is exam­
ined. The source digit replaces the pattern character
if the S trigger is one or if the source digit is nonzero.
If the nonzero digit is inserted when the S trigger is
zero, the S trigger is set to one to indicate that the
subsequent digits are significant. If the S trigger and
the source digit are both zero, the fill character is sub­
stituted for the pattern character.
Source Digit: When the source digit is stored in the
result, its code is expanded from the packed to the
zoned format by attaching a zone. When psw bit 12 is
zero, the preferred EBCDIC zone code 1111 is gener­
at,ed. When psw bit 12 is one, the preferred ASCII zone
code 0101 is generated.
The source digits are examined only once during an
editing operation. They are selected eight bits at a
time from the second operand field. The leftmost four
bits are examined first, and the rightmost four bits re­
main available for the next pattern character which
calls for a digit examination. However, the rightmost
Logical Operations 57
four bits are inspected for a sign code immediately
after the leftmost four bits are examined.
Any of the plus-sign codes 1010, 1100, 1110, or 1111
will set the S trigger to zero after the digit is in­
spected, whereas the minus-sign codes 1011 and 1101 will leave the S trigger unchanged. When one of these
sign codes is encountered in the four rightmost bits,
these bits no longer are treated as a digit, and a new
character is fetched from storage for the next digit to
be examined.
A plus sign sets the S trigger to zero even if the trig­
ger was set to one for a nonzero digit in the same
source byte or by a significance-start character for that
Fill Character: The fill character is obtained from
the pattern as part of the editing operation. The first character of the pattern is used as a fill character and
is left unchanged in the result field, except when it is
the or significance-start character. In the
latter cases a digit is examined and, when nonzero,
Result Condition: To facilitate the blanking of all­
zero fields, the condition code is used to indicate the
sign and zero status of the last field edited. All Jigits
examined are tested for the code 0000. The presence
or absence of an all-zero source field is recorded in the
condition code at the termination of the editing oper­
1. The condition code is made 0 for a zero source
field, regardless of the state of the S trigger.
2. For a nonzero source field and an S trigger of
one, the code is made 1 to indicate less than zero.
3. For a nonzero source field and an S trigger of
zero, the code is made 2 to indicate greater than zero.
The condition-code setting pertains to fields as spe­
cified by the field-separator characters, regardless of
the number of signs encountered.
For the multiple-field editing operations the con­
dition-code setting reflects only the field following the
last field-separator character. When the last character
of the pattern is a field-separator character, the con­
dition code is made O. The following table gives the details of the edit op­
eration. The leftmost columns give the pattern char­
acter and its code. The next columns snow the states
of the digit and the S trigger used to determine thc
resulting action. The rightmost column shows the new
setting of the S trigger.
ACTER NAME AND INE GER DIGIT CHAR-GER CODE PURPOSE DIGIT STATUS STATUS ACTER SET 0010 0000 digit select yes s=l digit s=O dnotO digit s=l s=O d=O fill 00100001 significance yes s=l digit
start s=O d nota digit s=l s=O d=O fill s=l 00100010 field no fill s=O separator
other message no s=l leave
insertion s=O fill NOTES d Source digit
S trigger (1: minus sign, digits, or pattern used; 0: plus sign, fill used) digit A source digit replaces the pattern character.
fill The fill character replaces the pattern character.
leave The pattern character remains unchanged.
Resulting Condition Code:
o Result field is zero
1 Result field is less than zero
2 Result field is greater than zero
3 Program Interruptions: Operation (if decimal feature is not installed)
Programming Note
As a rule the source operand is shorter than the pat­
tern since it yields two digits or a digit and a sign for
each source number.
When a single instruction is used to edit several
numbers, the zero-field identification is provided only
for the last field.
Edit and Mark
B1 I B2 7 8 15 16 19 20 31 32 35 36 47
The format of the source (the second operand) is
changed from packed to zoned and is edited under
control of the pattern (the first operand). The address
of each first significant result digit is recorded in gen­
eral register 1. The edited result replaces the pattern.
Previous Page Next Page