CBRHSC

SAMPLIB member CBRHSC, as shown here, provides a storage class ACS routine for STORE, CHANGE, and CTRANS.
/*********************************************************************/
/*                                                                   */
/* $SEG(CBRHSC) COMP(OSMC) PROD(OAM):                                */
/*                                                                   */
/* OAM Sample Storage Class ACS Routine                              */
/*                                                                   */
/* FUNCTION: SUPPLY A STORAGE CLASS FOR OAM OBJECTS                  */
/*                                                                   */
/* OPERATION: Supply a storage class for the following environments: */
/*                                                                   */
/*              STORE   - Assign initial storage class of DASD or    */
/*                        optical library based on collection name.  */
/*              CHANGE  - The storage class of an object has been    */
/*                        requested to change.                       */
/*              CTRANS  - The object is moved in the hierarchy       */
/*                        according to management class.             */
/*                                                                   */
/* NOTES:     In this implementation, the collection name is used as */
/*            the basis for determining whether explicit values will */
/*            be considered. This approach and all of the processing */
/*            indicated below is one of many differing possibilities */
/*            and is only for purposes of illustration to demonstrate*/
/*            the types of processing that can be accomplished in an */
/*            ACS routine. Actual implementations will vary.         */
/*                                                                   */
/* ASSUMPTIONS:                                                      */
/*   Collection name format                                          */
/*     CLLCT0mn                                                      */
/*       where m = 0 or 1 (0 indicates that explicit values will be  */
/*                         ignored, 1 indicates that explicit values */
/*                         are considered in some cases and may      */
/*                         result in an override)                    */
/*       where n = 0 - 9                                             */
/*   Object name format - has 5 levels as follows:                   */
/*     xxxx.xxx.xxxxxxxx.xxxxxxx.xxx                                 */
/*   Valid storage classes:                                          */
/*     DB2DASD  - DASD                                               */
/*     OLIBRARY - optical                                            */
/*     TAPESC   - tape                                               */
/*                                                                   */
/*   CHANGE ACTIVITY:                                                */
/*     $L0=JDP3227 320 890601 TUCKSG: Initial Release                */
/*     $L1=JDP3331 331 910614 TUCKSG: Added sample definitions       */
/*     $00=OW00750 120 931203 TUCSMC: Added tape samples             */
/*                                                                   */
/*********************************************************************/
/*             L O G I C        O V E R V I E W                      */
/*                                                                   */
/* If STORE environment                                              */
/* | If object name not specified (i.e. this is an invocation for    */
/* | the entire collection)                                          */
/* | | Select                                                        */
/* | | When the collection is in the set that we are defining to     */
/* | | allow overrides                                               */
/* | | | If storage class specified is not 'OLIBRARY'                */
/* | | | | Set the storage class to 'DB2DASD'                        */
/* | | | Endif                                                       */
/* | | When the collection is in the set that we are defining to     */
/* | | not allow overrides                                           */
/* | | | Set the storage class to 'OLIBRARY'                         */
/* | | Otherwise                                                     */
/* | | | Set error code                                              */
/* | | End                                                           */
/* | Else (an object name was specified)                             */
/* | | Select                                                        */
/* | | When the collection is in the set that we are defining to     */
/* | | allow overrides                                               */
/* | | | If storage class specified is not 'OLIBRARY'                */
/* | | | | Set the storage class to 'DB2DASD'                        */
/* | | | Endif                                                       */
/* | | When the collection is in the set that we are defining to     */
/* | | not allow overrides                                           */
/* | | | If the object name has exactly 5 levels and the 5th         */
/* | | | level indicates that the object should have a particular    */
/* | | | storage class                                               */
/* | | | | Set the storage class to 'DB2DASD'                        */
/* | | | Else                                                        */
/* | | | | Set the storage class to 'OLIBRARY'                       */
/* | | | Endif                                                       */
/* | | Otherwise                                                     */
/* | | | Set error code                                              */
/* | | End                                                           */
/* | Endif (object name specified)                                   */
/* Endif (STORE environment)                                         */
/*                                                                   */
/*                                                                   */
/* If CHANGE environment                                             */
/* | If the storage class specified is not a valid storage class     */
/* | | Set error code                                                */
/* | Endif                                                           */
/* Endif (CHANGE environment)                                        */
/*                                                                   */
/*                                                                   */
/* If CLASS_TRANSITION environment                                   */
/* | Select                                                          */
/* | When storage class is 'DB2DASD'                                 */
/* | | Set storage class to 'OLIBRARY'                               */
/* | When storage class is 'OLIBRARY'                                */
/* | | Set storage class to 'TAPESC'                                 */
/* | Otherwise                                                       */
/* | | Set error code                                                */
/* | End                                                             */
/* Endif                                                             */
/*********************************************************************/
/*      S T O R A G E    C L A S S   D E F I N I T I O N S           */
/*                                                                   */
/*Relevant                                                           */
/*Fields    DB2DASD OLIBRARY TAPESC                                  */
/*--------- ------- -------- -------                                 */
/*INITIAL                                                            */
/*ACCESS                                                             */
/*RESPONSE                                                           */
/*SECONDS       0      20      900                                   */
/*                                                                   */
/*SUSTAINED                                                          */
/*DATA                                                               */
/*RATE         n/a      1        3                                   */
/*                                                                   */
/*********************************************************************/


PROC STORCLAS                          /* Select a storage class     */

  FILTLIST BLANK    INCLUDE ('        ','')

/*********************************************************************/
/* STORE                                                             */
/*********************************************************************/
 IF &ACSENVIR = 'STORE' THEN           /* Object is being stored     */
   IF &MEMN = &BLANK THEN              /* If the object name is not
                                          specified (i.e. indicating
                                          an invocation for the entire
                                          collection)                */
     SELECT
     WHEN (&DSN = 'CLLCT010' | &DSN = 'CLLCT011' | &DSN = 'CLLCT012'
         | &DSN = 'CLLCT013' | &DSN = 'CLLCT014' | &DSN = 'CLLCT015'
         | &DSN = 'CLLCT016' | &DSN = 'CLLCT017' | &DSN = 'CLLCT018'
         | &DSN = 'CLLCT019')          /* For the collections which
                                          allow overrides            */
       IF &STORCLAS ¬= 'OLIBRARY' THEN /* If the storage class
                                          specified is not the one
                                          explicit storage class value
                                          that is considered valid
                                          for these collections      */
         SET &STORCLAS = 'DB2DASD'     /* Set the storage class to the
                                          desired value for these
                                          collections                */
     WHEN (&DSN = 'CLLCT000' | &DSN = 'CLLCT001' | &DSN = 'CLLCT002'
         | &DSN = 'CLLCT003' | &DSN = 'CLLCT004' | &DSN = 'CLLCT005'
         | &DSN = 'CLLCT006' | &DSN = 'CLLCT007' | &DSN = 'CLLCT008'
         | &DSN = 'CLLCT009')          /* For the collections which
                                          do not allow overrides     */
       SET &STORCLAS = 'OLIBRARY'      /* Set the storage class to the
                                          desired value for these
                                          collections                */
     OTHERWISE                         /* Otherwise the collection name
                                          is invalid                 */
       EXIT CODE(10)                   /* Indicate that an error
                                          occurred                   */
     END                               /* Select                     */
   ELSE                                /* If the object name is
                                          specified (i.e. indicating
                                          an invocation for the
                                          specific collection)       */
     SELECT
     WHEN (&DSN = 'CLLCT010' | &DSN = 'CLLCT011' | &DSN = 'CLLCT012'
         | &DSN = 'CLLCT013' | &DSN = 'CLLCT014' | &DSN = 'CLLCT015'
         | &DSN = 'CLLCT016' | &DSN = 'CLLCT017' | &DSN = 'CLLCT018'
         | &DSN = 'CLLCT019')          /* For the collections which
                                          allow overrides            */
       IF &STORCLAS ¬= 'OLIBRARY' THEN /* If the storage class
                                          specified is not the one
                                          explicit storage class value
                                          that is considered valid
                                          for these collections      */
         SET &STORCLAS = 'DB2DASD'     /* Set the storage class to the
                                          desired value for these
                                          collections                */
     WHEN (&DSN = 'CLLCT000' | &DSN = 'CLLCT001' | &DSN = 'CLLCT002'
         | &DSN = 'CLLCT003' | &DSN = 'CLLCT004' | &DSN = 'CLLCT005'
         | &DSN = 'CLLCT006' | &DSN = 'CLLCT007' | &DSN = 'CLLCT008'
         | &DSN = 'CLLCT009')          /* For the collections which
                                          do not allow overrides     */
       IF &MEMN = *.*.*.*.DZX THEN     /* If the object name contains
                                          a value indicating that this
                                          object should be treated
                                          differently than the
                                          other objects in these
                                          collections                */
         SET &STORCLAS = 'DB2DASD'     /* Set the storage class to the
                                          desired value for these
                                          objects that are treated
                                          differently                */
       ELSE                            /* Otherwise there is nothing
                                          special about this object
                                          name                       */
         SET &STORCLAS = 'OLIBRARY'    /* Set the storage class to the
                                          desired value for the objects
                                          in these collections       */
     OTHERWISE                         /* Otherwise the collection name
                                          is invalid                 */
       EXIT CODE(11)                   /* Indicate that an error
                                          occurred                   */
     END                               /* Select                     */

/*********************************************************************/
/* CHANGE                                                            */
/*********************************************************************/
 IF &ACSENVIR = 'CHANGE' THEN          /* Object is being changed    */
   IF &STORCLAS ¬= 'DB2DASD'  AND
      &STORCLAS ¬= 'OLIBRARY' AND
      &STORCLAS ¬= 'TAPESC'  THEN      /* If the storage class specified
                                          is not a storage class that
                                          is considered valid        */
        EXIT CODE(12)                  /* Indicate that an error
                                          occurred                   */
/*********************************************************************/
/* CLASS TRANSITION                                                  */
/*********************************************************************/
 IF &ACSENVIR = 'CTRANS' THEN          /* Object is being processed
                                          as a result of a class
                                          transition                 */
   SELECT (&STORCLAS)

   WHEN ('DB2DASD')                    /* If current storage class
                                          indicates that object is on
                                          DASD                       */
     SET &STORCLAS = 'OLIBRARY'        /* Set storage class to indicate
                                          that the object should reside
                                          on optical                 */
   WHEN ('OLIBRARY')                   /* If current storage class
                                          indicates that object is on
                                          optical                    */
     SET &STORCLAS = 'TAPESC'          /* Set storage class to indicate
                                          that the object should reside
                                          on tape                    */

   OTHERWISE                           /* Otherwise the storage class
                                          is invalid                 */
     EXIT CODE(13)                     /* Indicate that an error
                                          occurred                   */
   END
END