z/OS DFSMS Using Data Sets
Previous topic | Next topic | Contents | Contact z/OS | Library | PDF


Constructing a Buffer Pool: Examples

z/OS DFSMS Using Data Sets
SC23-6855-00

Figure 1 and Figure 2 show several possible methods of constructing a buffer pool. They do not consider the method of processing or controlling the buffers in the pool.

In Figure 1, a static storage area named INPOOL is allocated during program assembly.
Figure 1. Constructing a Buffer Pool from a Static Storage Area
               ...                           Processing
               BUILD     INPOOL,10,52        Structure a buffer pool
               OPEN      (INDCB,,OUTDCB,(OUTPUT))
               ...                           Processing
   ENDJOB      CLOSE     (INDCB,,OUTDCB)
               ...                           Processing
               RETURN                        Return to system control
   INDCB       DCB       BUFNO=5,BUFCB=INPOOL,EODAD=ENDJOB,---
   OUTDCB      DCB       BUFNO=5,BUFCB=INPOOL,---
               CNOP      0,8                 Force boundary alignment
   INPOOL      DS        CL528               Buffer pool
               ...

The BUILD macro, issued during execution, arranges the buffer pool into 10 buffers, each 52 bytes long. Five buffers are assigned to INDCB and five to OUTDCB, as specified in the DCB macro for each. The two data sets share the buffer pool because both specify INPOOL as the buffer pool control block. Notice that an additional 8 bytes have been allocated for the buffer pool to contain the buffer pool control block.

In Figure 2, two buffer pools are constructed explicitly by the GETPOOL macros.
Figure 2. Constructing a Buffer Pool Using GETPOOL and FREEPOOL
          ...
          GETPOOL     INDCB,10,52             Construct a 10-buffer pool
          GETPOOL     OUTDCB,5,112            Construct a 5-buffer pool
          OPEN        (INDCB,,OUTDCB,(OUTPUT))
          ...
ENDJOB    CLOSE       (INDCB,,OUTDCB)
          FREEPOOL    INDCB                   Release buffer pools after all
*                                              I/O is complete
          FREEPOOL    OUTDCB
          ...
          RETURN                              Return to system control
INDCB     DCB         DSORG=PS,BFALN=F,LRECL=52,RECFM=F,EODAD=ENDJOB,---
OUTDCB    DCB         DSORG=IS,BFALN=D,LRECL=52,KEYLEN=10,BLKSIZE=104,       C
          ...     RKP=0,RECFM=FB,---

Ten input buffers are provided, each 52 bytes long, to contain one fixed-length record. Five output buffers are provided, each 112 bytes long, to contain 2 blocked records plus an 8 byte count field. Notice that both data sets are closed before the buffer pools are released by the FREEPOOL macros. The same procedure should be used if the buffer pools were constructed automatically by the OPEN macro.

Go to the previous page Go to the next page




Copyright IBM Corporation 1990, 2014