Space announcement This documentation space provides the same content as before, but the organization of the content has changed. The content is now organized based on logical branches instead of legacy book titles. We hope that the new structure will help you quickly find the content that you need.

GETMAIN




Assembler


Description

The GETMAIN command invokes the GETMAIN macro and allocates virtual storage. At least one parameter (nnK, LA= length address, LV= length value) must be specified with the GETMAIN command. Then, any number of optional parameters can be specified. The address will be stored in register 1 if no address parameter is specified, and the return code is stored in register 15. A record of the command is written to the session log.

Input

image2021-2-15_18-7-36.png

The following are the parameter descriptions for the GETMAIN command:

n

The length in number of bytes.

nK

The length in number of bytes times 4096.

LA=length address

The address or general-purpose register number containing the address of a fullword length. Enclose a register number in parentheses.

LV=length value

The length in number of bytes or general-purpose register number containing a length in number of bytes. Enclose a register number in parentheses.

A=

The address, label, or general-purpose register number containing the starting address of the acquired storage. If address is not specified with the A= parameter, the default is register 1. Enclose a register number in parentheses.

BNDRY=

Alignment of the acquired storage. DBLWD is the default.

INIT=

The initialization of the acquired storage. Valid values for character are 00 - 99 and A - Z. The default is 00.

LOC=

Location of the acquired storage with reference to the 16MB line. BELOW is the default.

SP=

subpool number from 0 - 127 or general-purpose register number containing a subpool number. Enclose a register number in parentheses. The default subpool is 0.

Usage Notes

  1. When the GETMAIN command is entered with a register number specified for the A= parameter, that register and register 15 are updated in the GPREGS or Keep window.
  2. SHOW REGION does not display the updated storage information until a page boundary (4096K) is met, even after you enter the GETMAIN command.

Examples

  1. To acquire 198 bytes of storage above the line using subpool 2, enter:
       GETMAIN 198 LOC=ABOVE SP=2
  2. To acquire 4096 bytes of storage below the line and initialize with character “Z”, enter:
       GETMAIN 1K INIT=Z
  3. To acquire storage with the length in register 9 and return the acquired storage location in register 3, enter:
       GETMAIN LA=(9) A=(3) LOC=ANY
    The following figure shows an example of entering the GETMAIN command to acquire storage.
    Entering the GETMAIN Command 

    ---------------------------- CODE DEBUG TSO - SOURCE --------------------------
    COMMAND ===> getmain 198 sp=123                                SCROLL ===> CSR
    PROGRAM: ASMRENT    MODULE: ASMRENT   COMP DATE: 07/29/1995  COMP TIME: 14.41.00
    000095    SAVEAREA DS    0D                   >  0                    DBLWORD
            ** END **

    ------   ------------------------------------------ Before ASMRENT:27/AMODE 24 <>
    000009             LR    R12,R15            *
    000010             DROP  R15                *     OPEN UP
    000011             USING ASMRENT,R12
    000012             USING WORKSTOR,R4
    000013             L     R0,WORKSIZE
    000014             GETMAIN RC,LV=(0)
    000024             LTR   R15,R15
    000025             BNZ   ENDRTN
    000026             LR    R4,R1
    =====>             LA    R11,SAVEAREA        *
    000028             ST    R13,4(R11)          *    CHAIN SAVE AREAS
     GPREGS  R0  ==> 00000198 R1  ==> 800800F8 R2  ==> 80077BFC R3  ==> 0005AC30
             R4  ==> 0003C108 R5  ==> 0003C850 R6  ==> 00000000 R7  ==> 800491F6
             R8  ==> 0008DFF4 R9  ==> 00000198 R10 ==> 0004935C R11 ==> 00000000
             R12 ==> 0007FAC8 R13 ==> 0008DFA8 R14 ==> 0007DA4C R15 ==> 0003C0F8

    The following figure shows the result of entering the GETMAIN command. The starting address of the acquired storage is stored in register 1 and the return code is stored in register 15.

    Result of Executing the GETMAIN Command 

    ----------------------------- CODE DEBUG TSO - SOURCE ------------------------
    COMMAND ===>                                                   SCROLL ===> CSR
    PROGRAM: ASMRENT    MODULE: ASMRENT   COMP DATE: 07/29/1995  COMP TIME: 14.41.00
    000095    SAVEAREA DS    0D                   >  0                    DBLWORD
            ** END **

    ------   ------------------------------------------ Before ASMRENT:27/AMODE 24 <>
    000009             LR    R12,R15            *
    000010             DROP  R15                *     OPEN UP
    000011             USING ASMRENT,R12
    000012             USING WORKSTOR,R4
    000013             L     R0,WORKSIZE
    000014             GETMAIN RC,LV=(0)
    000024             LTR   R15,R15
    000025             BNZ   ENDRTN
    000026             LR    R4,R1
    =====>             LA    R11,SAVEAREA        *
    000028             ST    R13,4(R11)          *    CHAIN SAVE AREAS
     GPREGS  R0  ==> 00000198 R1  ==> 0003C108 R2  ==> 80077BFC R3  ==> 0005AC30
             R4  ==> 0003C108 R5  ==> 0003C850 R6  ==> 00000000 R7  ==> 800491F6
             R8  ==> 0008DFF4 R9  ==> 00000198 R10 ==> 0004935C R11 ==> 00000000
             R12 ==> 0007FAC8 R13 ==> 0008DFA8 R14 ==> 0007DA4C R15 ==> 00000000

 

Tip: For faster searching, add an asterisk to the end of your partial query. Example: cert*