When you don't need a certain buffer any more, you have to call this command to remove it from memory. If the given buffer was the only buffer with access to a certain file, then the file will be closed as well.
Note that all buffers have to be removed before removing a job, as the buffers will otherwise remain in memory until the next garbage collection.
Sbasic UNUSEbuffer #bufferid Assembler UNUS bufferid C long DDunusebuffer(long bufferid); errors, code, meaning no errors possible
If you want to find out which buffers are in use by your job, you can cycle through them with this command. To get the first buffer in the list, you have to call it without specifying the bufferid. In any other case, the bufferid of the next buffer is returned, or zero if there is no next buffer. In Sbasic this can be used to remove all buffers like this :
dd_err=0 REPeat loop UNUSEbuffer #CYCLEbuffer IF dd_err THEN EXIT loop END REPeat loop
Sbasic ret=CYCLEbuffer(#bufferid) Assembler CYCB bufferid return long bufferid C long DDcyclebuffer(long bufferid, long *return); errors, code, meaning ITNF -7 invalid bufferid