Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

Problem with MVC instruction

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> PL/I & Assembler
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    Post subject: Problem with MVC instruction
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    Post subject:
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    Post subject: Reply to: Problem with MVC instruction
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: 7935
Location: Bellevue, IA

PostPosted: Mon Jan 03, 2011 4:03 am    Post subject:
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    Post subject: @Santosh
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    Post subject: Re: Problem with MVC instruction
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    IBMMAINFRAMES.com Support Forums -> PL/I & Assembler All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts SYMNAMES problem jacobdng DFSORT/ICETOOL 7 Thu Dec 22, 2016 7:47 am
No new posts Problem in writing Output file vickey_dw COBOL Programming 5 Mon Nov 14, 2016 11:14 pm
No new posts Problem in Running Query via JCL vickey_dw DB2 3 Tue Oct 18, 2016 11:11 pm
No new posts DB2 Streaming Batch Processing Problem Manshadi DB2 4 Sat Sep 24, 2016 12:14 pm
No new posts Problem with GETMAIN command amitc23 CICS 6 Thu Sep 01, 2016 1:01 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us