BEGIN-END Rule definition processing

The BEGIN function directs Advanced Allocation Management to perform applicable actions for a matched rule definition and then move to the nested Rule definition for additional matching. The scope of BEGIN ends with the function END.

Nested logic is included between BEGIN and END. BEGIN starts the scope and END ends the scope.

Functions are set for BEGIN with the rules similar to CONTINUE=ENABLE, except:
  • If the Selection criteria is not satisfied, CONTINUE=ENABLE moves to next Rule definition.

    Whereas in the case of BEGIN, it moves to the Rule definition after the END.

Syntax

Read syntax diagramSkip visual syntax diagramBEGINEND

Environments

ACS, ALLOCATE, CATCHECK, EXTEND, STOW, and UNALLOCATE

Example 1:

* RULE DEFINITIONS                                                     
DEFAULTS                                  * REQUIRED                   
        SET_PQTY=4                                                     
INCLUDE JOBNAME=JJHTEST1                  * INCLUDE OR EXCLUDE
        JOBTYPE=JOB                       * JOB TYPE          
        BEGIN                                                 
INCLUDE STEPNAME=CREATE1                                      
        BEGIN                                                 
INCLUDE DSNAME=Q1.Q2.*                                 
        SET_PQTY=6      
INCLUDE DSNAME=Q1.Q3.*
        SET_PQTY=7                                      
        END                        
        END                        

The following behavior occurs using the rule definition:

  1. For JCL with Jobname : JJHTEST1, 
    Stepname : CREATE1 is submitted to allocate Q1.Q2.Q3
    Output : 
      Data set : Q1.Q2.Q3 is allocated with Primary quantity    : 6
    
  2. For JCL with Jobname : JJHTEST1, 
    Stepname : CREATE1 is submitted to allocate Q1.Q3.A3 
    Output : 
      Data set : Q1.Q3.A3 is allocated with Primary quantity    : 7
  3. For JCL with Jobname : JJHTEST1, 
    Stepname : CREATE1 is submitted to allocate A1.A2.A3 
    Output : 
      Data set : A1.A2.A3 is allocated with Primary quantity    : 4
  4. For JCL with Jobname : JJHTEST1, 
    Stepname : CREATE2 is submitted to allocate Q1.Q2.Q3
    Output : 
      Data set : Q1.Q2.Q3 is allocated with Primary quantity    : 4
    

Example 2:

* RULE DEFINITIONS                                                     
DEFAULTS                                  * REQUIRED                   
        SET_PQTY=4                                                     
INCLUDE JOBNAME=JJHTEST1                  * INCLUDE OR EXCLUDE
        JOBTYPE=JOB                       * JOB TYPE          
        BEGIN                                                 
INCLUDE STEPNAME=CREATE1                                      
        BEGIN                                                 
INCLUDE DSNAME=Q1.Q2.*                                 
        SET_PQTY=6      
INCLUDE DSNAME=Q1.Q3.*
        SET_PQTY=7   
        CONTINUE=ENABLE                                   
        END                        
        END                        
INCLUDE DSNAME=Q1.Q3.QA
SET_PQTY=8

The following behavior occurs using the rule definition:

  1. For JCL with Jobname : JJHTEST1, 
    Stepname : CREATE1 is submitted to allocate Q1.Q3.QA
    Output :
      Data set : Q1.Q3.QA is allocated with Primary quantity    : 8
    

Example 3:

* RULE DEFINITIONS                                                               
DEFAULTS MESSAGES=ENABLE   * 
         MSG_LEVEL=ALL       
         MSG_DEST=BOTH       
         SET_PQTY=3          
INCLUDE  JOBNAME=JJTESTP*    
         JOBTYPE=JOB         
         SET_PQTY=4          
         SET_EXPDATE=2024012 
         BEGIN               
*                            
EXCLUDE  JOBNAME=JJTESTP2      ---- Line number 10
         JOBTYPE=JOB         
         SET_PQTY=7          
INCLUDE  JOBNAME=JJTESTP3    
         JOBTYPE=JOB         
         SET_PQTY=8          
         END

The following behavior occurs using the rule definition:

  1. For JCL with Jobname : JJTESTP2 is submitted to allocate Q1.Q2.D1
    Output : 
      Data set : Q1.Q2.D1 is allocated with 
      Primary quantity    : 4 and 
      Expiration data : 2024/01/12  
    
    Note: In the job log,it shows as INCLUDE with Line number corresponding to EXCLUDE as this EXCLUDE is part of the INCLUDE- 
    as shown in GLO2188I MATCHING INCLUDE RULEDEF LINE NUMBER = 10”
  2. For JCL with Jobname : JJTESTP3 is submitted to allocate Q1.Q2.D2
    Output : 
      Data set : Q1.Q2.D2 is allocated with 
      Primary quantity    : 8 and   
      Expiration data : 2024/01/12
  3. For JCL with Jobname : JJTESTP4 is submitted to allocate Q1.Q2.D3
    Output : 
      Data set : Q1.Q2.D3 is allocated with 
      Primary quantity    : 4 and   
      Expiration data : 2024/01/12
    
Note:
  1. EXCLUDE, when satisfied, will exit from the entire rule definition. EXCLUDE cannot have nested rule definitions under it. So, BEGIN cannot be given with EXCLUDE. It results in the error - “GLO4046E BEGIN NOT ALLOWED UNDER EXCLUDE” while activating the Rule definition.
  2. Maximum number of Nested BEGIN-ENDs allowed are 10. If exceeds, it results in - GLO4045E NESTED BEGIN-END EXCEEDED 10 – while activating the Rule definition.
  3. Other error messages related to BEGIN/END that can be issued while activating the Rule def: GLO4044E NUM OF END(S) EXCEEDED BEGIN(S) GLO4047E NUM OF BEGIN(S) EXCEEDED END(S)