IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Problem with MVC instruction


IBM Mainframe Forums -> PL/I & Assembler
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
Agrawal_Santosh

New User


Joined: 28 Dec 2010
Posts: 2
Location: London

PostPosted: Fri Dec 31, 2010 9:42 pm
Reply with quote

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
View user's profile Send private message
Ronald Burr

Active User


Joined: 22 Oct 2009
Posts: 293
Location: U.S.A.

PostPosted: Fri Dec 31, 2010 10:24 pm
Reply with quote

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
View user's profile Send private message
Agrawal_Santosh

New User


Joined: 28 Dec 2010
Posts: 2
Location: London

PostPosted: Mon Jan 03, 2011 3:06 am
Reply with quote

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
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 8697
Location: Dubuque, Iowa, USA

PostPosted: Mon Jan 03, 2011 4:03 am
Reply with quote

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
View user's profile Send private message
manikawnth

New User


Joined: 07 Feb 2007
Posts: 61
Location: Mumbai

PostPosted: Mon Jan 03, 2011 12:18 pm
Reply with quote

It is always better if u could attach the listing of it to analyze why the instruction accessing the protected storage
Back to top
View user's profile Send private message
nigelosberry

New User


Joined: 06 Jan 2009
Posts: 88
Location: Ggn, IN

PostPosted: Tue Apr 05, 2011 12:15 pm
Reply with quote

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
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> PL/I & Assembler

 


Similar Topics
Topic Forum Replies
No new posts Map Vols and Problem Dataset All Other Mainframe Topics 2
No new posts z/vm installation problem All Other Mainframe Topics 0
No new posts Job scheduling problem. JCL & VSAM 9
No new posts Problem with IFTHEN=(WHEN=GROUP,BEGIN... DFSORT/ICETOOL 5
No new posts Need to add field to copybook, proble... COBOL Programming 14
Search our Forums:

Back to Top