View previous topic :: View next topic
|
Author |
Message |
Agrawal_Santosh
New User
Joined: 28 Dec 2010 Posts: 2 Location: London
|
|
|
|
Hello,
I am new to assembler and tried to use MVC instruction in different ways.
I tried to run below statements -
Code: |
MVC FLD3+2(29),=CL29'NEGATIVE MOVE '
WTO TEXT=(FLD3,D),ROUTCDE=(2)
MVC FLD3+2(21),=C'NEGATIVE MOVE'
WTO TEXT=(FLD3,D),ROUTCDE=(2)
MVC FLD3+2(20),=C'NEGATIVE MOVEĀ£'
WTO TEXT=(FLD3,D),ROUTCDE=(2)
FLD3 DS 0CL31
DC AL2(L'MESSAGE)
DS CL29
MESSAGE DC C'THIS IS MY FIRST ASM PROGRAM.'
|
Problem here is first and third MVC is working fine but second MVC is giving SOC4. I am not able to understand what is wrong here.
Thanks!! |
|
Back to top |
|
|
Ronald Burr
Active User
Joined: 22 Oct 2009 Posts: 293 Location: U.S.A.
|
|
|
|
You only defined the second constant as 13 bytes, but are attempting to move 21 bytes. (unlike the first constant, the second was not defined with a (CL21) length qualifier, hence was implicitly defined as only 13 bytes in length).
If you look at the expansion of your program, you will likely find that the second literal was the last literal generated and starts fewer than 21 bytes before the end of your program - hence, attempting to move 21 bytes when there are fewer than 21 left in your addressable space results in an S0C4 abend (an addressing exception ).
Out of curiosity - if the SECOND MVC causes a S0C4, how can you say that the THIRD MVC works?
As an aside, writing messages to the console operator (ROUTCDE=2) is usually frowned upon, unless there is a darned good reason to do so. Better to use ROUTCDE=11 and just post the messages to the jes message log. |
|
Back to top |
|
|
Agrawal_Santosh
New User
Joined: 28 Dec 2010 Posts: 2 Location: London
|
|
|
|
Thanks for response Ronald!!
What you said looks correct to me but again my query is -
If I comment out second MVC and try to run the program only with first and third MVC, it is working fine with maxcc=0. However the difference between second and third MVC is only FLD3+2(21) is replaced by FLD3+2(20). Except this all othere things are same and program is running fine. |
|
Back to top |
|
|
Robert Sample
Global Moderator
Joined: 06 Jun 2008 Posts: 8697 Location: Dubuque, Iowa, USA
|
|
|
|
Quote: |
However the difference between second and third MVC is only FLD3+2(21) is replaced by FLD3+2(20). |
What you say here is not true -- because there is a sending field AND a receiving field in the MVC instruction. You realize that the S0C4 abend is due to the SENDING field, not the receiving field, right? If you used an LTORG before FLD3, you would not get any abend at all -- unless you exceed the 4095 byte addressing limit on your base register. |
|
Back to top |
|
|
manikawnth
New User
Joined: 07 Feb 2007 Posts: 61 Location: Mumbai
|
|
|
|
It is always better if u could attach the listing of it to analyze why the instruction accessing the protected storage |
|
Back to top |
|
|
nigelosberry
New User
Joined: 06 Jan 2009 Posts: 88 Location: Ggn, IN
|
|
|
|
I know its a little too late to post a response for this now. But I hope the below info will help conclude the discussion:
Assembling the given code with ASMA90 should produce below listing for the literal pool:
Code: |
0000B8 50 LTORG ,
0000B8 D5C5C7C1E3C9E5C5 51 =C'NEGATIVE MOVE$'
0000C6 D5C5C7C1E3C9E5C5 52 =C'NEGATIVE MOVE '
0000E3 D5C5C7C1E3C9E5C5 53 =C'NEGATIVE MOVE'
000000 54 END TSTPGM |
The literal pool is populated as governed by the below rules(See This):
Each literal pool has five segments into which the literals are stored
(a) in the order that the literals are specified, and
(b) according to their assembled lengths, which, for each literal, is the total explicit or implied length, as described below.
1) The first segment contains all literal constants whose assembled lengths are a multiple of 16.
2) The second segment contains those whose assembled lengths are a multiple of 8, but not of 16.
3) The third segment contains those whose assembled lengths are a multiple of 4, but not a multiple of 8.
4) The fourth segment contains those whose assembled lengths are even, but not a multiple of 4.
5 )The fifth segment contains all the remaining literal constants whose assembled lengths are odd.
As evident from the rules, the first literal in the pool should be =C'NEGATIVE MOVE$' as per rule #4.
The last literal should be =C'NEGATIVE MOVE' as per rule #5.
Hence the second MVC in the original program(which is referencing last literal) will indeed produce a storage exception. |
|
Back to top |
|
|
|