getmain one new memory

High Level Assembler(HLASM) for MVS & VM & VSE

getmain one new memory

Postby bobguo » Fri Mar 08, 2013 6:40 am

Hi guys,

in general, if we want to getmain one memry, almost all the programs would like to issue

but right now, if i want to getmain one new memory in one small HLASM program which does NOT use cics command, how can i achieve it?
thanks very much!

Posts: 76
Joined: Thu Apr 26, 2012 11:18 am
Location: shanghai
Has thanked: 22 times
Been thanked: 0 time

Re: getmain one new memory

Postby Robert Sample » Fri Mar 08, 2013 7:27 am

Is the program running in CICS?

For batch programs, look at the GETMAIN or STORAGE macros in the Assembler Services Reference manuals.

Although, it is hard to tell if you want 1 byte or 1 page or what from your post:
one new memory

These users thanked the author Robert Sample for the post:
bobguo (Fri Mar 08, 2013 1:58 pm)
Robert Sample
Global moderator
Posts: 3720
Joined: Sat Dec 19, 2009 8:32 pm
Location: Dubuque, Iowa, USA
Has thanked: 1 time
Been thanked: 279 times

Re: getmain one new memory

Postby steve-myers » Fri Mar 08, 2013 9:27 am

Actually it is difficult to divine your intent. In z/OS internals, the term "memory" often refers to the concept of allocating something like a data space, which is moderately difficult and not suited for discussion in a a beginner's forum. If what you really need is a "small" amount of storage, and the program is not running in CICS, you want to use something like the GETMAIN or STORAGE macros, as suggested by Mr. Sample, and use FREEMAIN or STORAGE to release the storage when you no longer need the storage. These macros are described in detail in Assembler Services Guide or Assembler Services Reference ABE-HSP (the exact title changes sightly from release to release) for your z/OS release. There are so many options with these macros I won't begin by trying to describe them.

Historically, there have been two major versions of the GETMAIN and FREEMAIN macros: the OS/360 versions and the MVS "native" versions. The OS/360 macros generate SVC 4, SVC 5 or SVC 10 machine instructions; the MVS "native" versions generate the SVC 120 instruction. The two versions are mixed together in a nearly incomprehensible (especially if you attempt to understand the macro source itself) manner. The documentation does not distinguish the version; it just lumps everything together. Most of us just use the R (OS/360) or RU, RC, VRU, VRC ("native" MVS) forms of the macros, and rarely, if ever, use the other forms (all OS/360) of the macros. The STORAGE macro is strictly MVS, though I don't recall when it was added.

The STORAGE macro provides the same general services as the "native" MVS forms of the GETMAIN and FREEMAIN macros. but it uses the PC instruction operating as what 80x86 hardware calls a "call gate" to invoke the service. Most of us avoid the STORAGE macro; if it abnormally terminates your program it is difficult to determine where in your program the failing STORAGE macro was issued.

Hope this helps.

These users thanked the author steve-myers for the post (total 2):
Peter_Mann (Sat Mar 09, 2013 1:37 am) • bobguo (Fri Mar 08, 2013 1:58 pm)
Global moderator
Posts: 2105
Joined: Thu Jun 03, 2010 6:21 pm
Has thanked: 4 times
Been thanked: 243 times

Return to Assembler


  • Related topics
    Last post