View previous topic :: View next topic
|
Author |
Message |
hchinnam
New User
Joined: 18 Oct 2006 Posts: 73
|
|
|
|
All,
I have following piece of code in my pgm
Code: |
MVC KEY1,SPACES
MVC KEY2,SPACES
WTO MF=(E,WTOBLOCK) DISPLAY THEM
MVC KEY1(R9),0(7) GET THE KEY FROM FILE1
WTO MF=(E,WTOBLOCK) DISPLAY THEM
MVC KEY2(R9),0(8) GET THE KEY FROM FILE2
WTO MF=(E,WTOBLOCK) DISPLAY THEM
|
Declarations as below
Code: |
WTOBLOCK EQU *
DC H'150' * FOR WTO, LENGTH OF WTO BUFFER...
DC H'0' SHOULD BE BINARY ZEROES...
WTOTEXT DC CL1'D'
D DC CL30'< WS STARTS HERE> '
D0 DC CL1'A'
SAV02 DS F
D01 DC CL1'B'
SAV07A DS F
D02 DC CL1'C'
SAV08A DS F
D03 DC CL1'D'
SAV09A DS F
D04 DC CL1'E'
KEY1 DS CL50' '
D05 DC CL1'F'
KEY2 DS CL50
|
My memory at R7 looks as below,
My memory at R8 looks as below,
for this my WTO output looks as below
Code: |
11.00.21 JOB04253 +D< WS STARTS HERE> A B ¯ C ÷ D E
4FF4FF4FF4DDCFFFFF444C44EE4EECDEE4CCDC64444444444444C0000C00000A2C00000E2C0000000C444444444444444444444444444444444444444444
011B00B2101620425300E4C062023193208595E0000000000000100002000001030000010400000015000000000000000000000000000000000000000000
---------------------------------------------------------------------------------------------------------------------------
11.00.21 JOB04253 +D< WS STARTS HERE> A B ¯ C ÷ D E1 A
4FF4FF4FF4DDCFFFFF444C44EE4EECDEE4CCDC64444444444444C0000C00000A2C00000E2C0000000CF4C444444444444444444444444444444444444444
011B00B2101620425300E4C062023193208595E0000000000000100002000001030000010400000015101000000000000000000000000000000000000000
---------------------------------------------------------------------------------------------------------------------------
11.00.21 JOB04253 +D< WS STARTS HERE> A B ¯ C ÷ D E1 A
4FF4FF4FF4DDCFFFFF444C44EE4EECDEE4CCDC64444444444444C0000C00000A2C00000E2C0000000CF4C444444444444444444444444444444444444444
011B00B2101620425300E4C062023193208595E0000000000000100002000001030000010400000015101000000000000000000000000000000000000000
---------------------------------------------------------------------------------------------------------------------------
F2 B
44444444444444444444444444444CF4C4444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444
0000000000000000000000000000062020000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
|
As you can see my R9 content is 1 (between 'D' and 'E'). Now my question is why my MVC statement is moving more then one character. |
|
Back to top |
|
|
Bill O'Boyle
CICS Moderator
Joined: 14 Jan 2008 Posts: 2501 Location: Atlanta, Georgia, USA
|
|
|
|
Your MVC syntax is not correct and I don't see why you need R9.
MVC KEY1,0(R7)
MVC KEY2,0(R8)
Note that the data moved to KEY1 and KEY2 will equal the length of these labels (50-Bytes).
Where do you have SPACES defined?
Regards,
Bill |
|
Back to top |
|
|
hchinnam
New User
Joined: 18 Oct 2006 Posts: 73
|
|
|
|
Bill O'Boyle wrote: |
I don't see why you need R9.
|
This is part of a key matching program. Each file will have a key, and position and length of the key are passed in a control card.
I store the length in R9. So i need it go get the exact Key out.
Quote: |
Your MVC syntax is not correct
|
Can please explain. I didn't see anything wrong with syntax. over to that, pgm compiled and ran with out any issues. it's just that results are not as expected.
Quote: |
Where do you have SPACES defined?
|
Yes it is defined. |
|
Back to top |
|
|
Robert Sample
Global Moderator
Joined: 06 Jun 2008 Posts: 8696 Location: Dubuque, Iowa, USA
|
|
|
|
Quote: |
Can please explain. I didn't see anything wrong with syntax. over to that, pgm compiled and ran with out any issues. it's just that results are not as expected. |
Have you looked at the expansion of the MVC instruction in the Assembler listing? Do you see where it starts D208? The D2 means it is an MVC instruction, the 08 means you're moving 9 bytes of data -- not the length in register 9, but 9 actual bytes. |
|
Back to top |
|
|
hchinnam
New User
Joined: 18 Oct 2006 Posts: 73
|
|
|
|
Thanks for the clarification Robert. Is there a way in Assembler to pass length in a variable?
i.e I will have length to be extracted in a GPR and i want to move that many bytes to a destination.
I know i can do this with MVI and loop but is there a better way. |
|
Back to top |
|
|
Robert Sample
Global Moderator
Joined: 06 Jun 2008 Posts: 8696 Location: Dubuque, Iowa, USA
|
|
|
|
Investigate the EX instruction -- it exists for MVC of variable length data. |
|
Back to top |
|
|
Bill O'Boyle
CICS Moderator
Joined: 14 Jan 2008 Posts: 2501 Location: Atlanta, Georgia, USA
|
|
|
|
I agree that you probably need to use an EX of an MVC instruction, which is a popular (and powerful) instruction combination.
If you can't figure out how to use this (or the length of your Operand 1 data exceeds 256 --- MVC limitation), then you can use an MVCL.
However, an MVCL requires the use of four (4) registers and you can probably get away with using R0/R1 for the RECEIVING address and length and R14/R15 for the SENDING address and length or (if you need to be cautious) save them in two adjacent doublewords, using a Load Multiple (LM) and restore them using a Store Multiple (STM).
FWIW, the maximum length for an MVCL is 16777215 (16MB-1).
Regards,
Bill |
|
Back to top |
|
|
bengtpelle
New User
Joined: 28 Aug 2006 Posts: 24 Location: St. Petersburg, FL
|
|
|
|
Change your code to:
Code: |
MVC KEY1,SPACES
MVC KEY2,SPACES
WTO MF=(E,WTOBLOCK) DISPLAY THEM
EX R9,MVC1 GET THE KEY FROM FILE1
WTO MF=(E,WTOBLOCK) DISPLAY THEM
EX R9,MVC2 GET THE KEY FROM FILE2
WTO MF=(E,WTOBLOCK) DISPLAY THEM
-
-
B ?????
MVC1 MVC KEY1(0),0(7) GET THE KEY FROM FILE1
MVC2 MVC KEY2(0),0(8) GET THE KEY FROM FILE2 |
|
|
Back to top |
|
|
Bill O'Boyle
CICS Moderator
Joined: 14 Jan 2008 Posts: 2501 Location: Atlanta, Georgia, USA
|
|
|
|
You need to issue a -
Code: |
BCTR R9,0 REDUCE BY 1 FOR 'MVC' LENGTH
|
The BCTR is required every time R9 is loaded.
FWIW, you can also issue an "ADD HALFWORD IMMEDIATE" of a negative 1 -
Code: |
AHI R9,-1 REDUCE BY 1 FOR 'MVC' LENGTH
|
Regards,
Bill |
|
Back to top |
|
|
Bill Dennis
Active Member
Joined: 17 Aug 2007 Posts: 562 Location: Iowa, USA
|
|
|
|
Make sure R9 isn't zero and goes negative or you'll move 256 bytes! |
|
Back to top |
|
|
bengtpelle
New User
Joined: 28 Aug 2006 Posts: 24 Location: St. Petersburg, FL
|
|
|
|
It can be zero!!!
Zero means one byte.
R9 should contain number of bytes to move -1. |
|
Back to top |
|
|
stkg
New User
Joined: 22 Oct 2008 Posts: 1 Location: Japan
|
|
|
|
is interpreted as
and then it means "move 9 byte from the storage pointed by R7 to KEY1".
hlasm sees this "9" as the length |
|
Back to top |
|
|
Bill Dennis
Active Member
Joined: 17 Aug 2007 Posts: 562 Location: Iowa, USA
|
|
|
|
bengtpelle wrote: |
It can be zero!!!
Zero means one byte.
|
I meant if R9 starts as zero and you -1 then you get x'FF' for the MVC. |
|
Back to top |
|
|
Garry Carroll
Senior Member
Joined: 08 May 2006 Posts: 1193 Location: Dublin, Ireland
|
|
|
|
Also, in my experience, an MVC with length of -1 will move "two's complement " bytes. Assembler didn't enforce the 256-byte limit and a large chunk of memory got overwritten - it wasn't easy to debug.
Garry |
|
Back to top |
|
|
Mario S Nusbaum
New User
Joined: 27 Jan 2009 Posts: 1 Location: Sao Paulo,Brazil
|
|
|
|
Garry Carroll wrote: |
Also, in my experience, an MVC with length of -1 will move "two's complement " bytes. Assembler didn't enforce the 256-byte limit and a large chunk of memory got overwritten - it wasn't easy to debug.
Garry |
No way! It'll move exactly 256 bytes. There aren't negative values in the lenght field. Otherwise you'd "loose" the first bit. |
|
Back to top |
|
|
|