steve-myers wrote:The macro itself did not calculate the +20. Some anonymous IBM programmer in the 1960s calculated the +20.
Haha!

Thank you again for your detailed explanation. I believe I've learned a lot from this post. Thank you, Steve.
steve-myers wrote:The macro itself did not calculate the +20. Some anonymous IBM programmer in the 1960s calculated the +20.
Code: Select all
LA 0,L'FIELD
LA FIELD+L'FIELD
BCTR 15,0
CLI 0(15),C' '
BNE *+12
BCT 0,*-10
LA 15,FIELD
LA 14,FIELD
SR 15,14
EX 15,MVC
LA 15,OUTPUT+1(15)
LA 14,RDW
SR 15,14
STH 15,0(,14)
...
MVC MVC OUTPUT(*-*),0(14)
...
FIELD DC CL8'DATA'
RDW DC Y(*-*,0)
OUTPUT DC CL80' '
steve-myers wrote:Now I know you won't reply, but at least think about these questions.I will answer one more possible query. Why do I use a Y type address constant in RDW DC Y(..? I use Y because it aligns to a halfword boundary; AL2 does not align to anything.
- Are the *+12 and *-10 correct? I think they are, but I've been known to goof. How did I calculate the *+12 and *-10 addresses?
- Where does the *-10 branch to? Why do I want to branch there?
- Where does the *+12 branch to? Why do I want to branch there?
- What is the purpose of the LA following the BCT instruction? Hint: think FIELD is CL8' '
- What are the instructions following the EX instruction doing?
- Why is OUTPUT+1 used in the LA after the EX instruction?