IBM Assembler Interview Preparation Guide

IBM Assembler frequently Asked Questions in various IBM Assembler job Interviews by interviewer. Get preparation of IBM Assembler job interview
Tweet Share WhatsApp

27 IBM Assembler Questions and Answers:

1 :: Explain ICM instruction?

ICM means INsert character under mask. its a movement of character under mask bits
eg
ICM R8,B'0110',SRC

Before execution:
R8 ==> 12 34 56 78
SRC ==> AB CD EF 10

After Excecution:
R8 ==> 12 CD EF 78
Download IBM Assembler PDF Read All 27 IBM Assembler Questions

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

If you write an MVC statement with an equated value as the
sending operand, then the assembler will try to resolve that
operand value as a base and displacement, it will not
necessarily throw an error at assembly, but the results at
execution will be unpredictable and may well give rise to a
protection exception.
The point of the MVI statement is that the single byte
sending operand value is assembled as part of the
instruction itself and does not have to be 'fetched' at
execution time, therefore if you are only moving a single
byte of fixed value, then an MVI will be marginally more
efficient than an MVC

3 :: How to retrieve the instream data in SYSIN?

Use Accept in procedure division.
Example :
WORKING-STORAGE SECTION.
01 empno. Pic x(05).
01 empname pic x(15).
01 empsal pic 9(10).
PROCEDURE DIVISION.
................
PERFORM ACCEPT-PARA.
..............
ACCEPT-PARA.
ACCEPT EMPNO.
ACCEPT EMPNAME.
ACCEPT EMPSAL.

In JCL :
...........
............
//sysin dd *
001
aaaa
330000
/*

4 :: How to Pass the parameters from JCL to assembler Pgm?

R1 contains a fullword that contains a address pointing to
tyhe parm data. In pgm before accessing the parm data use L
Rn,0(,R1) where n=3,..11 , Rn contains the address that
points to parm data. Create DSECT that contains a halfword
and the length of the data.

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

It will give an error at the time of assembly, if there are
some labels defined in the program(provided they are being
referenced in your program). This is because the assembler
resolves the displacement of that variable from the location
where your base register is pointing to.
Download IBM Assembler PDF Read All 27 IBM Assembler Questions

6 :: Why do we have multiple base registers in certain programs?

it all depends upon the length of your program , if it is
more than 4095 then we need 2 register else only one can do
needful.
basically we can even use savearea register as a base
register, so as to accomodate the length of the program

7 :: What is the difference in data type "X" and "P"?

In MVS assembler data type X denotes hexadecimal data type
which unsigned pack. suppose you define VAR1 as "VAR1 DC
X'01'". It will occupy 1 byte in the memory and stored as:
0 in the zoned nibble and 1 in the numeric nibble.

P denotes the packed data type, similar to COMP-3 in COBOL.
if you declare any variable with this data type then it
must have a sign byte at last nibble. See following example:
VAR2 DC P'1'
it will occupy one byte in the memory and stored as '1C'.

8 :: Why do we use "drop"? What does "using" do?

neither DROP nor USING affect the register contents.
Once a register has been loaded with the address of a piece
of storage, the using statement can be used to 'map' that
storage against a set of labels defining the layout of that
storage e.g. a DSECT. Then whenever one of those labels is
referenced in the code, in moves etc, the assembler resolves
the relative address as a particular displacement from the
absolute address in the register. The DROP instruction
removes the relationship between the labels and the register
and renders subsequent references to those labels as
unresolvable, giving rise to errors at assembly (compile)time.
Typically the DROP instruction will be used to allow use of
the register for another purpose, e.g. address a different
bit of storage via a using staement on second DSECT without
the risk of corrupting that data via moves referencing the
original DSECT.

9 :: How to initialize a register to 0000?

XR Rx,Rx

This is the best way and most efficient way of initializing
the register values or Label values to '0'.

Its because the time required to execute a Logical
Instruction is always less than the Arithmetic Instructions.

e.g SR Rx,Rx consumes more execution time than XR Rx,Rx.

So XR Rx,Rx is a better way to do obtain our target.

10 :: 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

House keeping is used to store the contents of the base
register from one register to another for using that
register.

These are house keeping instructions where contents of the
registers are stored
1. content of the register 15 is stored in the register 12
2. address in reg 12 is mapped to the module type
3. save area is stored in the register 13
Download IBM Assembler PDF Read All 27 IBM Assembler Questions