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


Using the NOTE Macro to Return the Relative Address of a Block

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

The NOTE macro requests the relative address of the first logical record of the block just read or written. In a multivolume non-extended-format data set, the address is relative to the beginning of the data set on the volume currently being processed. In a striped data set, the address is always relative to the beginning of the data set. Your program later uses the address in positioning operations.

For magnetic tape, the address is in the form of a 4-byte block address. If you code a TYPE=REL or do not code TYPE, NOTE returns the block address in register 1. In this case the first block in the current file on the volume is X'00000001'. If you code TYPE=ABS, NOTE returns the physical block identifier of a data block on tape in register 0. In this case the content of the physical block identifier is device-dependent and is relative to the beginning of the volume. Later you can use the block address or the block identifier as a search argument for the POINT macro. If your program issues a NOTE macro with TYPE=REL on tape, NOTE might return an invalid block address of zero. It signifies that the block was written on the previous volume and you now are positioned on a different volume.

If you wish to learn the address of the last block on the previous tape, you can do the following instead of the logic above:

  1. Issue WAIT or EVENTS macro for the DECB instead of issuing the CHECK macro. The DECB begins with an ECB. Do not check the ECB completion code yet.
  2. Issue NOTE. You do not yet know whether the returned value is valid but save it anyway.
  3. If the ECB completion code byte is X'7F', then the write completed normally, it is not necessary to issue CHECK, and the value returned by NOTE is good.
  4. If the ECB completion code is not X'7F', then the WRITE might have failed. In that case issue the CHECK macro. CHECK has three possible outcomes:
    • Entry to the SYNAD routine, which indicates there was an I/O error. The NOTE macro was not useful except to come back to the bad place on the tape with POINT.
    • x37 ABEND caused by a variety of possible problems such as running out of tape when another volume is not available, or the volume that was specifically requested does not exist.
    • Successfully transitioning to the next volume. CHECK returns control to the next sequential instruction. Do not issue another NOTE, because the earlier NOTE on the previous volume was valid. To position to the previous volume, you must close the DCB and open the DCB to that volume. Then either issue POINT or issue CLOSE with LEAVE and TYPE=T parameters and the BSP macro.
Note: The above technique works only on tape. The problem does not occur on disk or if you use NOTE TYPE=ABS.

For non-extended-format data sets on direct access storage devices, the address is in the form of a 4-byte relative track record address. For extended format data sets, the address is in the form of a block locator token (BLT). The BLT is essentially the relative block number (RBN) within the current logical volume of the data set where the first block has an RBN of 1. The user sees a multistriped data set as a single logical volume; therefore, for a multistriped data set, the RBN is relative to the beginning of the data set and incorporates all stripes. For PDSEs, the address is in the form of a record locator token. The address provided by the operating system is returned in register 1. For non-extended-format data sets and partitioned data sets, NOTE returns the track balance in register 0 if the last I/O operation was a WRITE, or returns the track capacity if the NOTE follows a READ or POINT. For PDSEs, extended format data sets and HFS data sets, NOTE returns X'7FFF' in register 0.

See Using the NOTE Macro to Provide Relative Position for information about using the NOTE macro to process PDSEs.

Go to the previous page Go to the next page




Copyright IBM Corporation 1990, 2014