0% found this document useful (0 votes)
37 views6 pages

Amode and Rmode

Uploaded by

NishantSharma
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
37 views6 pages

Amode and Rmode

Uploaded by

NishantSharma
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 6

Run-time Considerations

This chapter provides information about various aspects of the run-time behaviour of Assembler
programs.

2.1 Memory Requirements

On the mainframe, an area of memory can be located either below the line or above the line. The
term 'the line' means the point at which the address of an area of memory requires four bytes to
hold it. Three-byte addresses can point to memory up to 16Mb. Any area of memory starting at a
higher point than this requires a four-byte address. Four-byte addresses are actually 31-bit
addresses, since bit 0 is used for other purposes. A 31-bit address can point to memory up to 2Gb.

The memory requirements of an Assembler program are indicated by its AMODE (or addressing
mode) and RMODE (or residency mode). AMODE governs the type of addresses the program uses,
while RMODE indicates where the program must be located when it is loaded for execution.

There are two AMODE values:

 AMODE(24) indicates 24-bit (three-byte) addressing - memory below the line

 AMODE(31) indicates 31-bit addressing - memory above and below the line.

You can set AMODE to 24 or 31 in Mainframe Express, since it emulates both types of addressing by
mapping mainframe-style above and below the line addresses to real 32-bit PC memory addresses.
An AMODE (24) program can only access memory below the line, while an AMODE(31) program can
access memory both below and above the line.

There are two RMODE values:

 RMODE(24) indicates that the program must be loaded into memory below the line

 RMODE(31) indicates that the program can be loaded either below or above the line.

2.1.1 Reserving Memory for Execution

When the Assembler Option run-time system is initialized, it allocates an area of memory called the
system queue area to the executable program. You can specify how much of this memory is below
the line and how much is above the line. The main executable program and any other executables
that it loads are loaded into memory below or above the line depending on the program's RMODE
settings. When a program issues requests for extra memory using the macros GETMAIN or STORAGE
OBTAIN, it can specify whether the memory needs to come from the below-the-line allocation or the
above-the-line allocation, depending on its addressing needs.

2.1.2 How to Specify Your Memory Requirements

Getting access to the type of memory you require involves several steps. You must:

1. Specify how much memory the program needs below the line and above the line, using
the Max. memory below 16Mb line and Max. memory above 16Mb line fields. You can find
these fields on the Assembler page of the Execution page of the Project Settings dialog box.

2. Specify the addressing mode of the program and of any programs that the main program
calls, using the Addressing mode field. Addressing mode appears in two places:
o On the Link page of the Assembler page in the Build Settings for Project dialog box
or the Build Settings for filename dialog box. Set addressing mode here for each
Assembler program that does not need a separate link file to control the production
of an executable code file.

o On the General page of the Linker page in the Build Settings for Project dialog box or
the Build Settings for filename dialog box. Set addressing mode here for each
Assembler program that does need a separate link file to control the production of
an executable code file.

3. Ensure that all your GETMAIN or STORAGE OBTAIN macro calls indicate which type of
memory is required.

The following sections cover most possibilities.

2.1.2.1 Program Only Uses Memory Below the Line

If your program only needs to address memory below the line, you should:

1. Set Max. memory below 16Mb line to the maximum amount of memory below the line that
your program requires. The default is 3Mb and the maximum is 16Mb.

2. Set Addressing mode to AMODE(24) for the main program and for each program that the
main program loads.

3. Omit the LOC parameter from all GETMAIN or STORAGE OBTAIN macros issued by your
program.

2.1.2.2 Program Only Uses Memory Above the Line

If your program needs to address memory above the line, you should:

1. Set Max. memory above 16Mb line to the maximum amount of memory above the line that
your program requires. The default is 3Mb and the maximum is 2Gb.

2. Set Addressing mode to AMODE(31) for the main program and for each program that the
main program loads.

3. Set LOC=ANY in all GETMAIN and STORAGE OBTAIN macros issued by your program.

2.1.2.3 Program Uses Memory Below and Above the Line

If your program needs to address both types of memory, that is, you have a mix of some modules
that use memory below the line and others that use memory above the line, you should:

1. Set Max. memory below 16Mb line to the maximum amount of memory below the line that
your program requires. The default is 3Mb and the maximum is 16Mb.

2. Set Max. memory above 16Mb line to the maximum amount of memory above the line that
your program requires. The default is 3Mb and the maximum is 2Gb.

3. Set Addressing mode to AMODE (24) for each program to be loaded that uses memory
below the line.

4. Set Addressing mode to AMODE (31) for each program to be loaded that uses memory
above the line.
5. To allocate memory below the line, omit the LOC parameter from all GETMAIN and
STORAGE OBTAIN macros that the module issues.

6. To allocate memory above the line, set LOC=ANY in all GETMAIN and STORAGE OBTAIN
macros that the module issues.

7. Use the Assembler instructions BASSM or BSM to transfer control between programs that
use different addressing modes.

Notes:

 If a program that uses 31-bit addressing needs to manipulate 24-bit addresses, you must
include code to clear the unused byte of the address before any instruction that sets a
register to a new address. These instructions include LA, BAL, BALR, EDMK and TRT.

 You can only set LOC=ANY on the RU and RC formats of the GETMAIN macro. The R format
of GETMAIN is restricted to memory below the line.

2.1.3 Setting Residency Mode

You specify the residency mode of a program and of any programs that the main program calls using
the Residency mode field. Residency mode appears in two places:

 On the Link page of the Assembler page in the Build Settings for Project dialog box or the
Build Settings for filename dialog box. Set residency mode here for each Assembler program
that does not need a separate link file to control the production of an executable code file.

 On the Advanced page of the Linker page in the Build Settings for Project dialog box or the
Build Settings for filename dialog box. Set residency mode here for each Assembler program
that does need a separate link file to control the production of an executable code file

The valid combinations of AMODE and RMODE are:

 AMODE(24) and RMODE(24)

 AMODE(31) and RMODE(31)

 AMODE(31) and RMODE(24): use this combination where the Assembler program contains
24-bit address constants but needs to be executed in 31-bit addressing mode so that it can
handle 31-bit addresses passed as parameters by calling COBOL programs.

Note:

If you set AMODE to 31 and RMODE to 31, but the Assembler module contains 24-bit addresses, the
Linker overrides your RMODE setting and loads the module below the line, and displays a warning
message.

2.1.4 Using Subpools


You can use subpools to help manage your memory requirements in just the same way as you do on
the mainframe. A subpool is a logical grouping of memory allocations that can be de-allocated with a
single FREEMAIN or STORAGE RELEASE macro statement. Subpools are available for memory both
above and below the line.

You create a subpool simply by including the SP parameter in a GETMAIN or STORAGE OBTAIN
macro statement. Valid subpool numbers are 0 through to 127, 131 and 132. If you omit the SP
parameter from your GETMAIN and STORAGE OBTAIN macro statements, all memory is allocated in
subpool 0, unless you specify the NONCAN Linker directive, in which case all memory is allocated in
subpool 132.

2.2 Macros and SVCs

Assembler Option supports a number of macros and SVCs (supervisor calls). Those that are
supported are compatible with the equivalent macros and SVCs on the mainframe, so you shouldn't
need to alter your code just for the PC environment. However, some macro-options may not be
supported. This means that they will compile, but will not have any effect when executed. There are
also some macros which are supported in stub form, that is, macro code exists but it simply returns
control to the calling program. These stubs are provided for macros that perform tasks that have no
meaning on the PC. An example stub macro is provided in \mfe\mfasm\include\stub.mac; you can
use this to create your own stub macros.

The online help contains full specifications of all the macros and SVCs supported; click Help
Topics on the Mainframe Express Help menu, then on the Contents tab click Reference, Assembler
Option, Macro Instructions or Supervisor Services.

There are two categories of macro:

 Assembler services macros. These provide services for interfacing with the Assembler Option
run-time system, managing memory, calling other programs and for general functions such
as saving and restoring registers. There are also services for accessing the catalog and for
dynamically allocating and deallocating data sets at execution time.

 File handling macros. These provide access to files. There is more information about these
macros in the chapter File Handling.

Many Assembler services macros equate to SVCs. You can choose whether to code the macro or its
equivalent SVC, but in general it is easier to use the macros. The following table relates the SVCs and
service macros:

SVC Macro Description

4 GETMAIN L LC LU E EC Get memory (list, element and variable requests).


EU, VC, VU

5 FREEMAIN L LC LU E EC Free memory (list, element and variable requests).


EU, VC, VU

6 LINK Link to another Assembler program.

8 LOAD Load another Assembler program or a COBOL program.

9 DELETE Delete a loaded module.


10 GETMAIN R Get memory (R type register requests).

11 TIME Get the time of day and the date.

13 ABEND Terminate the program and open the Assembler debugger if


possible, or display information about the state of the program
when the abend occurred.

14 SPIE Handle a program exception within the executing module.

26 CATALOG and LOCATE Uncatalog a data set; return a volume list for a data set.

29 SCRATCH Delete a data set.

35 WTO Display a message on the screen.


WTOR Display a message on the screen and wait for a reply.

39 LINKC2 Link to a COBOL program.

41 IDENTIFY Associate a name you specify with an already loaded program.

62 Remove the executing program. There is no corresponding


macro.

99 DYNALLOC Allocate or deallocate a resource at execution time.

103 XLATE Convert between ANSI and EBCDIC.

120 GETMAIN RU, RC, VRC, Get memory (RU and RC type register requests)
VRU;
FREEMAIN R, RU, RC, VRC Free memory (all types of register requests).
and VRU;
STORAGE Get memory or free memory

CALL Transfer control to a statically linked module. There is no


corresponding SVC.

CAMLST Create parameter list for CATALOG, LOCATE or SCRATCH. There


is no corresponding SVC.

DEQ Relinquish control of one or more serially reusable resources.


There is no corresponding SVC.

ENQ Request control of one or more serially reusable resources.


There is no corresponding SVC.

EXTRACT Obtain information from control block. There is no


corresponding SVC.

RETURN Restore registers and sets the address to return to. There is no
corresponding SVC.

SAVE Save registers. There is no corresponding SVC.

SPLEVEL Test or set the level of MVS macro compatibility. There is no


corresponding SVC.

WAIT Wait for event completion. There is no corresponding SVC.

Copyright © 2001 Micro Focus International Limited. All rights reserved.


This document and the proprietary marks and names used herein are protected by international law.

You might also like