FREEPOOL the buffers after CLOSE?  Maybe use a DECB with RMODE31=ALL to get the 
control blocks and buffers above the line?

You may just be running out of below-the-line (16M) memory.

HTH

Peter

-----Original Message-----
From: IBM Mainframe Assembler List <ASSEMBLER-LIST@LISTSERV.UGA.EDU> On Behalf 
Of Phil Smith III
Sent: Wednesday, July 10, 2019 4:48 PM
To: ASSEMBLER-LIST@LISTSERV.UGA.EDU
Subject: Probably dumb assembler question

Before I try to make the code below runnable as a standalone program, maybe 
someone can suggest what's going on here. I have a program (an API) that may 
write to SYSPRINT (if there's an error, and it hasn't been passed a buffer to 
return the error message to the caller) using the following sequence. 
Essentially it's just doing an OPEN, PUT, CLOSE. And that works as expected.

BUT it seems to eat storage. That is, if I run a program that calls the API 
repeatedly and invalidly, it writes the errors to SYSPRINT, but gets an S878 
reason code 10 after 1900-odd iterations. I've tinkered, commenting out the 
PUT: no change. So it's not the actual PUT that's irritating it. If I comment 
out the CLOSE, it gets the S878 after fewer iterations, which sort of makes 
sense: it's leaving the file open. But why is it running out at all? The DD is 
just SYSPRINT DD SYSOUT=*, and REGION=0K. I feel like I'm missing something 
basic and obvious here (not the first time).

Any suggestions gratefully accepted!

* Message is in WORKMSG on arrival here
         STORAGE OBTAIN,LENGTH=XDCBL,LOC=BELOW  Get 24-bit DCB buffer
         LR    R4,R1         Move pointer to our 24-bit DCB
         MVC   0(XDCBL,R4),XDCB  Copy the DCB down below the line
         MVC   WORKDWRD(XOPENL),XOPEN  Copy the OPEN macro model
         OPEN  ((4),(OUTPUT)),MODE=31,MF=(E,WORKDWRD)  Open for write
         LTR   R15,R15       Did that work??
         JNZ   WRITTEN       No, skip write, release DCB buffer
         PUT   (4),WORKMSG   Write the message
         MVC   WORKDWRD(XCLOSEL),XCLOSE  Copy in CLOSE template
         CLOSE ((4)),MODE=31,MF=(E,WORKDWRD)  And do the CLOSE
WRITTEN  DS    0H
         STORAGE RELEASE,LENGTH=XDCBL,ADDR=(R4)  Release DCB buffer

***MUCH LATER***

XDCB     DCB   DDNAME=SYSPRINT,DSORG=PS,MACRF=PM,RECFM=FBA,            *
               LRECL=133,BLKSIZE=3990
XDCBL    EQU   *-XDCB        Length of our DCB so we can copy it

XOPEN    OPEN  (*-*,(OUTPUT)),MODE=31,MF=L
XOPENL   EQU   *-XOPEN

XCLOSE   CLOSE (*-*),MODE=31,MF=L
XCLOSEL  EQU   *-XCLOSE
-- 

This message and any attachments are intended only for the use of the addressee 
and may contain information that is privileged and confidential. If the reader 
of the message is not the intended recipient or an authorized representative of 
the intended recipient, you are hereby notified that any dissemination of this 
communication is strictly prohibited. If you have received this communication 
in error, please notify us immediately by e-mail and delete the message and any 
attachments from your system.

Reply via email to