How to initialize 20,000 bytes in the Assembler..
Answers were Sorted based on User's Feedback
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 |
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 |
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 |
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 |
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 |
What does LA R3,R3 ?
What is house keeping in assembler?
Explain the difference between various read and find statement and which one should be used when for better adabas performance?
HOW MANY MAXIMUM BASE REGISTERS WE CAN HAVE IN A PROGRAM AND ALSO HOW MANY MAXIMUM BASE REGISTERS WE CAN HAVE IN A SINGLE PROGRAM.
about ICM instruction.
What does "using" do?
What is house keeping in assembler? And explain the following code HELLOTSO START 0 * PRINT NOGEN BEGIN SAVE (14,12) LR 12,15 USING TYPE,12 ST 13,SAVE+4 LA 11,SAVE ST 11,8(13) LR 13,11
What is the difference in data type "X" and "P"?
What is maximum displacement and how to cross this limit?
How many maximum base registers we can have in a program?
In the house keeping section of an MVS assembly language program, like the one below STM R14,R12,12(R13) BASR R12,R0 USING *,R12,R11 LA R11,2048 LA R11,2048(R11,R12) .... .... 1. What if BASR R12,R0 IS NOT PRECEDE USING *,R12,R11? 2. USING (base address), REGISTER does USING directive says assembler to treat particular Register as a base register with the mentioned base address..in the above case * i.e current location counter..well if that is the case why we need BASR R12,R0 ? 3. What if I write like STM R14,R12,12(R13) BASR R12,R0 LA R11,2048 LA R11,2048(R11,R12) USING *,R12,R11 there is no address resolution being calculated in both LA statements so is it a right way to set Base register?..will there be any issues with Domain regarding R11 and R12?
How to pass instream data in sysin with Assembler?