Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

Addressablility question in assmbler

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

Active User


Joined: 09 Jun 2014
Posts: 106
Location: windsor

PostPosted: Mon May 11, 2015 8:21 pm    Post subject: Addressablility question in assmbler
Reply with quote

Hi ,

When i read the book the format to establish the addressability is using following code :

Code:
BALR 12,0
USING *,12


And book siad BALR is used to actually write the address into R12 at run time. But when i read the following exit code , i got two questions.
1. In this code , it not use BALR ,how to put address in R12 at run time ?
2. Why it use two USING here ? get two different address for base address? why?

Code:
                EJECT                                                         
TMSXITC  CSECT ,                                                       
TMSXITC  AMODE 31                                                     
TMSXITC  RMODE ANY                                                     
         TMMLINK ENTRY,BASE=(R12),EQUS=YES,                           
                        DATA=WORKAREA,                                         
                        SYSMOD=CAL0C60                                   CAL0C60
                EJECT                                                         
                SPACE 2                                                       
                LR          R8,R1                       PARAMETER LIST                       
                USING    UX0CPARM,R8          ADDRESSABILITY                       
                LM         R9,R11,UX0CPARM    LOAD ALL PARAMETERS                 
                USING   TMRECST,R10            ADDRESSABILITY                       
                LTR        R11,R11                   Q. IS THIS A MULTI-VOLUME           
                BNZ       MULTIVOL              A. YES, COPY ONLY CERTAIN ELDS     



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

Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7241

PostPosted: Mon May 11, 2015 8:29 pm    Post subject: Reply to: Addressablility question in assmbler
Reply with quote

Since it is a run-time thing, it does not matter how the correct address is stored where it is needed, just that it is.

For the "why two USINGs" you should explore the difference between USING *,.. and USING somename,...

You also need to know exactly what BALR x,0 actually does. You'll see lots of other use of BALR that are nothing to do with this specific, conventional, use.
Back to top
View user's profile Send private message
jackzhang75

Active User


Joined: 09 Jun 2014
Posts: 106
Location: windsor

PostPosted: Mon May 11, 2015 8:51 pm    Post subject:
Reply with quote

Hi Bill,

Thanks for your asnwer. as you siad "Since it is a run-time thing, it does not matter how the correct address is stored where it is needed, just that it is."

Why it does matter the correct address is used otherwise it cant find where is the program ?
Back to top
View user's profile Send private message
Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7241

PostPosted: Mon May 11, 2015 8:55 pm    Post subject: Reply to: Addressablility question in assmbler
Reply with quote

Yes, if you use an incorrect address, naturally you won't be using the correct data (except in very rare coincidences).
Back to top
View user's profile Send private message
steve-myers

Active User


Joined: 30 Nov 2013
Posts: 462
Location: The Universe

PostPosted: Mon May 11, 2015 10:07 pm    Post subject:
Reply with quote

Actually, there are at least 3 base registers -

R12, established by the TMMLINK macro, to provide addressability for the exit. The address in R12 is established by the TMMLINK macro. There are - usually - two ways to initialize a base register for a program.
  1. Use the module's address. The convention in all operating systems derived from OS/360 is that register 15 contains the address of the module when it is entered, so you see something like this -
    Code:
    AMODULE  CSECT
             USING *,R12
             SAVE  (14,12),,*
             LR    R12,R15
             ...
    Some expansions of the SAVE macro, by the way, and including the one used here, assume register 15 contains the address of the first instruction of the SAVE macro.
  2. If you are unwilling to trust the common rule, you store the address yourself -
    Code:
    AMODULE  CSECT
             SAVE  (14,12),,*
             BALR  R12,0
             USING *,R12
You can determine the convention used by TMMLINK by reviewing its expansion

R8, to provide addressability to the parameter list built by the exit's caller. In turn, the data in R8 was copied from R1. At a guess the module that called TMSXITC stored the address in R1.

R10, to provide addressability to a data area defined by the TMRECST DSECT. Its address is in the parameter list.
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 Fault Analyzer - listings question. egrove IBM Tools 4 Thu Aug 11, 2016 5:31 pm
No new posts dataset copy question - REPRO or some... atulxp TSO/ISPF 2 Wed Aug 03, 2016 10:56 pm
No new posts SQL Order By related question Joseph K Thomas DB2 8 Fri Mar 18, 2016 12:53 pm
No new posts DFSort Question krrp DFSORT/ICETOOL 9 Mon Mar 07, 2016 7:11 pm
No new posts Question: REORG on LOB tablespaces rakesh1155 DB2 1 Fri Aug 14, 2015 2:14 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us