Home > Archive > ASM370 > April 2005 > GETMAIN - FREEMAIN
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
GETMAIN - FREEMAIN
|
|
| rbwine 2004-04-02, 9:31 am |
| If I do a GETMAIN, move the value of R1 into another register and use
this second register as a base register to establish addressability to
my GETMAINed area, is it necessary to issue a DROP on that register
before using it again to FREEMAIN the same area?
| |
| Peter H. 2004-04-02, 12:30 pm |
| [color=darkred]
If I do a GETMAIN, move the value of R1 into another register and use this
second register as a base register to establish addressability to my GETMAINed
area, is it necessary to issue a DROP on that register before using it again to
FREEMAIN the same area?[color=darkred]
Never necessary. But, good practice.
Another possbility ...
GETMAIN LV=length
PUSH USING
LR 11,1
USING WKAREA,11
....
LR 1,11
POP USING (implicitly DROPs 11)
FREEMAIN LV=length,A=(1)
However, the macros actually have no knowledge of the USING on 11, anyway.
| |
| Binyamin Dissen 2004-04-03, 2:30 pm |
| On 2 Apr 2004 05:54:10 -0800 rbrandywine@yahoo.com (rbwine) wrote:
:>If I do a GETMAIN, move the value of R1 into another register and use
:>this second register as a base register to establish addressability to
:>my GETMAINed area, is it necessary to issue a DROP on that register
:>before using it again to FREEMAIN the same area?
First of all:
GETMAIN, FREEMAIN - generate executable instructions.
USING, DROP - tells the assembler how (not) to address storage, but does not
generate any executable instructions.
It is considered proper to DROP a register when it no longer addresses the
specific storage so that the assembler will tell you if you attempt to use the
no longer addressed area, but it is not required.
The DROP can be issued interchangeably before or after the FREEMAIN. It does
not matter.
If this does not answer your question, feel free to post a code fragment that
clarifies your question.
--
Binyamin Dissen <bdissen@dissensoftware.com>
http://www.dissensoftware.com
Director, Dissen Software, Bar & Grill - Israel
| |
| RFCOMMSYS 2004-04-03, 3:30 pm |
| rbrandywine@yahoo.com wrote:
>
>
>If I do a GETMAIN, move the value of R1 into another register and use
>this second register as a base register to establish addressability to
>my GETMAINed area, is it necessary to issue a DROP on that register
>before using it again to FREEMAIN the same area?
>
>
It would make sense to DROP it immediately AFTER the FREEMAIN, because your
area no longer exists after the FREEMAIN.
i.e.,
GETMAIN
LR R5,R1
USING DSECT,R5
| |
| rbwine 2004-04-05, 11:34 am |
| Good answers, thanks!
| |
| David de Jongh 2004-04-23, 9:33 pm |
| Bear in mind that USING and DROP are relative to the sequence in which the
program is WRITTEN. GETMAIN and FREEMAIN happen according to the order of
program EXECUTION.
So, if you code:
BAL Rn,GETMAIN_ROUTINE
MVC GOTTEN_AREA,VALUE_1
...
BAL Rn,FREEMAIN_ROUTINE
...
GETMAIN_ROUTINE EQU *
GETMAIN ...
LR Rx,R1
USING GOTTTEN_AREA,Rx
BR Rn
FREEMAIN_ROUTINE EQU *
FREEMAIN ...
DROP Rx
BR Rn
...
GOTTTEN_AREA DSECT
...
It won't do you any good, because the MVC instruction is outside the USING
range. You need USING and DROP before and after the instructions that
actually reference the symbols you are mapping with the USING statement.
| |
| rbwine 2004-04-27, 12:03 pm |
| That's a good point that I hadn't given any thought about.
Thanks,
R
| |
|
| hi,
can u tell me when to use the getmain?
I know it can get the virtual storage.
but I do not know when to use it
a program have "LINK" MACRO need to use getmain?
or a "CALL" MACRO? or?
Thanks. |
|
|
|
|