GETMAIN 
Author Message
 GETMAIN

Quote:
>I believe you put the register number in (), in place of the
>length.  If you put the number, it has to load it into
>a register, anyway.  Then again, you can do the SVC directly.
>It is, I believe, SVC 10.  There is also SVC 4, and SVC 5,
>which are related.

This is a VERY BAD recommendation.  Here are some reasons:

(1) Various releases of the MVS operating system have different
    capabilities with regard to GETMAIN.  In particular, MVS/XA
    allows specification of the location of the returned storage
    wrt the 16M line (above or below), and MVS/ESA allows further
    options as to the nature of the addressability of the storage.
    These all use different SVC numbers.  In fact, SVC's 4, 5 and
    10 are pretty much "out of style".  Even non-ESA code for the
    past several years has tended to use SVC 120.

(2) In any case, coders should ALWAYS use documented interfaces
    to system facilities unless there is a very good reason to do
    otherwise (e.g. IBM doesn't provide a way for you to do X,
    which is true of things like reentrant CAMLST calls, but not
    of GETMAIN/FREEMAIN to my knowledge).

(3) The code will be less than perspicuous to anyone who does not
    have the popular SVC numbers memorized, unless very heavy
    commenting is present.  And in such a case, why go to the
    trouble of filling in the gap with comments when the presence
    of the sanctioned IBM macro itself provides much of the
    documentation?  (There's even a parameter called "RELATED"
    on GETMAIN, for those who hate typing comments that the
    assembler can't read for some unknown reason.)

In short, such coding practices should NOT be encouraged,
particularly for novice users.

GETMAIN for length encoded at run time?  Here's the best way:

   LA  R0,constant_length_value_between_1_and_4095
   GETMAIN R,LV=(0)

   or

   L   R0,fullword_containing_length_value
 *     (but be sure the high-order byte is zero)
   GETMAIN R,LV=(0)

Note that the specification (0) not only says that the length to get
is in register 0, but for many simple GETMAIN cases it will eliminate
a register load, since the macro knows that the GETMAIN SVC expects
the length in register zero.  Admittedly this relies on knowledge of
the underlying SVC, but this is established practice and is even
recommended in the relevant IBM manual, as I remember.

                                        - SEB



Sat, 21 Aug 1993 08:15:00 GMT  
 GETMAIN

Quote:
> There's even a parameter called "RELATED" on GETMAIN....

"RELATED"... yuk.  SETLOCK actually *requires* the use of RELATED,
which I always thought was pretty heavy handed, even for IBM.
Whenever I code one of these I either use RELATED=(X) - if I'm in
a hurry - or I code RELATED=(IBMSUCKS).  Usually I code the latter
when my first assembly failed because I neglected to include the
officially IBM sanctioned comment parameter.

- David Andrews    tarpit!rtmvax!dandrews



Mon, 23 Aug 1993 23:41:14 GMT  
 GETMAIN

Quote:
> There's even a parameter called "RELATED" on GETMAIN....

"RELATED"... yuk.  SETLOCK actually *requires* the use of RELATED,
which I always thought was pretty heavy handed, even for IBM.
Whenever I code one of these I either use RELATED=(X) - if I'm in
a hurry - or I code RELATED=(IBMSUCKS).  Usually I code the latter
when my first assembly failed because I neglected to include the
officially IBM sanctioned comment parameter.

- David Andrews    tarpit!rtmvax!dandrews



Mon, 23 Aug 1993 23:41:14 GMT  
 GETMAIN
Sorry about the SVC comment.  It was to suggest that the final
result of the macro is an SVC call, and that the goal of the
macro is to get the number into the register.  It has been
about 10 years since I did this, and that was OS/VS2 and OS/MVT.

The only reason I would suggest using the SVC is for the fun of
seeing the SVC work under unusual conditions, not hthat I can think
of many.

-- glen



Fri, 27 Aug 1993 18:04:40 GMT  
 
 [ 4 post ] 

 Relevant Pages 

1. GETMAIN

2. Getmain Help

3. GETMAIN

4. GETMAIN/FREEMAIN routines in MVS Cobol/370

5. GETMAIN ACROSS LINKAGE IN COBOL

6. GETMAIN limitations in COBOL??

7. MVS: GETMAIN / FREEMAIN

8. How to Do a GETMAIN in VS COBOL II Batch?

9. Arghh! Difference between 'GETMAIN R,LV=(0)' and 'STORAGE OBTAIN,LENGTH=(0)'

 

 
Powered by phpBB® Forum Software