Your Browser is not longer supported

Please use Google Chrome, Mozilla Firefox or Microsoft Edge to view the page correctly
Loading...

{{viewport.spaceProperty.prod}}

Example 2: Modifying the access conditions

The conditions specified in example 1 have changed as follows:

  1. ANNE is on vacation from October 15 to November 15, 2017. She is not permitted to access files during this period.

  2. MARY has changed her working days to Monday, Tuesday and Wednesday.

  3. The review planned for September 3/4 has been postponed until September 07/08.

TEST-GUA, the guard created in example 1, is to be adapted to suit new circumstances.

Solution

 *        **************************************************************
 *        * ---------------------------------------------------------- *
 *        *                                                            *
 *        * MODSAC macro: Change access conditions                     *
 *        * =========================================                  *
 *        *                                                            *
 *        * ---------------------------------------------------------- *
 *        **************************************************************
 *

GUA2     CSECT
 *
 *        **************************************************************
 *        * ---------------------------------------------------------- *
 *        * MOVE macro                                                 *
 *        * ==========                                                 *
 *        * Task:    Move PARMACL parameter area to PARMACC.           *
 *        * Purpose: This macro initializes the PARMACC parameter area *
 *        *          to be passed in register 1 before each call of    *
 *        *          the MODSAC macro.                                 *
 *        * ---------------------------------------------------------- *
 *        **************************************************************
 *
 MACRO
         MOVE
         LA    R@TO,PARMACC
         LA    R@TOL,PROY#
         LA    R@FR,PARMACL
         LA    R@FRL,PROY#
         ICM   R@FRL,8,=C' '
          MVCL  R@TO,R@FR
         MEND
 *
 *        **************************************************************
 *
 R@TO     EQU   6               Destination address
 R@TOL    EQU   7               Destination field address
 R@FR     EQU   8               Source address
 R@FRL    EQU   9               Source field length/fillers
 R@BASE   EQU   10              Base register
          BALR  R@BASE,0
          USING *,R@BASE
 *







 *        **************************************************************
 *        * 1. ANNE is on vacation from October 15 to November 15,     *
 *        *    2017. She is not permitted to access files during       *
 *        *    this period.                                            *
 *        **************************************************************
 *
          MOVE                                  Parameter initialization
          MODSAC MF=M,                                                  -
                ACTION=*MODIFY,                                         -
                GUARD='TEST-GUA',                                       -
                SUBTYPE=*USER,                                          -
                SUBIDS=('ANNE    '),                                    -
                ADMISS=*PARAMS,                                         -
                CKDATE=*EXCLUSION,                                      -
                DATEN=1,                                                -
                DATE#1=('2017-10-15','2017-11-15')
         MODSAC MF=E,PARAM=PARMACC
          CLC   PROYMRET,=Y(PROPSUCC)
          BNE   RCNOTOK
 *
 *        **************************************************************
 *        * 2. MARY has changed her working days to Monday, Tuesday    *
 *        *    and Wednesday.                                          *
 *        **************************************************************
 *
          MOVE                                  Parameter initialization
          MODSAC MF=M,                                                  -
                ACTION=*MODIFY,                                         -
                GUARD='TEST-GUA',                                       -
                SUBTYPE=*USER,                                          -
                SUBIDS='MARY    ',                                      -
                ADMISS=*PARAMS,                                         -
                CKWEEK=*ADMISSION,                                      -
                MO=*YES,                                                -
                TU=*YES,                                                -
                WE=*YES
         MODSAC MF=E,PARAM=PARMACC
          CLC   PROYMRET,=Y(PROPSUCC)
          BNE   RCNOTOK
 *







 *        **************************************************************
 *        * 3. The review planned for September 2/3 has been           *
 *        *    postponed until September 09/10.                        *
 *        *                                                            *
 *        * Note:                                                      *
 *        * The value for DATE#1 must be specified because the DATE    *
 *        * access conditions can only be changed as a whole. It is    *
 *        * not possible to change individual date intervals.          *
 *        **************************************************************
 *
          MOVE                                  Parameter initialization
          MODSAC MF=M,                                                  -
                ACTION=*MODIFY,                                         -
                GUARD='TEST-GUA',                                       -
                SUBTYPE=*GROUP,                                         -
                SUBIDS=('TEAMWORK','REVIEWER'),                         -
                ADMISS=*PARAMS,                                         -
                CKDATE=*ADMISSION,                                      -
                DATEN=2,                                                -
                DATE#1=('2017-08-23','2017-08-24'),                     -
                DATE#2=('2017-09-09','2017-09-10')
         MODSAC MF=E,PARAM=PARMACC
          CLC   PROYMRET,=Y(PROPSUCC)
         BNE   RCNOTOK
 *
         BE    ENDE
 *
 *        **************************************************************
 *        * Error recovery
 *        **************************************************************
 *
 RCNOTOK  EQU   *
 *        The possible return code values are listed in the MSGGUAD
 *        macro
         B     ENDE
 *
 ENDE     EQU   *
         TERM
 *
 *
 *







 *        **************************************************************
 *        *------------------------------------------------------------*
 *        * Parameter declarations                                     *
 *        *------------------------------------------------------------*
 *        **************************************************************
 *
 *        This parameter area is passed in register 1 when the MODSAC 
 *        macro is called.
 *
 PARMACC  DS    0F
         MODSAC MF=C
 *
 *        This parameter area is used in order to initialize the
 *        PARMACC parameter area before the MODSAC macro is called.
 *
 PARMACL  DS    0F
          MODSAC MF=L,                                                  -
                ACTION=*MODIFY,                                         -
                GUARD='                                        '
 *
 *        **************************************************************
 *        *------------------------------------------------------------*
 *        * Declarations of the return codes                           *
 *        *------------------------------------------------------------*
 *        **************************************************************
 *
         MSGGUAD MF=D
 *
 *        **************************************************************
 *        *------------------------------------------------------------*
 *        * Declarations of global variables                           *
 *        *------------------------------------------------------------*
 *        **************************************************************
 *
         SACMGMT MF=D,XPAND=PARAM
 *
         END


Result

After the execution of the program, the changed TEST-GUA guard has the following contents:

:PUB1:$TESTUID.TEST-GUA
   User   ANNE
    Date      EX ( <2017-10-15,2017-11-15> )
   User   JOHN     has ADMISSION
   User   MARY
    Weekday   IN ( MO, TU, WE )
   User   PAUL
    Date      IN ( <2017-07-01,2017-09-30> )
   Group  REVIEWER
    Time      IN ( <09:00,15:00> )
    Date      IN ( <2017-08-23,2017-08-24> ,
                   <2017-09-09,2017-09-10> )
   Group  TEAMWORK
    Time      IN ( <09:00,15:00> )
    Date      IN ( <2017-08-23,2017-08-24> ,
                   <2017-09-09,2017-09-10> )
   Alluser
    Time      IN ( <07:00,19:00> )
    Weekday   EX ( SA, SU )