1.  What would be the value of MSG after instruction (b) is executed? And Why?

(a). MVI    MSG,X'40'

(b). MVC   MSG+1(19),MSG


    MSG   DS  20CL

 


Ans: MSG will be initialized to blanks.

MVC instruction moves one byte of data at a time, processing from left to right through each field. After the execution of instruction (a), the first byte of MSG is initialized to X'40' (a blank). The instruction (b) takes this one byte, copies to MSG+1, then the value at MSG+1 is taken and copied to MSG+2, then the value at MSG+2 is taken and copied to MSG+3 and so on. This process continues until the MSG+18th byte is copied to MSG+19.

 

2.  Will the instruction UNPK    DWORD(4),=X'ABCD'   be compiled successfully? If yes, will it be executed successfully?

Ans: Yes, the instruction will be compiled and executed successfully. After the execution, DWORD will contain FAFBDC.

 

3.  What is the maximum data length that can be moved using an MVC instruction?

Ans: 256

 

4.  What size field an ST instruction work with?

Ans: Fullword (4bytes)

 

5.  How many registers an LA instruction use?

Ans: 3                    LA    R1,D2(X2,B2)

 

6.  What direction does an UNPK instruction execute and what effect does it have on the sign?

Ans: From right to left. No effect.

 

7.  In the instruction ICM R11,8,X'20', what is the effect of 8?

Ans: Move X'20' into the 1st byte of R11.

Note: The INSERT CHARACTERS UNDER MASK instruction inserts the consecutive bytes addressed by the second operand into the bytes in the first operand register that are mapped by one bits in the mask (M3 value in instruction format above).  The mask bits correspond one for one with the 4 bytes in the first operand register; if a bit is on, a byte from main storage is inserted into the corresponding first operand register byte; if the bit is off, no insertion occurs.

 

8.  What format must data be in for ED instruction?

Ans: Packed.

 

9.  What does a '21' do in edit pattern used by the ED instruction?

Ans: Significance starter

 

10. How would you change the leading zeros in the data to blanks (zero-suppression) when you use an ED instruction?

Ans: The edit pattern must contain a lead blank (x'40') followed by as many hex 20s (x'20') as there are digits in the packed field.

 

11. What is the effect of executing a BCT R1,LABEL when R1=0?

Ans: Infinite loop. After the execution of the instruction, the value in R1 will be R1-1= 0-1=-1. Hence the branch to LABEL will take place. During the next execution, R1 will become R1-1=-1-1=-2, and since the value of R1 is still not zero, the branch to LABEL will take place again. This will continue. Because the value of R1 will never reach zero, the program will go into an infinite loop.

Note: The BRANCH ON COUNT instruction is used to branch to a storage location whose address is specified by the second operand of the instruction, if the value in the first operand register is non-zero after one is subtracted from it.  The BCT instruction is ideal for controlling how many times a loop occurs in a program, when it is used as the last instruction in the loop. The BCT and therefore the loop will occur until the value in the first operand register is zero; then the branch will not be taken and the loop will stop.    

 

12. What is the maximum number of bytes that can be moved with an MVI instruction?

Ans: 1 byte

 

13. What does a LA instruction do?

Ans: The LOAD ADDRESS instruction loads the address specified by the second operand into the general-purpose register specified by the first operand.  The values in the X2 (index), B2 (base) and D2 (displacement) portions of the second operand are added and placed in the register specified by the first operand.

 

14. If LA R15,=A(PGM) instruction loads the address of PGM into R15, what does LA R15,6 do? Will the instruction be assembled and executed successfully?

Ans: The instruction LA R15,6  will be assembled and executed successfully. After the execution R15 will store a value 6.

 

15. Which instruction will you use to redefine a storage area?

Ans: ORG

 

16. What is the effect of instruction ORG?          

Ans: This will cause the location counter to be set to the highest value it has had up to that point within the current CSECT.

 

17. What are the standard housekeeping (initialization) routines used in an Assembler program?

Ans: First, the housing keeping routine must provide standard MVS program linkage.

The basic feature of standard MVS program linkage is a register save/restore technique. It means that when  one program passes control to another program, as when MVS supervisor program passes control to the reorder-listing program, the contents of 16 general-purpose registers are stored or saved. Then when control is passed back, the registers are reloaded or restored.           Second, it must load and identify the base register for the program.

Third, it must make any preparations that are required by the main processing routine of the program.

Text Box: FIRSTASM 	START 0
      	STM   R14,R12,12(R13)  --> Store all registers except R13 in Caller's SAVEAREA
    	      	BALR  R3,0        --> load base register    
USING *,R3          
         		ST    R13,SAVE+4 --> Store caller's save area address in SAVE+4  
         		LA    R13,SAVE    ---> Load program's save area address
         		:
	 	L     R13,SAVE+4  ---> Restore caller's save area address in SAVE+4      
         		LM    R14,R12,12(R13) --> Restore all other register value
LA    R15,0  --> Set return code to 0
BR    R14  ---> Return control to caller.

SAVE		DC    18F'0'

 


18. What happens to the bytes that are not filled by the sending field during an MVO instruction?

Ans: The right most half byte of the receiving field remains unchanged, The left most bytes of the receiving field are padded to hex zeros.                  

 

19. What is SVC? Explain SVC 13.

Ans: The SUPERVISOR CALL instruction causes a supervisor call interruption, with the "I" value in the instruction providing the rightmost byte of the interruption code. Each supervisor call routine (SVC) has a unique number assigned to it in the range 0 through 255, inclusive.

Many MVS macros issue SVCs; TIME, LOAD, and ABEND are examples of a few that do.  An ABEND will result if a SVC number is used for which no supporting program address been installed into the MVS SVC table.       SVC 13 means issue the 'ABEND' SVC

 

20. What is alignment and how will you force alignment?

If the location counter value is divisible by 2, it is halfword aligned. If divisible by 4, it is fullword aligned. If it is divisible by 8, it is double word aligned.

1. You can use the DS instruction to force alignment to a boundary that otherwise would not be provided.   You can force the location counter to a double-word, full-word, or half-word boundary by using the appropriate field type (for example, D, F, or H) with a duplication factor of zero.  No space is reserved for such an instruction, yet the data that follows is aligned on the desired boundary.  For example, the following statements would set the location counter to the next double-word boundary and reserve storage space for a 128-byte field (whose leftmost byte would be on a double-word boundary).

                                DS           0D

      AREA              DS           CL128

2.  Alignment is forced when either the ALIGN or the NOALIGN assembler option is set.

The bytes skipped for alignment is filled by zeros.

 

 

21. What is a CNOP instruction?

The CNOP instruction is to align any instruction or other data on a specific halfword boundary.  The CNOP instruction ensures an unbroken flow of executable instructions by generating no-operation instructions to fill the bytes skipped to achieve the alignment that you specified.

It does not affect the location counter if the counter is already correctly aligned.  If the specified alignment requires the location counter to be incremented,

one-to-three no-operation instructions (BCR 0,0 occupying two bytes each) are generated to fill the skipped bytes.  Any single byte skipped to achieve alignment to the first no-operation instruction is filled with zeros.

Assume that the location counter is already double-word aligned. Then,

CNOP            6,8 after assembly will generate

BCR             0,0

BCR             0,0

BCR             0,0

 

22. What is ADCON resolution?