Previous Topic: Optional Operands (Format 1)Next Topic: Required Operands (Format 3)


Keyword Operands (Format 2)

Use this GROUP clause format to describe a group of keyword-type operands that you must specify in a predefined order.


label GROUP TYPE=KEYWORD                                {-}
            [{,OCCURS=nnn|REPEATS}]

The TYPE=KEYWORD verbs in the model require you to enter the appropriate keyword followed by the keyword value.

For an example of how to use the format 2 GROUP clause, see the PURGE model. A portion of the PURGE model follows:


      COMMAND PURGE
 
         FORMAT CLASS=G
            OPERAND LIST=((VUR,7,TRAN=VUR,            -
                           SPOOLOPT=(RDR,PRT,PUN,     -
                           DEVNONLY,SELECT)),         -
                         (ALL,3,TRAN=ALLURDEV,        -
                          SPOOLOPT=(SELECT,ALL)))
            OPERAND GROUP=WHAT
         FORMAT END
 
     WHAT   GROUP TYPE=OPTIONAL,REPEATS
               OPERAND GROUP=CLASS
               OPERAND GROUP=FORM
               OPERAND GROUP=SPOOL
               OPERAND GROUP=ALL
            GROUP END
 
->    CLASS  GROUP TYPE=KEYWORD
               OPERAND CLASS,2
               OPERAND C,1,TRAN=CLASS,SPOOLOPT=SELECT
            GROUP END
 
->    FORM   GROUP TYPE=KEYWORD
               OPERAND FORM,4
               OPERAND FORMNUM,8,TRAN=FORM,SPOOLOPT=SELECT
            GROUP END
 
     SPOOL  GROUP TYPE=OPTIONAL
               OPERAND SPOOLID,4,TRAN=SPOOL,SPOOLOPT=SELECT
            GROUP END
 
     ALL    GROUP TYPE=OPTIONAL
               OPERAND ALL,3,TRAN=ALLSPFIL,           -
                  SPOOLOPT=SELECT,TYPE=DEFAULT
            GROUP END
 
      COMMAND END

Examine the GROUP clauses for the CLASS and FORM groups in the above example. According to this model, a class G user can PURGE files that are assigned to a particular CLASS, FORM, or a combination of CLASS and FORM.

For example:

PURGE RDR CLASS A

Purges all RDR files that have CLASS=A

PURGE RDR FORM STD1

Purges all RDR files that have FORM=STD1

PURGE RDR FORM STD1 CLASS A

Purges all RDR files that have CLASS=A and FORM=STD1.

Differences Between REPEATS and OCCURS

The GROUP TYPE=KEYWORD clause accepts the OCCURS verb that indicates you can specify the entire group of operands a definite number of times in a single command. Refer to the supplied SPOOL model for an example of how to use OCCURS.

The difference between REPEATS and OCCURS is that REPEATS means operands in this group can replicate themselves an infinite number of times, limited only by the actual size of the command buffer. OCCURS means operands in the group replicate themselves a fixed number of times.

Command limiting treats iterations of a command with a REPEATS definition as if they were separate commands. For example, assume you have four files in your virtual printer queue with spool IDs of 0091, 0092, 0093, and 0094. If you issue the PUR PRT 91 92 93 94 command, the spool ID is defined as a repeating operand. CP and command limiting would process the command as:

PUR PRT 91
PUR PRT 92
PUR PRT 93
PUR PRT 94

Command limiting does not treat iterations of OCCURS as multiple commands. For example, you can specify the CHARS operand on the SPOOL command up to four times:

SP PRT TO PSF CL P FO 010110 CHARS MONO CHARS TEXT CHARS CE12
CHARS PT24 646X

In the PURGE command above, each iteration is treated as a separate command and each iteration is compared against the entire rule set. The SPOOL command is only compared against the rule set once, but all combinations of each iteration of the CHARS operand are used against the qualifying rule entry.