Compiling and Linking Assembler Modules | File Handling |
This chapter provides information about various aspects of the run-time behavior of Assembler programs.
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:
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:
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.
Getting access to the type of memory you require involves several steps. You must:
The following sections cover most possibilities.
If your program only needs to address memory below the line, you should:
If your program needs to address memory above the line, you should:
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:
Notes:
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:
The valid combinations of AMODE and RMODE are:
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.
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 link directive, in which case all memory is allocated in subpool 132.
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:
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 EU, VC, VU | Get memory (list, element and variable requests). |
5 | FREEMAIN L LC LU E EC EU, VC, VU | Free memory (list, element and variable requests). |
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
WTOR |
Display a message on the screen.
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, VRU;
FREEMAIN R, RU, RC, VRC and VRU; STORAGE |
Get memory (RU and RC type register requests)
Free memory (all types of register requests). 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 © 1999 MERANT International Limited. All rights reserved.
This document and the proprietary marks and names
used herein are protected by international law.
Compiling and Linking Assembler Modules | File Handling |