How to initialize 20,000 bytes in the Assembler..

Answers were Sorted based on User's Feedback



How to initialize 20,000 bytes in the Assembler....

Answer / saurabh biswas

To initialize a 20000 byte field you have to use MVCL
instruction. Let's say VAR1 is defined as " VAR1 DS XL20000"
For using MVCL instruction you require two even-odd regiter
pair, even registers will contain the destination and
source address respectively, first odd register will
contain the destination leght and from 2nd to 4th byte of
the second odd register will contain the source length and
the first byte will contain filler(it will come into play
if destination lenghth is shorter than source). Now if we
want to initialize VAR1 with spaces we have to code like
following way:

LA R4,VAR1
LA R5,20000
XR R8,R8
XR R9,R9
ICM R9,B'1000',X'40'
MVCL R4,R8

Here source length is 0 and destination length is 20000. So
no move ment will occur and all the 20000 byte will be
filled by the filler wich is space here. So as result of
this instruction all 20000 byte will be initialized by
spaces.

Is This Answer Correct ?    25 Yes 4 No

How to initialize 20,000 bytes in the Assembler....

Answer / roocarlin

since the machine-code for MVC moves up to 256 bytes, you would need to do a series of MVCs to initialize 20000 bytes. this requires that you maintain a register or two to keep track of how far you've progressed through initialization.

possibly, you could get MVCL to do it; i've never tried...

MVCL uses 2 sets of even-odd pairs of registers to do the move.
you specify source address, destination address, length of source, length of destination, and fill character in the registers. the fill-character goes into the high order byte of (I THINK...) the destination length register (in this case r4)
l r4,=f'20000'
l r6,=f'20000'
la r7,source_field
la r5,dest_field
mvcl r4,r6

Is This Answer Correct ?    10 Yes 3 No

How to initialize 20,000 bytes in the Assembler....

Answer / slantt

How about using a 'getmain' for the storage amount? I believe the macro has the capability to set the requested storage to x'00'. Don't forget the 'freemain' if you're done with the storage but not the program. The storage will be freed during program close.

Is This Answer Correct ?    0 Yes 0 No

How to initialize 20,000 bytes in the Assembler....

Answer / king nahiku

fielda DC C20000’ ’

* The requirement is to initialize 20000 bytes
not "reinitialize" 20000 bytes.

* The above statment initializes 20000 bytes of storage to
spaces. The bonus is that it is done at assembly time and
not run time.

Is This Answer Correct ?    4 Yes 13 No

How to initialize 20,000 bytes in the Assembler....

Answer / munna

initalization done by using below code.
MVI datafield,C' '
MVC datafield+1(L'datafield-1),datafield

Is This Answer Correct ?    5 Yes 27 No

Post New Answer

More Assembler Interview Questions

Why can only 256 bytes be moved from one address to another in a MVC?

6 Answers   CSC, HCL, IBM,


what is need of start 0? In steed of

0 Answers   IBM,


change process tool( code changes from dev to prd) The changes made to your code should be effected in live. how the process takes place. that is how can you move the code changes from development to production.

1 Answers   EDS,


What is maximum displacement?

0 Answers  


Explain the difference between various read and find statement?

0 Answers  






What will happen if we drop the base register in the program which contains only one basereg?

0 Answers  


Write the fetch cycle and execute cycle for following instructions:JMPNZ (jump to the given address if the accumulator not equal to zero) RET(return from a subroutine) ADB (add the contents of register B to the accumulator and save result in the accumulator).

1 Answers  


Can we use an equated value as operand for an MVC instruction? Reason for the same

8 Answers   IBM,


about ICM instruction.

4 Answers   EDS,


how do you round the addition or subtraction of two numbers in assembler? what does the following code do? change process tool(code changes from dev to prd) the changes made to your code should be effected in live. How the process takes place. That is how can you move the code changes from development to production?

0 Answers   IBM,


What is symbol table in assembler?

2 Answers   HCL,


How is data passed from a calling program to an assembler called program?

0 Answers  


Categories