I am working on an assignment for a college assembly class. We are using IBM Mainframe PC370 emulator. (Old school, but great starting point)
I always try to go a little beyond the scope of the assignment in order to better my programming skills.
What I am trying to do is to move some character data (WORD) into (CWORD) with a offset of 1 using a register. My hope is to be able to place data into an index based off of the input from a file to determine the placement in an index.
We have been given a file that has a five digit dollar figure in position 1-5 and a two digit month code in position 20-21. I would like to put the month code in a register to determine the offset to add the dollar amount into that position in the index.
The following code is what I have been using to attempt the register offset.
Is this even possible? I have not found anything in the textbook or online that specifically discusses doing this type of thing.
L R5,1 MVC CWORD+0(R5),WORD WTO CWORD WTOR 'PRESS ENTER TO EXIT',EXIT
Thank you for your time. SUBCAN
You wrote:
L R5,1 Get the fullword (32bit) value at location 0001.
MVC CWORD+0(R5),WORD Copy the 5 bytes at location WORD to location CWORD.
WTO CWORD Display the contents of CWORD.
WTOR 'PRESS ENTER TO EXIT',EXIT Display the message and wait for a response.
Plus, presumably:
CWORD DS CL5 Output area.
...
WORD DS CL4 Input area
You should have written:
LA R5,CWORD+1 Get the address of the second byte of CWORD.
MVC 0(L'WORD,R5),WORD Copy the Length(WORD) bytes at location WORD to location CWORD+1.
WTO CWORD Display the contents of CWORD.
WTOR 'PRESS ENTER TO EXIT',EXIT Display the message and wait for a response.
...
CWORD DS CL5 Output area.
WORD DS CL4 Input area
At least, that sounds like what you wanted. But it isn't 100% clear from your question. If that wasn't your intention.