In a theoretical computer science class, one could debate the validity of 
requesting 0 bytes of storage or of "successfully" acquiring 0 bytes of 
storage.  In the real world, such an event should be an error, but this quirk 
is not going to be changed by IBM because of incompatibility issues.  So either 
insert code after a STORAGE OBTAIN to test for return code = 0 and also storage 
address = 0 and then ABEND your own code (or do something else other than try 
to use the non-existent storage that you didn't really get), or else test for 
requested length = 0 before you do the STORAGE ABEND and then do not do the 
STORAGE OBTAIN and assume you have new storage to use. 
  
Translation:  add some workaround code into your program since IBM will not 
"fix" it. 
  
Suggestion to IBM:  Add a sentence to the doc warning users about this odd 
behavior. 
  
Bill Fairchild 

----- Original Message -----

From: "Gerhard Postpischil" <gerha...@charter.net> 
To: IBM-MAIN@LISTSERV.UA.EDU 
Sent: Wednesday, February 12, 2014 5:22:38 PM 
Subject: Re: Storage Obtain ..... 

On 2/12/2014 6:06 PM, Tony Harminc wrote: 
> I object far more to returning an address of 0 than to accepting a 
> length of 0 on the request. To be sure, you are allowed to store no 
> more than 0 bytes in your obtained area, so the 0 address sounds 
> reasonable, but some instructions are allowed by the architecture to 
> recognize access exceptions in the case where no data is stored, e.g. 
> STCM with a zero mask. 

The way I get and free storage, I'd be happier with an abend (R form) or 
non-zero return code. I generally save the length, and then do a 
FREEMAIN (or STORAGE RELEASE) using the saved length. If the 
GETMAIN/OBTAIN was accepted, freeing zero length is an instant disaster. 

----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN

Reply via email to