In a guard called TEST-GUA, which previously did not exist, the following file access authorization is to be specified for a working team:
Staff members ANNE and JOHN are to be permitted to access files without any specific restrictions.
Staff member MARY is part-time. Accordingly, she is only permitted to access files on Monday, Wednesday and Thursday, her working days.
Contract worker PAUL is under contract from July 1, 2017 to September 30, 2017 and is authorized to access files during this time.
ANNE, JOHN, MARY and PAUL have been grouped together by the system administrator in the WORKTEAM user group, which also has other group members. The REVIEWER user group is a team that carries out reviews.
For the duration of a review, it is necessary for all the members of the TEAMWORK group and the REVIEWER group to have access authorization.
The reviews have been set for the following dates:
August 23/24, 2017 from 09:00 to 15:00 hours
September 02/03, 2017 from 09:00 to 15:00 hours
All those with access authorizatoin are subject to the additional rule that file access is not permitted outside official working hours (Monday to Friday from 07:00 to 19:00).
Solution
* **************************************************************
* * ---------------------------------------------------------- *
* * *
* * MODSAC macro: Add access conditions *
* * ============================================= *
* * *
* * ---------------------------------------------------------- *
* **************************************************************
*
GUA1 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 length
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. Staff members ANNE and JOHN are to be permitted to *
* * access files without any specific restrictions. *
* **************************************************************
*
MOVE Parameter initialization
MODSAC MF=M, -
ACTION=*ADD, -
GUARD='TEST-GUA', -
SUBTYPE=*USER, -
SUBIDS=('ANNE ','JOHN '), -
ADMISS=*YES
MODSAC MF=E,PARAM=PARMACC
CLC PROYMRET,=Y(PROPSUCC)
BNE RCNOTOK
*
* **************************************************************
* * 2. Staff member MARY is part-time. Accordingly, she is *
* * only permitted to access files on Monday, Wednesday *
* * and Thursday, her working days. *
* **************************************************************
*
MOVE Parameter initialization
MODSAC MF=M, -
ACTION=*ADD, -
GUARD='TEST-GUA', -
SUBTYPE=*USER, -
SUBIDS='MARY ', -
ADMISS=*PARAMS, -
CKWEEK=*ADMISSION, -
MO=*YES, -
WE=*YES, -
TH=*YES
MODSAC MF=E,PARAM=PARMACC
CLC PROYMRET,=Y(PROPSUCC)
BNE RCNOTOK
*
* **************************************************************
* * 3. Contract worker PAUL is under contract from July 1, *
* * 2017 to September 30, 2017 and is authorized to access *
* * files during this time. *
* **************************************************************
*
MOVE Parameter initialization
MODSAC MF=M, -
ACTION=*ADD, -
GUARD='TEST-GUA', -
SUBTYPE=*USER, -
SUBIDS='PAUL ', -
ADMISS=*PARAMS, -
CKDATE=*ADMISSION, -
DATEN=1, -
DATE#1=('2017-07-01','2017-09-30')
MODSAC MF=E,PARAM=PARMACC
CLC PROYMRET,=Y(PROPSUCC)
BNE RCNOTOK
*
* **************************************************************
* * 4. For the duration of a review, it is necessary for all *
* * the members of the TEAMWORK group and the REVIEWER *
* * group to have access authorization. *
* * The reviews have been set for the following dates: *
* * August 23/24, 2017 from 09:00 to 15:00 hours *
* * September 02/03, 2017 from 09:00 to 15:00 hours *
* **************************************************************
*
MOVE Parameter initialization
MODSAC MF=M, -
ACTION=*ADD, -
GUARD='TEST-GUA', -
SUBTYPE=*GROUP, -
SUBIDS=('TEAMWORK','REVIEWER'), -
ADMISS=*PARAMS, -
CKTIME=*ADMISSION, -
TIMEN=1, -
TIME#1=('09:00','15:00'), -
CKDATE=*ADMISSION, -
DATEN=2, -
DATE#1=('2017-08-23','2017-08-24'), -
DATE#2=('2017-09-02','2017-09-03')
MODSAC MF=E,PARAM=PARMACC
CLC PROYMRET,=Y(PROPSUCC)
BNE RCNOTOK
*
* **************************************************************
* * 5. All those with access authorization are subject to *
* * the additional rule that file access is not permitted *
* * outside official working hours (Monday to Friday from *
* * 07:00 to 19:00). *
* **************************************************************
*
MOVE Parameter initialization
MODSAC MF=M, -
ACTION=*ADD, -
GUARD='TEST-GUA', -
SUBTYPE=*ALLUSER, -
ADMISS=*PARAMS, -
CKTIME=*ADMISSION, -
TIMEN=1, -
TIME#1=('07:00','19:00'), -
CKWEEK=*EXCLUSION, -
SA=*YES, -
SU=*YES
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 to initialize the PARMACC
* parameter area before the MODSAC macro is called.
*
PARMACL DS 0F
MODSAC MF=L, -
ACTION=*ADD, -
GUARD=' '*
* **************************************************************
* *------------------------------------------------------------*
* * Declarations of the return codes *
* *------------------------------------------------------------*
* **************************************************************
*
MSGGUAD MF=D
*
* **************************************************************
* *------------------------------------------------------------*
* * Declarations of global variables *
* *------------------------------------------------------------*
* **************************************************************
*
SACMGMT MF=D,XPAND=PARAM
*
END
Result
After execution of the program the TEST-GUA guard generated has the following contents:
:PUB1:$TESTUID.TEST-GUA
User ANNE has ADMISSION
User JOHN has ADMISSION
User MARY
Weekday IN ( MO, WE, TH )
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-02,2017-09-03> )
Group TEAMWORK
Time IN ( <09:00,15:00> )
Date IN ( <2017-08-23,2017-08-24> ,
<2017-09-02,2017-09-03> )
Alluser
Time IN ( <07:00,19:00> )
Weekday EX ( SA, SU )