Receiving Control during I/O Operation
The AUXPROC option of the FILEDEF command can be used to monitor and modify I/O operations. It requires some knowledge of the control blocks, OPSECT and FCB, in order to be used. See the z/VM: CMS Macros and Functions Reference for information on OPSECT and FCB.
Use the FILEDEF AUXPROC option to indicate the fullword address of an auxiliary processing routine you have written. The AUXPROC option is valid only when FILEDEF is executed by an internal program call. It is invalid when entered as a terminal command because it must specify an address. Your AUXPROC routine will receive control from CMS before any device I/O is performed. The CMS language interface programs use this feature for special I/O handling of certain (utility) data sets. If your AUXPROC routine issues an OS OPEN on a file, you must make sure that any changes to the file attributes do not interfere with any other file processing.
At the completion of your auxiliary routine processing, control returns to CMS, signaling whether I/O has been performed. If it has not been done, CMS performs the appropriate device I/O.
When the routine receives control from CMS, the general purpose registers contain the following information:
- GPR2
- = data control block (DCB) address
- GPR3
- = base register for CMS
- GPR8
- = CMS OPSECT address
- GPR11
- = file control block (FCB) address
- GPR14
- = return address in CMS
- GPR15
- = auxiliary processing routine address
- all other registers
- = work registers
The FCBSECT can be found in the DMSOM MACLIB as member CMSCB. The OPSECT can be found in the DMSOM MACLIB as member IO. See the z/VM: CMS Macros and Functions Reference for information about OPSECT and FCBSECT.
The auxiliary processing routine must provide a save area to save the general purpose registers. This routine must also perform the save operation. CMS does not provide the address of a save area in general purpose register 13, as is usually the case. When control returns to CMS, the general purpose registers must be restored to their original values. Control is returned to CMS by branching to the address contained in general purpose register 14.
GPR15 is used by the auxiliary processing routine to inform CMS of the action that has been or should be taken with the data block as follows:
Register Content | Action |
---|---|
GPR15=0 | No I/O performed by AUXPROC routine. CMS performs I/O. |
GPR15<0 | I/O performed by AUXPROC routine and error was encountered. CMS takes error action. |
GPR15>0 and GPR15<X'10000' | I/O performed by AUXPROC routine with residual count in GPR15. |
GPR15=X'10000' | I/O performed by AUXPROC routine with zero residual count. |
GPR15 should not be returned with a value greater than X'10000'. If it does, the system will treat the last two bytes of GPR15 as the residual count.