Edit (EDT)/OP=49

Format

OP AF BF A Syllable B Syllable C Syllable

OP = 49

AF Not used as A Syllable length. AF may be indirect or may specify that the A Syllable is a literal.
BF Number of eight-bit edit-operators and in-line literals in the B Syllable. A value of 00 is equal to a length of 100 characters. BF may be indirect.

The A Syllable is the address of the source field to be edited. Address may be indexed, indirect or extended. The final address controller data type may be UN, SN or UA.
The B Syllable is the address of the edit-operator field. Address may be indexed, indirect or extended. The final address controller data type is ignored and is treated as UA.
The C Syllable is the address of the destination field. Address may be indexed, indirect or extended. The final address controller data type must be UA or UN. Use of SN data type will cause an Invalid Instruction fault (IEX = 03). See Compatibility Notes A.13.1.

Function

The Edit instruction moves digits or characters (depending on the A address controller) from the A field to the C field under control of the edit-operators in the B field. Characters may be moved, inserted or deleted according to the edit-operators. Data movement and editing are stopped by the exhaustion of edit-operators in the B field.

At the start of the Edit operation, the comparison flags are set to EQUAL and the Overflow Flag is unconditionally reset. The comparison flags may be set to HIGH or LOW if any non-zero digits are moved from the source to the destination field.

The source or A field is considered positive for unsigned numeric (UN) format. For unsigned alpha (UA), the most significant digit of the most significant character is interpreted as the sign. For signed numeric (SN), the most significant digit of the field is the sign (which is otherwise ignored).

If the C address controller is other than UA, only insert the low order digit of each character transferred into the destination field. Therefore, whenever a blank (40) is specified, a 0 will be inserted.

The edit instruction uses an edit table that is located in memory locations 48-63 relative to Base #0. This table may be initialized to any desired set of insertion characters. By convention all compilers build a default insertion table containing:

Entry # Base 0 Address Character Description
0 48 + Positive Sign
1 50 - Negative Sign
2 52 * Check Suppress Character
3 54 . Decimal Point
4 56 , Thousands Separator
5 58 $ Currency Symbol
6 60 0 Leading zero fill Character
7 62 <blank> Blank Fill Character

The edit-operator field consists of a string of two-digit instructions. Each instruction is of the form MAv. The M digit is the operation code portion of the edit-operator. The Av digit is the variant position of the edit-operator.

Micro Operators

Instruction Variant
M Name Av Action
0 Move Digit 0 thru 9 T ⇐ 1 (Significance)
MOVE Av + 1 DIGITS
1 Move Characters 0 thru 9 T ⇐ 1 (Significance)
MOVE Av + 1 BYTES
2 Move Suppress 0 thru 9 If T = 1, M ⇐ 0
If T = 0, READ each A-Digit then
If A-Digit NOT = 0, M ⇐ 0
If A-Digit = 0, then
If Q = 0, Insert Blank
If Q = 1, Insert Table Entry 2
3 Insert Unconditionally 0 - 7 Insert Table Entry 0 - 7
8 If A = +, Insert table entry 0
If A = -, Insert Table Entry 1
9 If A = +, Insert Blank
If A = -, Insert Table Entry 1
A If A = +, Insert Table Entry 0
If A = -, Insert blank
B Insert Next B character
4 Insert on Plus 0 thru B If A = +, M ⇐ 3
If A = - Then
If Q = 0, Insert Blank
If Q = 1, Insert Table Entry 2
If Av = B, Skip next B character
5 Insert on Minus 0 thru B If A = -, M ⇐ 3
If A = + Then
If Q = 0, Insert Blank
If Q = 1, Insert Table Entry 2
If Av = B, Skip next B character
6 Insert Suppress 0 thru B If T = 1, M ⇐ 3
If T = 0, Then
If Q = 0, Insert Blank
If Q = 1, Insert Table Entry 2
If Av = B, Skip next B character
7 Insert Float 0 thru B If T = 1, Move one digit, If Av = B, Skip Next B
If T = 0, Read one A-digit, then
If A-digit NOT = 0, then T ⇐ 1,
If Av = 0 thru 7, Insert Table Entry 0 - 7 and move one digit.
If Av = 8 AND A = + then, Insert Table Entry 0 and Move one digit.
If Av = 8 and A = - then, Insert Table Entry 1 and Move one digit.
If Av = 9 and A = + Then Insert Blank and Move one digit.
If Av = 9 and A = -, Then Insert Table Entry 1 and move one digit.
If Av = A and A = +, Then Insert Table Entry 0 and move one digit.
If Av = A and A = -, Then Insert Blank and move one digit.
If Av = B, then Insert Next B character and move one digit.
If A-digit = 0, then
If Q = 0, Insert Blank
If Q = 1, Insert Table Entry 2
If Av = B, skip next B character.
8 End Float 0 thru B If T = 1, Then
If Av NOT = B, No Operation
If Av = B, Skip next B character.
If T = 0, M ⇐ 3
9 Control 0 T ⇐ 0
1 T ⇐ 1
2 Q ⇐ NOT Q
3 Skip A digit or character

T denotes a flag that is set to zero initially and is set to one (significance) if a digit or character is moved from the source data field to the destination data field or if the control edit-op (MAv = 91) is executed. If T is 1, zero suppression is inhibited.

Q denotes a flag that is set to zero initially. It is set to one with the control edit-op (MAv = 92) if a check protect or other character is to be repeated.

M = 0, Move Digit (Av = 0-9)

T is set to 1 (significance).

When both the A- and C-address controllers specify 4-bit format (UN or SN), Av+1 digits are moved from the source data field to the destination data field.

When the A- and C-address controllers both specify 8-bit format (UA), the numeric portion of Av+1 characters in the source data field are moved to the destination data field with the zone digit set to the EBCDIC numeric subset code (F).

When the A- and C-address controllers specify UA and UN respectively, then only the numeric portion of Av +1 characters in the source data field are moved to the destination data field.

When the A- and C-address controllers specify either UN or SN and UA, respectively, then Av+1 digits in the source data field are moved to the destination data field and the zone (high order digit) of each character to be written is set to the EBCDIC numeric subset code (F).

M = 1, Move character (Av = 0-9)

T is set to 1 (significance).

When the A- and C-address controllers both specify 4-bit format (UN or SN), Av+1 digits are moved from the source data field to the destination data field.

When the A- and C-address controllers both specify 8-bit format (UA), Av+1 characters are moved from the source data field unchanged to the destination data field.

When the A- and C-address controllers specify UA and UN respectively, only the numeric portion of Av +1 characters in the source data field is moved to the destination data field.

When the A-address and C-address controllers specify either UN or SN and UA, respectively, Av+1 digits in the source data field are moved to the destination data field and the zone (high order digit) of each character to be written is set to the EBCDIC numeric subset code (F).

M = 2, Move suppress (Av = 0-9)

If T is 1 (significance), the operation move digit (M = 0) is performed.

If T is zero and the first source digit or the low order digit of the first character has a value of zero, and Q is zero, a blank (40) is inserted into the destination data field.

If Q is 1, the edit table value at base+52 is inserted into the destination data field. Av+1 indicates the number of digits/characters to be examined.

If T is zero and the first source digit, and the low-order digit of the first character has a value other than zero (significance), then the operation move digit (M = 0) is performed.

M = 3, Insert unconditionally (Av = 0-9, A, or B)

If Av equals 0-7, insert a character from the edit table at base 0+48+2Av into the destination data field.

If Av equals 8 and the sign of the source data field is positive (+), the edit table entry at base 0+48 is inserted into the destination data field.

If Av equals 8 and the sign of the source data field is minus (-), the edit table entry at base 0+50 is inserted into the destination data field.

If Av equals 9 and the sign of the source data field is positive (+), a blank (40) is inserted into the destination data field.

If Av equals 9 and the sign of the source data field is minus (-), the edit table entry at base 0+50 is inserted into the destination data field.

If Av equals A and the sign of the source data field is positive (+), the edit table entry at base 0+48 is inserted into the destination data field.

If Av equals A and the sign of the source data field is minus (-), a blank (40) is inserted into the destination data field.

If Av equals B, the next character in the edit-op field is inserted into the destination data field.

M = 4, Insert on plus (Av = 0-9, A, or B)

If the sign of the source data field is positive (+) the operation Insert Unconditionally (M = 3) is performed.

If the sign of the source data field is minus (-) and Q is zero, a blank (40) is inserted into the destination data field, and if Av=B, the next character in the edit-op field is skipped. However, if there are no characters left to skip in the edit-op field, an invalid instruction fault (IEX=07) occurs.

If the sign of the source data field is minus (-) and Q is one, the edit table entry at base 0+52 is inserted into the destination data field, and if Av=B, the next character in the edit-op field is skipped. However, if there are no characters left to skip in the edit-op field, an invalid instruction fault (IEX=07) occurs.

M = 5, Insert on minus (Av = 0-9, A, or B)

If the sign of the source data field is minus (-) the insert unconditionally (M=3) operation is performed.

If the sign of the source data field is positive (+) and Q is zero, a blank (40) is inserted into the destination data field, and if Av=B, the next character in the edit-op field is skipped. However, if there are no characters left to skip in the edit-op field, then an invalid instruction fault (IEX=07) occurs.

If the sign of the source data field is positive (+) and Q is one, the edit table entry at base 0+52 is inserted into the destination data field, and if Av=B, the next character in the edit-op field is skipped. However, if there are no characters left to skip in the edit-op field, an invalid instruction fault (IEX=07) occurs.

M = 6, Insert suppress (Av = 0-9 A, or B)

If T is one (significance), the insert unconditionally (M=3) operation is performed.

If T is zero and Q is zero, a blank (40) is inserted into the destination data field, and if Av=B, the next character in the edit-op field is skipped. However, if there are no characters left to skip in the edit-op field, then an invalid instruction fault (IEX=07) occurs.

If T is zero and Q is one, a character from the edit table at base 0+52 is inserted into the destination data field, and if Av=B, the next character in the edit-op field is skipped. However, if there are no characters left to skip in the edit-op field, then an invalid instruction fault (IEX=07) occurs.

If T is zero and Av equals B, the next character in the edit-op field is skipped. However, if there are no characters left to skip in the edit-op field, an invalid instruction fault (IEX=07) occurs.

M = 7, Insert float (Av = 0-9, A, or B)

If T is one (significance), the operation move digit (M=0, Av=0) is performed.

If T is one (significance) and Av is a B, the next character in the edit-op field is skipped. However, if there are no characters left to skip in the edit-op field, an invalid instruction fault (IEX=07) occurs.

If T is zero and the source digit (AC=SN or UN) or the low order digit of the source character (AC=UA) has a value of zero and Q is zero, a blank (40) is inserted into the destination data field, and if Av=B, the next character in the edit-op field is skipped. However, if there are no characters left to skip in the edit-op field, then an invalid instruction fault (IEX=07) occurs.

If Q is one, the edit table entry at base 0+52 is inserted into the destination data field, and if Av=B, the next character in the edit-op field is skipped. However, if there are no characters left to skip in the edit-op field, then an invalid instruction fault (IEX=07) occurs.

If T is zero and the source digit (AC=SN or UN) or the low order digit of the source character (AC=UA) has a value of other than zero, the insert unconditionally (M=3) operation is performed, T is set to one and then the move digit (M=0, Av=0) operation is performed.

M = 8, End float (Av=0-9, A, or B)

If T is one (significance) and Av is not equal to a B, no operation is performed.

If T is one (significance) and Av equals a B, the next character in the edit-op field is skipped.

If T is zero, the insert unconditionally (M=3) operation is performed.

M = 9, Control (Av=0-3)

This edit-op performs a control function based on the variant (Av).

Variant Action
0 Set T to 0
1 Set T to 1
2 Complement Q
3 Skip the Source Data Field Digit or Character
Note: Use of undigits A through F for M or values for Av not specified above will cause an Invalid Instruction fault (IEX=07) (see Compatibility Notes A.13.2).

Overflow/Comparison Flags

Set the Comparison Flags to HIGH if any numeric digits moved from the source data field are non-zero and the sign of the source field is interpreted as positive.

Set the Comparison Flags to LOW if any numeric digits moved from the source data field are non-zero and the sign of the source field is interpreted as negative.

Set the Comparison Flags to EQUAL if all numeric digits moved from the source data field are equal to zero or if no character or digit was moved from the source data field.

Insertion character values do not affect the comparison flags.

Reset the Overflow Flag.

Overlap

Overlap of the A, B or C fields in any manner may produce incompatible results. See Compatibility Notes A.13.3.

Examples

Example (1) Edit

OP AF BF A Syllable B Syllable C Syllable
49 00 01 A Field (UA) B Field (UA) C Field (UA)
   A Field            010203
   B Field                02
   C Field (After)    F1F2F3
   Comparison (After)   HIGH
   Overflow (After)       NO

Example (2) Edit

OP AF BF A Syllable B Syllable C Syllable
49 00 22 A Field (SN) B Field (UA) C Field (UA)
   A Field                                            C0 01 30 59
   B Field                       4B D7 4B C1 4B D8 37 92 75 64 75
                                 75 75 85 93 33 01 92 5B C3 5B D9
   TABLE(48-62)                           4E 60 5C 4B 6B 5B F0 40
                                           +  -  *  .  ,  $  0  b
   C Field (After)   D7 C1 E8 40 5C 5C 5C 5B F1 F3 4B F5 F9 40 40
                      P  A  Y  b  *  *  *  $  1  3  .  5  9  b  b
   Comparison (After)   HIGH
   Overflow (After)       NO
   Note b = Blank
instructions/edt.txt · Last modified: 2011/07/24 19:02 by scott
 
Except where otherwise noted, content on this wiki is licensed under the following license: CC Attribution-Noncommercial-Share Alike 3.0 Unported
Recent changes RSS feed Donate Powered by PHP Valid XHTML 1.0 Valid CSS Driven by DokuWiki