Professional Documents
Culture Documents
Message characters like decimal (4B), / (61), $ (5B) are replaced by the fill character until the significance indicator is turned on, which happens when:
The significance starter is encountered, or A non-zero digit is encountered in the source number.
20
ED (Edit) Instruction
In a packed decimal number, the decimal point is not stored you have to keep track of it. Put a X4B (period) in that position in the pattern and the decimal will print.
18
ED (Edit) Instruction
So, use a significance starter (X21) to tell ED when to start printing zeros.
The first zero prints in the position after the significance starter. That is, the significance starter turns on the significance indicator and zeros start printing in the next position.
16
ED (Edit) Instruction
The significance indicator must be turned on before the decimal character is encountered or the decimal character will be replaced by the fill character.
21
ED (Edit) Instruction
When a positive sign digit is encountered in the last byte of the source number, the significance indicator is turned off. However, when a negative sign digit is encountered, the significance indicator stays on.
23
ED (Edit) Instruction
ED NUM1(5),NUM2 NUM2 12 3D
Negative number
(-123)
unchanged
prints 123
25
ED (Edit) Instruction
ED NUM1(7),NUM2 NUM2 12 3D
Negative number
(-123)
40 F1 F2 F3 40 C3 D9 unchanged
prints 123 CR
26
ED (Edit) Instruction
ED NUM1(7),NUM2 NUM2 12 3C
Positive number
(+123)
unchanged
prints 123
27
EDMK Instruction
Using EDMK to insert a $ just in front of the first digit of a number:
LA 0 EDMK NUM1(7),NUM2 R1 Points at 1st printed no matter what. BCTR R1,R0 Move back 1 char. MVI 0(R1),C$ Insert $. ... NUM1 PL5 Decimal in pattern at 32 NUM1 + 4: 40 20 20 21 4B 20 20 R1,NUM1+4 Point R1 at decimal in case NUM2 =
CVD
Character
Decimal
Binary
35
CVB Instruction
Possible errors on CVB:
specification exception if not on a doubleword boundary. data exception if not a valid packed decimal number. fixed-point divide exception if the number is too large to be stored in a fullword. addressing and protection exceptions.
39
CVD Instruction
Errors:
specification exception if not on a doubleword boundary. Addressing exception if address doesnt exist. Protection exception if address is outside the boundaries of the program.
42
AND Instruction
The net result is that performing an AND between 0 and an unknown bit results in Known 0; between 1 and an unknown bit leaves Pattern bits bit unaltered. 0110 1010 000000 1101 1000 111000 000000 0100 1000 Can use this to set selected bits to zero by putting a zero in those areas of the 9 pattern operand.
Or Instruction
The net result is that performing an OR between 0 and an unknown bit leaves the bit unaltered; between 1 and an unknown Pattern bit results in 1. 0110 1010 000000 1101 1000 111000 111000 1111 1010 Can use this to set selected bits to 1 by putting a 1 in those areas of the pattern 13 operand.
R3,=X7FFFFFFF B01111111
Turn flag (sign bit) off.
Exclusive Or Instruction
Performing an Exclusive OR between 0 and an unknown bit leaves the bit unaltered; between 1 and an unknownPattern bit results in reversing the value of the bit. 0110 1010 000000 11 10 11 01 1 10 01 00 0 11 10 00000 1 0
18
Exclusive Or Instruction
X
Result
r,address
Pattern
Compares fullword in register with fullword at address (pattern). Result replaces 1st
operand. X R3,=X80000000 Pattern = B10000000 Reverses the leftmost bit, all others 19 unchanged. CC = 0 if result all 0s; otherwise, CC = 1.
Exclusive Or Instruction
Example: Exchange the values of two registers (otherwise, this would require the use of a third register or the temporary use of a fullword in storage) XR XR XR R2,R3 R3,R2 R2,R3
Challenge: see if you can understand why this works. 21
22
24
25
The TM Instruction
Can use a single byte to keep track of multiple flags, one flag per bit. Use OI and NI to turn bytes on and off: OI FLAGBYTE,B'00100000' Turns 3rd flag on. NI FLAGBYTE,B'10111111' Turns 2nd flag off. 37 TM FLAGBYTE,B'00010000' Tests 4th flag.
ORG Command
location counter 000280 000280 000281 0002A9 000281 000295 0002A9 0002B3 002D0 INPUT TYPE NAME STREET CITY STATE ZIP CNTRY DS ORG DS DS DS ORG DS DS DS DS ORG ... CL80 INPUT CL1 CL40 CL39 Without this ORG, the INPUT+1 (or NAME) location counter would be CL20 positioned at the end of CL20 CL10 CNTRY, which is 9 bytes CL20 shy of where it should be. important!
Creates an overlay of new names that can be used to access the same storage areas.
ORG Command
STREET [39]
TYPE [1]
First ORG setsSecond up ORG sets upThird ORG moves this overlay. this overlay. location counter back to end of INPUT.
ORG Command
location counter 000280 000280 000281 0002A9 000281 000295 0002A9 0002B3 002D0 INPUT TYPE NAME STREET CITY STATE ZIP CNTRY DC ORG DS DS DS ORG DS DS DS DS ORG ... CL80 INPUT CL1 CL40 CL39 INPUT+1 (or NAME) CL20 CL20 Again, this is important CL10 to reset location to CL20