Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Profile Log in to check your private messages Log in
 
Important questions in Assembler

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> PL/I & Assembler
View previous topic :: :: View next topic  
Author Message
alokagarwaljgd

New User


Joined: 02 Jun 2006
Posts: 28

PostPosted: Sun Nov 18, 2007 4:56 pm    Post subject: Important questions in Assembler
Reply with quote

Hi,

I have got some questions on Assembler, whose answers were difficult to find in books. Can any body help me with them?

1) When any instruction is executed in Assembler, it sets a condition code, where is this condition code stored or where we can see its value?

2) How many bytes are required to store the condition code?

3) How to increment/decrement a value in a register without using A,AR,S and SR instruction?

4) DSECT is equivalent to LINKAGE SECTION in cobol. In assembler program, we can have many DSECTs but in COBOL we have only one LINKAGE SECTION, then how do we achieve the equivalent code of multiple DSECTS of Assembler in COBOL?

5) If I want to make register 11 and 12 as my base register, how can I do this apart from using "BALR and USING" directive, is there anything else I need to take care of?

6) If a variable is 500 bytes long and I want to pass some 50 or 100 bytes to it during runtime, how can we do it?

7) what is Entrant/Entry point in Assembler?

8) How do we attain the equivalent functionality as of DISPLAY of COBOL in Assembler?

Alok
Back to top
View user's profile Send private message

enrico-sorichetti

Global Moderator


Joined: 14 Mar 2007
Posts: 10308
Location: italy

PostPosted: Sun Nov 18, 2007 6:04 pm    Post subject:
Reply with quote

from the principles of operations
( THE BIBLE FOR ASSEMBLER PROGRAMMING)


1/2 )
after any instruction setting the condition code the same is stored in the PSW

Quote:
Condition Code (CC): Bits 18 and 19 are the
two bits of the condition code. The condition code
is set to 0, 1, 2, or 3, depending on the result
obtained in executing certain instructions. Most
arithmetic and logical operations, as well as some
other operations, set the condition code.

to retrieve it
Quote:

INSERT PROGRAM MASK
The condition code and program mask from the
current PSW are inserted into bit positions 34 and
35 and 36-39, respectively, of general register R.
Bits 32 and 33 of the register are set to zeros; bits
0-31 and 40-63 are left unchanged.
Condition Code: The code remains unchanged.
Program Exceptions: None.


Used only in very SOPHISTICATED programming style were the test must
be delayed ( for example when doing some register usage optimization)
Back to top
View user's profile Send private message
enrico-sorichetti

Global Moderator


Joined: 14 Mar 2007
Posts: 10308
Location: italy

PostPosted: Sun Nov 18, 2007 6:21 pm    Post subject: Reply to: Important questions in Assembler
Reply with quote

Quote:

3) How to increment/decrement a value in a register without using A,AR,S and SR instruction?

4) DSECT is equivalent to LINKAGE SECTION in cobol. In assembler program, we can have many DSECTs but in COBOL we have only one LINKAGE SECTION, then how do we achieve the equivalent code of multiple DSECTS of Assembler in COBOL?

5) If I want to make register 11 and 12 as my base register, how can I do this apart from using "BALR and USING" directive, is there anything else I need to take care of?

7) what is Entrant/Entry point in Assembler?


3) look at the prociples of operations, and You will find a few alternatives,
( the add logical family )
what other instruction type would You propose ???

there is also the "LA" instructions ( not for beginners),
it has many gotcha's due to addressing mode setting

4) NOPE ...
a dsect might roughly be compared to a redefine
( but much more dynamic )..
there is no concept of automatic "LINKAGE SECTION"
all the checking for the right alignment is the programmers responsibility

5) BALR is an instruction... USING is a directive
to define a register as a base only the USING is necessary,
You might load the register at entry in any way You find useful

7) ENTRY is the right term...
like the name says it defines the label of the first instruction to be executed in the program/subroutine

note...note...
there is no difference as far as calling and register setup
between a main program and a subroutine ( as in cobol terminology )
a well behaved program expects/provides this register content

at entry
reg 14 the return address
reg 15 the first instruction address
reg 13 the address of a register save area

at exit
reg 14 the return address
reg 15 the return code
Back to top
View user's profile Send private message
enrico-sorichetti

Global Moderator


Joined: 14 Mar 2007
Posts: 10308
Location: italy

PostPosted: Sun Nov 18, 2007 6:50 pm    Post subject: Reply to: Important questions in Assembler
Reply with quote

Quote:
3) How to increment/decrement a value in a register without using A,AR,S and SR instruction?


dumb of me.... I had forgotten the..

BRANCH ON COUNT class instructions

BRANCH ON INDEX class instruction...

but here we might debate whether incrementing/decrementing the registers
are principal/side effects ??
Back to top
View user's profile Send private message
CICS Guy

Senior Member


Joined: 18 Jul 2007
Posts: 2150
Location: At my coffee table

PostPosted: Mon Nov 19, 2007 12:41 am    Post subject: Re: Important questions in Assembler
Reply with quote

alokagarwaljgd wrote:
3) How to increment/decrement a value in a register without using A,AR,S and SR instruction?
BCTR is another.
Quote:
4) DSECT is equivalent to LINKAGE SECTION in cobol. In assembler program, we can have many DSECTs but in COBOL we have only one LINKAGE SECTION, then how do we achieve the equivalent code of multiple DSECTS of Assembler in COBOL?
In COBOL the equivalent to DSECTs is actually each 01 level in the LINKAGE SECTION.
Quote:
6) If a variable is 500 bytes long and I want to pass some 50 or 100 bytes to it during runtime, how can we do it?
I'm not sure what you are asking.
Quote:
8) How do we attain the equivalent functionality as of DISPLAY of COBOL in Assembler?
IIRC, not easily, but it is a wheel that has been invented many times, there are probably many macro versions laying about.....
Back to top
View user's profile Send private message
alokagarwaljgd

New User


Joined: 02 Jun 2006
Posts: 28

PostPosted: Mon Nov 19, 2007 12:11 pm    Post subject:
Reply with quote

Hi Enrico/CICS Guy,

Thanks for your reply but still there are a couple of things which are not clear to me as follows:

1) "there is no concept of automatic "LINKAGE SECTION"
all the checking for the right alignment is the programmers responsibility "

Can you please explain what you meant by above and how do we attain multiple DSECTS code in COBOL with an example?

2) "You might load the register at entry in any way You find useful " is ok, but is there any other way of making register 11 and 12 as my base register without using "USING" directive ?

3) "IIRC, not easily, but it is a wheel that has been invented many times, there are probably many macro versions laying about....."

Can you please give me an easy example or the equivalent code for types of display statements of COBOL in Assembler?

Thanks,
Alok
Back to top
View user's profile Send private message
UmeySan

Active Member


Joined: 22 Aug 2006
Posts: 757
Location: Germany

PostPosted: Mon Nov 19, 2007 1:45 pm    Post subject:
Reply with quote

Hi alokagarwaljgd !

For doing some displays i would prefere the WTO command.

Cobol:
Move Text to DisplLine
Display DisplLine upon Console

Asembler
MVC WT05+08(nn),TextString

WT05 WTO ' ',ROUTECODE=xxx

Have a look at the manual for further informations.

Regards, Umeysan
Back to top
View user's profile Send private message
enrico-sorichetti

Global Moderator


Joined: 14 Mar 2007
Posts: 10308
Location: italy

PostPosted: Mon Nov 19, 2007 1:59 pm    Post subject: Reply to: Important questions in Assembler
Reply with quote

all the virtual/real storage addressing as per principle of operations
is in the form base and displacement ( see the instruction layout )

the base and diplacement are taken from the current using directive for the variable

lets make an example

Code:
someds dsect ... not to reseve any storage
var1      ds cl8
var2      ds cl8


after the directive ..
Code:
 USING var1,4

Quote:
var1 will be addressed as 4,0
var2 will be addressed as 4,7


but after the directive
Code:
USING  var2,5

Quote:
var2 will be addressed as 5,0


sorry but I cannot advise about cobol..
I JUST REFUSE TO USE IT

as far as point 2 the answer is NO... at least as program addressing is concerned..
unless You explicitly code for any instruction the base register and the displacement :-)
Back to top
View user's profile Send private message
sankargn

New User


Joined: 27 May 2006
Posts: 5

PostPosted: Wed Nov 21, 2007 8:04 pm    Post subject: Reply to: Important questions in Assembler
Reply with quote

Hi,

Here is the answer for your 5th ?. The ? is


5) If I want to make register 11 and 12 as my base register, how can I do this apart from using "BALR and USING" directive, is there anything else I need to take care of?

Ans:-


PGM1 CSECT 00010000
STM R14,R12,12(R13) STORE MULTIPLE FROM R14,R12
LR R12,R15 LOAD ENTRY POINT(R15) TO R12
USING PGM1,R12
ST R13,SAVEAREA+4 STORE CALLER SAREA IN OUR S.AREA
LR R4,R13 MOVE R13 TO R4
LA R13,SAVEAREA LOAD ADDR OF S.AREA TO R13
ST R13,8(R4) STORE R13 IN THEIR SAVE AREA

then add R11 as your second base register. I hope you know that.
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> PL/I & Assembler All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Sr SW Eng-Rocket Software (Assembler,... Kenneth Barton Lasky Mainframe Jobs 0 Fri Aug 25, 2017 12:29 am
No new posts Dump analysis of an assembler module monica1 PL/I & Assembler 4 Tue May 09, 2017 10:05 am
No new posts Mainframe Interview Questions CICS,CO... akshathan Mainframe Interview Questions 6 Thu Feb 09, 2017 6:38 pm
No new posts A not very Christmassy PL/I tale, wit... prino PL/I & Assembler 3 Mon Dec 26, 2016 1:01 am
No new posts Viewing executing process in NDM .. q... Debb.Brant IBM Tools 0 Wed Dec 14, 2016 10:55 pm

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us