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
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
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
/*
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.
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.
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
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'.
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.
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.
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
What is base register?
A base register is any general purpose register chosen by
programmer. It is assigned at the beginning of the program
as part of housekeeping with the USING assembler keyword,
and it's purpose is to maintain addressibility within a
page (4k) of code or data.
Why can only 256 bytes be moved from one address to another in a MVC?
Lenght feild is 8 bits so the data is stored in binary
format so if we have all 8 bits set to 1 then the length
will be 128+64+32+16+8+4+2+1 = 255.or
2^7+ 2^6+2^5...2^0 = 255.
so the lenght is 256 .
How are data passed from JCL parm to assembler program. And how is data passed from a calling program to an assembler called program?
By convention, general purpose register 1 will have the
address of the parameter list. The list will be a list of
pointers (addresses) to individual parameters. The CALL
macro does this, but you can bypass the CALL macro and be
creative on how you set up the parameter list. Don't forget
the parameter must be on a fullword boundary.
What is the use of TRT instruction and how it is working?
for example we want to test if given variable is numeric we can do it by following code.
We can define a table with all FF execpt from 0 t0 9 00
Table1 DC 256c'ff'
org table1
dc 10c'00'
Now we can give
TRT var1,table1
BZ numeric
What is need of START 0? In steed of can we use anyother numerics? if we use what will happen?
START is an assembler directive which has an optional
operand, (0 in your example). This operand acts as the
starting address of the program e.g. PROGNAME START X'3E0'
tells the linkage editor that this program is to be loaded
into main storage at address '3E0' in hex. This explanation
answers all your questions.
How do you round the addition or subtraction of two numbers in assembler?
What does the following code do?
AP WKUR,=P5 where WKUR is a label?
This is a vague two-part question.
1) You can round by adding .5
2) Adds 5 to WKUR, but it had better be a valid packed field, and not just a label.
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?
There are 16 registers, and ALL can be used as a base EXCEPT
for register 0, so the answer is AT LEAST 15. AT LEAST is
specified here because in any section of code, you can
"re-use" a previous base register once you are no longer
within the original address range ("scope") of that
particular base register. By re-using the registers, you can
have base registers that will cover ALL of the memory in the
machine - but not all at once - you have to "bite off" 15
base reg-at-a-time chunks of memory (all addressable memory
does not have to be contiguous - it can be scattered around
memory in 4K pieces).
How to pass instream data in sysin with Assembler?
You will need to open de file SYSIN via a DCB and read the
data via GET commands. The data in the PARM field is passed
via register 1. Any dataset you want to use in Assembler
you will need to open. There are no automatic allocation.
Can we use MVC instruction to move pack field to pack field. which instruction you will use and
why?
We can certainly use the MVC instruction to move the pack data to another pack field.
How to initialize 20,000 bytes in the Assembler?
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
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)?
As this is mainframe assembler section, this is a trick
question - there is no JMPNZ opcode for mainframe (recently
added JNZ with relative addressing in the z/800 and later,
but no JMPNZ) and the mainframe has no RET instruction
(there is a PR to return from a cross address space or PC
"call" statement) and the mainframe has no accumulator, ADB
opcode, or B register.
What is the difference between various read and find statement,and which one should be used when for better adabas performance?
There are two possible scenarios:
1) This is a classroom quesiton where you are expected to
do some research on your own, and not ask someone in the
cloud for the exact answer.
2) The question is too vague, and would require a full
essay to answer. Please be more specific.
Registers(0-15) ,where they are going be resides does that mean here is it resides whether real or virtual memory? and why? then why we are assign even registers(0 to 6) for FP operations?
Registers are part of the CPU logic and should not be
confused with memory real or virtual. The question is
about as sensical as asking where the uterus resides in a
man. Also, general purpose registers 0--16 are an
entirely different breed that the floating point
registers. As for the numbering, a decision made by the
manufacturer's design people.
How to produce SOC7 abend?
S0C7 occurs when the data exception occurs.They are many
ways to produce S0C7
1)Move non numeric data to a numeric feild
2)compare junk data with a numeric feild
3) Use a non numeric data in COMPUTE statement
4) Refer to the occurence in a table beyond the occurs time
with SSRANGE not checked in complier options
How to access VSAm file?
VSAM file can be accessed through an Assembler application
program by using assembler macros RPL, ACB
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) If there is any updates in the Macros regarding the
structure change or addition/removal of byte, then you need
to Promote the macro to Live first.
2) Reassemble your codes against the Live Macros.
3) Raise ELAS for the Codes to go to production.
4)Promote the codes to production.
Explain about maximum displacement and how to cross this limit?
maximum displacement is 4k i.e 4096 bytes.
if we need to add more than 4096 bytes another base register.
Tags: IBM Assembler Most Common Interview Questions Answers IBM Assembler Explain ICM instruction IBM Assembler Most Common Interview Questions.
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
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
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
/*
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.
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.
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
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'.
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.
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.
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
What is base register?
A base register is any general purpose register chosen by
programmer. It is assigned at the beginning of the program
as part of housekeeping with the USING assembler keyword,
and it's purpose is to maintain addressibility within a
page (4k) of code or data.
Why can only 256 bytes be moved from one address to another in a MVC?
Lenght feild is 8 bits so the data is stored in binary
format so if we have all 8 bits set to 1 then the length
will be 128+64+32+16+8+4+2+1 = 255.or
2^7+ 2^6+2^5...2^0 = 255.
so the lenght is 256 .
How are data passed from JCL parm to assembler program. And how is data passed from a calling program to an assembler called program?
By convention, general purpose register 1 will have the
address of the parameter list. The list will be a list of
pointers (addresses) to individual parameters. The CALL
macro does this, but you can bypass the CALL macro and be
creative on how you set up the parameter list. Don't forget
the parameter must be on a fullword boundary.
What is the use of TRT instruction and how it is working?
for example we want to test if given variable is numeric we can do it by following code.
We can define a table with all FF execpt from 0 t0 9 00
Table1 DC 256c'ff'
org table1
dc 10c'00'
Now we can give
TRT var1,table1
BZ numeric
What is need of START 0? In steed of can we use anyother numerics? if we use what will happen?
START is an assembler directive which has an optional
operand, (0 in your example). This operand acts as the
starting address of the program e.g. PROGNAME START X'3E0'
tells the linkage editor that this program is to be loaded
into main storage at address '3E0' in hex. This explanation
answers all your questions.
How do you round the addition or subtraction of two numbers in assembler?
What does the following code do?
AP WKUR,=P5 where WKUR is a label?
This is a vague two-part question.
1) You can round by adding .5
2) Adds 5 to WKUR, but it had better be a valid packed field, and not just a label.
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?
There are 16 registers, and ALL can be used as a base EXCEPT
for register 0, so the answer is AT LEAST 15. AT LEAST is
specified here because in any section of code, you can
"re-use" a previous base register once you are no longer
within the original address range ("scope") of that
particular base register. By re-using the registers, you can
have base registers that will cover ALL of the memory in the
machine - but not all at once - you have to "bite off" 15
base reg-at-a-time chunks of memory (all addressable memory
does not have to be contiguous - it can be scattered around
memory in 4K pieces).
How to pass instream data in sysin with Assembler?
You will need to open de file SYSIN via a DCB and read the
data via GET commands. The data in the PARM field is passed
via register 1. Any dataset you want to use in Assembler
you will need to open. There are no automatic allocation.
Can we use MVC instruction to move pack field to pack field. which instruction you will use and
why?
We can certainly use the MVC instruction to move the pack data to another pack field.
How to initialize 20,000 bytes in the Assembler?
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
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)?
As this is mainframe assembler section, this is a trick
question - there is no JMPNZ opcode for mainframe (recently
added JNZ with relative addressing in the z/800 and later,
but no JMPNZ) and the mainframe has no RET instruction
(there is a PR to return from a cross address space or PC
"call" statement) and the mainframe has no accumulator, ADB
opcode, or B register.
What is the difference between various read and find statement,and which one should be used when for better adabas performance?
There are two possible scenarios:
1) This is a classroom quesiton where you are expected to
do some research on your own, and not ask someone in the
cloud for the exact answer.
2) The question is too vague, and would require a full
essay to answer. Please be more specific.
Registers(0-15) ,where they are going be resides does that mean here is it resides whether real or virtual memory? and why? then why we are assign even registers(0 to 6) for FP operations?
Registers are part of the CPU logic and should not be
confused with memory real or virtual. The question is
about as sensical as asking where the uterus resides in a
man. Also, general purpose registers 0--16 are an
entirely different breed that the floating point
registers. As for the numbering, a decision made by the
manufacturer's design people.
How to produce SOC7 abend?
S0C7 occurs when the data exception occurs.They are many
ways to produce S0C7
1)Move non numeric data to a numeric feild
2)compare junk data with a numeric feild
3) Use a non numeric data in COMPUTE statement
4) Refer to the occurence in a table beyond the occurs time
with SSRANGE not checked in complier options
How to access VSAm file?
VSAM file can be accessed through an Assembler application
program by using assembler macros RPL, ACB
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) If there is any updates in the Macros regarding the
structure change or addition/removal of byte, then you need
to Promote the macro to Live first.
2) Reassemble your codes against the Live Macros.
3) Raise ELAS for the Codes to go to production.
4)Promote the codes to production.
Explain about maximum displacement and how to cross this limit?
maximum displacement is 4k i.e 4096 bytes.
if we need to add more than 4096 bytes another base register.