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

Blank /Space out big memory area in Assembly


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

New User


Joined: 01 Jun 2009
Posts: 9
Location: India

PostPosted: Wed Oct 06, 2010 11:45 am
Reply with quote

Hi,

What is the best way to blank out i.e putting spaces (x'40') in a large memory area say 4K.

Should we use MVCL? if yes then how.

Regards,
Manu Dhawan
Back to top
View user's profile Send private message
Bill O'Boyle

CICS Moderator


Joined: 14 Jan 2008
Posts: 2501
Location: Atlanta, Georgia, USA

PostPosted: Wed Oct 06, 2010 3:58 pm
Reply with quote

IMHO, when the length exceeds 768, then an MVCL should be used. In this example R0/R1 and R14/R15 are used. As a failsafe, you may want to save them beforehand, unless you're sure they're not being used.

EG:

Code:

BIGAREA  DS    XL4096

         LA    R0,BIGAREA          RECEIVING-ADDRESS
         LHI   R1,L'BIGAREA        RECEIVING-LGTH
         XR    R14,R14             SENDING-ADDRESS
         LA    R15,64              LOAD WITH X'00000040'
         SLL   R15,24              COMPLETE SENDING-LGTH
         MVCL  R0,R14              CLEAR TO SPACES

Instead of the two instructions against R15, some folks use -

Code:

         ICM   R15,B'1111',=X'40000000'

LHI is an immediate instruction. If the length exceeds 32767, then you need to specify a fullword.

Code:

         L     R1,=A(L'BIGAREA)

MVCL will clear up to 16MB-1. For areas that exceed 16MB-1, review MVCLE.

Bill
Back to top
View user's profile Send private message
Manu Dhawan

New User


Joined: 01 Jun 2009
Posts: 9
Location: India

PostPosted: Wed Oct 06, 2010 4:21 pm
Reply with quote

Thanks Bill.....Great Explanation

I had coded the same way with little modifications like instead of LHI I used LA i.e.

Code:
LA   R1,L'BIGAREA


And yes I used ICM

Code:
XR     R15,R15
ICM    R15,B'1000',X'40'


Cause it is just one immediate character that you are inserting.

Also you said that when length exceeds 768 then we use MVCL. Did you mean 256 because I know that MVC is up to 256 and for more than that we use MVCL.
Back to top
View user's profile Send private message
Bill O'Boyle

CICS Moderator


Joined: 14 Jan 2008
Posts: 2501
Location: Atlanta, Georgia, USA

PostPosted: Wed Oct 06, 2010 4:29 pm
Reply with quote

Remember, LA is limited to 4095. This is why LHI is preferred. The ICM to R15 was to ensure that the low-order three-bytes were X'000000' and the high-order is the pad-character.

I use 768 as a cutoff point because it's less cycles to use an MVI, followed by a 255-byte propagation MVC then two 256-byte MVC's.

But, this is just my opinion.

I certainly would not use MVCL for lengths less than 257.

BTW, your ICM requires the character as a literal (=X'40'), not an immediate.

Bill
Back to top
View user's profile Send private message
Manu Dhawan

New User


Joined: 01 Jun 2009
Posts: 9
Location: India

PostPosted: Wed Oct 06, 2010 4:43 pm
Reply with quote

Thanks again Bill.

Yeah that was a mistake for ICM.
Back to top
View user's profile Send private message
Bill O'Boyle

CICS Moderator


Joined: 14 Jan 2008
Posts: 2501
Location: Atlanta, Georgia, USA

PostPosted: Wed Oct 06, 2010 5:07 pm
Reply with quote

One last thought. You could use XR R15,R15, followed by an OIHH R15,16384 (X'4000' - the pad-character X'40'), which is an immediate instruction and will "OR" a X'4000' into the high-hword of R15.

But, I'm not sure if the LA R15,64 combined with the SLL R15,24 causes more or less cycles. If there is a difference, it would probably be immeasurable.

Anyway, it's good to have options.... icon_wink.gif

Bill
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 Replace each space in cobol string wi... COBOL Programming 3
No new posts Merge files with a key and insert a b... DFSORT/ICETOOL 6
No new posts Merge 2 lines based on Space from a S... DFSORT/ICETOOL 5
No new posts Allocated space calculation from DCOL... PL/I & Assembler 3
No new posts File transfer from host with filler f... TSO/ISPF 15
Search our Forums:

Back to Top