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


Using Overlapped I/O with BSAM

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

When using BSAM with overlapped I/O (multiple I/O requests outstanding at one time), you must use more than one DECB. Specify a different DECB for each I/O request. For example, if you specify NCP=3 in your DCB for the data set and you are reading records from the data set, you can code the following macros in your program:
   ...
   READ DECB1,...
   READ DECB2,...
   READ DECB3,...
   CHECK DECB1
   CHECK DECB2
   CHECK DECB3
   ...
This is a more efficient technique:
   READ DECB1,...
   READ DECB2,...
   READ DECB3,...
   CHECK DECB1             Beginning of loop
   READ DECB1,...
   CHECK DECB2
   READ DECB2,...
   CHECK DECB3
   READ DECB3,...
   (Repeat the previous six macros until a
   CHECK macro causes entry to EODAD routine.)

This is a generalized technique that supports any value for NCP:

  1. Supply a DCBE with a nonzero MULTSDN and a nonzero MULTACC. For optimization you can select the MULTACC value to be half of the MULTSDN value.
  2. Issue an OPEN macro. OPEN calculates an NCP value. If using LBI to process a tape data set and the block size is greater than 32 768, the minimum calculated NCP value is 2 and the maximum value is 16.
  3. Allocate storage for a number of data areas equal to the NCP value and for an equal number of DECBs. They do not have to be contiguous. The DECBs must be below the 16 MB line, but the data areas can be above the 16 MB line. Central storage addresses can be above 2 GB. After each DECB you can add a word pointing to the next DECB and point the last one to the first DECB. This simplifies finding DECBs.
  4. For each DECB area, copy a single DECB to it, and issue a READ or WRITE macro to it, supplying an appropriate data area address.

    The source of the DECB copy can be above or below the 16 MB line but the destination must be below the 16 MB line.

  5. Repeat the following steps for each DECB until a CHECK macro for a READ causes entry to the end-of-data exit (EODAD) routine or until you have nothing more to write:
    1. Issue the CHECK macro (for oldest outstanding READ or WRITE)
    2. Process data in block if you are reading, or create a block in data area if you are writing.
    3. Issue the READ or WRITE macro to the DECB.
    4. Load a pointer to the next DECB (to get oldest outstanding READ or WRITE).
  6. If you are writing, then issue a CHECK macro for each remaining outstanding DECB in the order of the WRITEs. If you are reading, do not issue another CHECK.
  7. Issue a CLOSE macro and free storage.

Figure 3 shows this technique, except for the FIND macro and DSORG=PO in the DCB macro. To process a sequential data set, code DSORG=PS. You can easily adapt this technique to use WRITE or READ.

Go to the previous page Go to the next page




Copyright IBM Corporation 1990, 2014