Page 1 of 1

Alternative for GETMAIN.

Posted: Thu Jun 04, 2015 2:37 pm
by Leena
Hi,

I am looking for some alternate function for GETMAIN, is there any which can beused in plae of it? Please help.

Re: Alternative for GETMAIN.

Posted: Thu Jun 04, 2015 2:50 pm
by enrico-sorichetti
Why ?

Re: Alternative for GETMAIN.

Posted: Thu Jun 04, 2015 3:41 pm
by William Collins
There is, which is to use Language Environment. But Why? is a very good question.

Re: Alternative for GETMAIN.

Posted: Thu Jun 04, 2015 4:29 pm
by Anuj Dhawan
I do not speak assembler too often, however, for this question I think I've an answer - you can use STORAGE OBTAIN instead of GETMAIN: http://publibz.boulder.ibm.com/cgi-bin/ ... 0118202913 though Why? still is a very good question.

Hope this helps.

Re: Alternative for GETMAIN.

Posted: Thu Jun 04, 2015 5:44 pm
by enrico-sorichetti
telling that You use STORAGE OBTAIN/FREEMAIN is more trendy than telling that You are just a plain user of old plain GETMAIN/FREEMAIN :D

anyway see here about the differences
http://www-01.ibm.com/support/knowledge ... acros_.htm

Re: Alternative for GETMAIN.

Posted: Mon Jul 06, 2015 2:13 pm
by Leena
Thanks for the suggestion, appreciate that.

To answer why, I wanted to learn if there are other ways of doing it that's why I have asked away.

Enrico:: I am sorry but I could find the difference there. When I click on that link I'm taken to http://www-01.ibm.com/support/knowledgecenter/#!/ and searched for STORAGE OBTAIN, GETMAIN but none of them talked about the differences instead it explain about it. May be I did not follow you well.

Re: Alternative for GETMAIN.

Posted: Mon Jul 06, 2015 6:10 pm
by Robert Sample
Google is your friend. Googling getmain versus storage obtain returned about 3,520 hits including the first page with this:
Comparison of GETMAIN/FREEMAIN macros with the STORAGE macro

z/OS MVS Programming: Authorized Assembler Services Guide
SA22-7608-17





The decision about whether to use GETMAIN or STORAGE OBTAIN to obtain virtual storage and FREEMAIN or STORAGE RELEASE to release the storage depends on several conditions:
•The address space control (ASC) mode of your program. If it is in AR mode, use the STORAGE macro.
•The address space that contains the storage your program wants to obtain or release. If the storage is in an address space other than the primary, use the STORAGE macro.
•Whether the program requires a branch entry or a stacking PC entry to the macro service. Using the branch entry on the GETMAIN or FREEMAIN macro is more difficult than using the STORAGE macro. Therefore, you might use STORAGE OBTAIN instead of GETMAIN for ease of coding, for example, when your program: ◦Is in SRB mode
◦Is in cross memory mode
◦Is running with an enabled, unlocked, task mode (EUT) FRR

The branch entry (BRANCH parameter on GETMAIN or FREEMAIN) requires that your program hold certain locks. STORAGE does not have any locking requirement.


If your program runs in an environment where it can issue the FREEMAIN macro (as specified by the conditions listed above), you can use FREEMAIN to free storage that was originally obtained using STORAGE OBTAIN. You can also use STORAGE RELEASE to release storage that was originally obtained using GETMAIN.

Re: Alternative for GETMAIN.

Posted: Tue Jul 07, 2015 4:42 pm
by Leena
Thanks. Experience has its own ways to find answers.

Thank you so much for your help Robert.