Can we use MVC instruction to move pack field to pack
field....which instruction you will use and why ?

Answers were Sorted based on User's Feedback



Can we use MVC instruction to move pack field to pack field....which instruction you will use and ..

Answer / steve holton

Qualification to above answer:

You can use MVC to move ANY data from any addressable
storage area to another. So the answer above is correct.
But if you use this technique, it is up to the programmer to
ensure that the result is valid. For example, the source
field may not be the same length as the target, so any
subsequent decimal arithmetic calculations (after a
"straight" MVC FIELD2,FIELD2) against the target field could
result in abend (S0C7). Even if the source field IS packed
decimal, if it is of a different length than the target, the
programmer will have to "adjust" the source and target
specifications to ensure that the result in the target field
is valid packed decimal. For example, if the source field is
PL3 (packed length 3)and the target is PL5, a "straight" MVC
PL5field,PL3field will leave 2 bytes of "garbage" in the
last 2 bytes of PL5field (assuming that you don't get an
abend S0C4 because the and of PL3 is at a page boundary).
For this case to work, you need MVC PL5field+2(3),PL5field,
then you need to ensure that the "top two" bytes of PL5field
are zero to ensure that subesequent packed decimal
arithmetic using PL5field will work.

Is This Answer Correct ?    14 Yes 0 No

Can we use MVC instruction to move pack field to pack field....which instruction you will use and ..

Answer / steve holton

Slight correction to above:
..."you need MVC PL5field+2(3),PL5field,..."
should read:
"you need MVC PL5field+2(3),PL3field,"
Sorry for the typo...

Is This Answer Correct ?    9 Yes 1 No

Can we use MVC instruction to move pack field to pack field....which instruction you will use and ..

Answer / rich hornak

MVC Will work but as explained you must compensate for different lengths.
The more practical instruction would be the ZAP Zero and Add Packed.

The ZAP will adjust for different lengths and propagate leading zeros when a smaller field is being moved to a larger field.

TOTAMT DC PL5'0'
NEWAMT DC PL3'0'

Current Value of TOTAMT X'453789225C'
Current Value of NEWAMT X'00100C'

ZAP Instruction
ZAP TOTAMT,NEWAMT

New Value of TOTAMT After ZAP
TOTAMT DC PL5'000000100C'

Is This Answer Correct ?    7 Yes 0 No

Can we use MVC instruction to move pack field to pack field....which instruction you will use and ..

Answer / nsugandhi

We can certainly use the MVC instruction to move the pack data to another pack field.

Is This Answer Correct ?    4 Yes 0 No

Post New Answer

More Assembler Interview Questions

Why do we have multiple base registers in certain programs?

4 Answers   IBM,


How do you round the addition or subtraction of two numbers in assembler? what does the following code do? AP WKUR,=P'5' where WKUR is a label

3 Answers   CSC, IBM,


Explain how to pass instream data in sysin with assembler?

0 Answers  


How do you initialize a register to 0000?

10 Answers   HCL,


how to retrieve the instream data in sysin?

0 Answers   IBM,






WHAT WILL HAPPEN IF WE DROP THE BASE REGISTER IN THE PGM WHICH CONTAINS ONLY ONE BASEREG?

4 Answers   IBM, Tech Mahindra,


How are data passed from jcl parm to assembler program?

0 Answers  


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

8 Answers   IBM,


How to pass the parameters from jcl to assembler program?

0 Answers  


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

0 Answers  


how to produce SOC7 abend

1 Answers   EDS, IBM,


What is need of start 0? In steed of can we use anyother numerics? If we use what will happen?

0 Answers  


Categories