Try FREEPOOL XDCB before the CLOSE.

Or ... a DCBE with RMODE31=BUFF will both do the FREEPOOL automatically and
get the buffers up above the line, where there is more storage.

Charles


-----Original Message-----
From: IBM Mainframe Assembler List [mailto:[email protected]]
On Behalf Of Phil Smith III
Sent: Wednesday, July 10, 2019 1:48 PM
To: [email protected]
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

Reply via email to