/*-------------------------------------------------------------------+
|                                                                    |
|                Copyright (c) 1996, SAS Institute Inc.              |
|                  Unpublished - All Rights Reserved                 |
|                      S A S / C   S A M P L E                       |
|         NAME: ihadva header file                                   |
|     LANGUAGE: C                                                    |
|      PURPOSE: Contains #define statements , pointer and structure  |
|               declarations for MVS DEVTYPE macro.                  |
|                                                                    |
|         MISC: See sasc.sample.c(tryracf)                           |
+-------------------------------------------------------------------*/
 /********************************************************************/
 /*                 DEVTYPE PARAMETER AREA                           */
 /* This structure MAPS THE PARAMETER AREA RETURNED TO THE CALLER BY */
 /*     THE DEVTYPE SVC.                                             */
 /*                                                                  */
 /********************************************************************/

 /*********************************************************************
 * The following symbols define flags in dva.flags                    *
 *********************************************************************/

#define DVABDCYL (0x80)                /* IF 1, DVACYL IS INVALID     */
#define DVADEFLR (0x40)                /* DEFINE EXTENT/LOCATE RECORD */
                                       /*AND RELATED TRANSFER COMMANDS*/
                                       /* IMPLEMENTED                 */
#define DVADEFEX (0x20)                /* DEFINE EXTENT IMPLEMENTED   */
#define DVA2BOV (0x08)                 /* IF 1, USE dva.ov.hd         */
                                       /* IF 0, USE dva.v.nlb and .lb */
#define DVAMODL (0x10)                 /* IF 1 USE DVAMOD1,           */
                                       /* DVAOVH1,DVAOVH2             */
#define DVAPAGES (0x04)                /* IF 1, DEVICE SUPPORTS       */
                                       /* paging ccws.                */
                                       /* IF 0, DEVICE DOESN'T SUPPORT*/
                                       /* PAGING CCWS.                */
#define DVAFTOL (0x01)                 /* IF 1, APPLY TOLERANCE FACTOR*/

 /*********************************************************************
 * The following symbols define device types.                         *
 *********************************************************************/

#define DVASHFT 9                      /* Shift amt to divide by 512 */


struct DVA {
/**********************************************************************
*  The first two full words of the output area contain the            *
*  UCBTYPE field and maximum record size for all devices.  They are   *
*  followed by the device table entry if the device is direct access  *
*  and if keyword devtab was specified.                               *
**********************************************************************/
   struct UCBTY {                      /* UCBTYPE field              */
      char opts(º2º);                  /* UCB OPTIONS                */
      char class;                      /* DEVICE CLASS               */
      char unit;                       /* UNIT TYPE                  */
   } ucbty;
   int maxrc;                          /* Maximum record size.       */
/**********************************************************************
*                         SECTION FOR DASD DEVICES                    *
**********************************************************************/
   struct TAB {
      short cyl;                       /* Phys no. cyl per volume.   */
      short trk;                       /* No. tracks per cylinder.   */
      short trkln;                     /* No. bytes per track.       */
      union OV {
         short hd;                     /* If (dva.flags & DVA2BOV)   */
                                       /*    this is block overhead. */
         struct V {                    /* else                       */
            char nlb;                  /*    overhead not last block.*/
            char lb;                   /*    overhad last block.     */
         } v;
      } ov;
      char ovnk;                       /* Overhead decrement not keyed*/
      char flags;
      short tol;                       /* Tolerance factor.          */
                                  /************************************
                                  * Apply tolerance factor as follows:*
                                  * 1. add blocksize and keylength    *
                                  * 2. multiply by dva.tol            *
                                  * 3. shift right DVASHFT bits       *
                                  * 4. add appropriate overheads      *
                                  ************************************/
   } tab;

   struct RPS {
/*********************************************************************
*              The following section of the table is present         *
*              only for rps devices--test UCBTBYT2 for UCB2OPT3.     *
*              That is, If (dva.ucbty.opts(|1|) & UCBRPS)...         *
*              where UCBRPS is #define'd to (0x10)                   *
**********************************************************************
* To calculate the sector for non-modulo devices perform the         *
* following calculation:                                             *
* SECTOR = ((DVAOVR0 + COST(N-1)) * DVASECTD) / DVATRKLN             *
*********************************************************************/
      short ovr0;                      /* Overhead bytes for record 0*/
      char sect;                       /* No. sectors in full track. */
      char sectd;                      /* No. data sectors.          */
   } rps;
/*************************************************************
* In the DSECT for this area, certain fields have altenate
* definitions for modulo devices. An algorithm for calculating
* the overhead for these devices is given in the IHADVA
* assembler macro provided by IBM.
*************************************************************/
};