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)