Adding templates

You can create data set templates that are defined by the TEMPLATE utility. These templates can be used by other utilities when allocating data sets instead of JCL DD statements.

Before you begin

Before you can add a template, the TEMPLATE control table must exist in Db2® Admin Tool. For instructions on how to create this table, see Creating the TEMPLATE control table.

Procedure

To add a template:
  1. On the DB2 Administration Menu (ADB2) panel, specify option 5, and press Enter.
  2. On the Utility generation using LISTDEFs and TEMPLATEs (ADB25) panel, specify the TEMPLATE control table that you want to use to store the template definitions:
    Figure 1. Utility generation using LISTDEFs and TEMPLATEs (ADB25) panel
    ADB25 min ----- DD1A Utility generation using LISTDEFs and TEMPLATEs ---- 00:33
    Option ===>                                                                    
                                                                                   
       L - Manage LISTDEFs                                   DB2 System: DD1A      
       T - Manage TEMPLATEs                                  DB2 SQL ID: ADM001     
      TU - Specify TEMPLATE usage                                                  
                                                                                   
      CL - Create LISTDEF control table                                            
      UL - Upgrade LISTDEF control table                                           
      CT - Create TEMPLATE control table                                           
      UT - Upgrade TEMPLATE control table                                          
                                                                                   
     LISTDEF control table:                                                        
         Table owner . . . DSNACC   >                                              
         Table name  . . . UTLIST            >                                     
                                                                                   
     TEMPLATE control table:                                                       
         Table owner . . . DSNACC   >                                              
         Table name  . . . UTTEMPLATE        >    
  3. Specify option T, and press Enter.
    The TEMPLATEs (ADB25T) panel lists the existing templates defined in the specified control table:
    Figure 2. TEMPLATEs (ADB25T) panel
     DB2 Admin --------- DD1A TEMPLATEs in DSNACC.UTTEMPLATE --- Row 1 to 21 of 21  
     Command ===>                                                  Scroll ===> CSR  
                                                                                    
     Line commands: A - Add  E - Edit  D - Delete                                   
                                                                                    
     Sel   Name               Creator  Remarks                                      
           *                  *        *                                            
     ----- ------------------ -------- ---------------------------------------------
     *     COPYLOC            SYSADM                                                
           COPYREM            SYSADM                                    
     ******************************* END OF DB2 DATA *******************************
     
    The panel lists the TEMPLATE control table name in the header. In this example, the table name is DSNACC.UTTEMPLATE.
  4. Issue the A line command next to any row, and press Enter.
  5. On the Utility Template (ADB25TE) panel, complete the following fields to specify the template definition:
    Figure 3. Utility Template panel (ADB25TE)
     DB2 Admin -------------------- DD1A Utility Template -------------------- 11:20
     Command ===>                                                                   
                                                                                    
     Enter name and optional remark.  Press Enter to save.                          
                                                                                    
     TEMPLATE . . . .            (Template name)                                    
     Remark . . . . .                                                               
                                                                                   >
     Common options:                                                                
       UNIT . . . . .            (Device number, type or group name)                
       Device type  .            (DASD or TAPE, default is DASD)        
       DSN  . . . . .                                                               
                                                                   
       Change other common options  . .     (Yes/No)                                
       Change disk options  . . . . . .     (Yes/No)                                
       Change tape options  . . . . . .     (Yes/No)                                
                                                                                    
     Statement  . . . TEMPLATE                                                      
                                                                                    
                                                                                    
    Required fields
    TEMPLATE
    A name for the template. The name must be unique within the control table that you are using.
    DSN
    A data set name pattern for the template. The data set name can be composed of variables whose value is determined and substituted during execution of the utility that is using the template or execution of the job that Db2 Admin Tool generated for alter, restore, redefine, migrate, or object comparison processing that is using the template.
    To construct a data set name pattern by using substitution variables:
    1. In the DSN field, specify ?, and press Enter.
    2. On the Utility Template – Data Set Name (ADB25TD) panel, specify the characters and variables that you want to use in the data set name:
      Figure 4. Utility Template — Data Set Name panel (ADB25TD)
      DB2 Admin ------------- DD1A Utility Template - Dataset Name ----------- 11:30 
      Command===>                                                                     
                                                                                      
      Select symbolic variables or enter non-symbolic characters.  Processing for    
      this panel occurs in left to right, and top to bottom sequence.  Press ENTER   
      to process any current choices.                                                 
                                                                                      
      DSN Model . .                                                                      
                                                                                      
       Non-Symbolic characters  . .                                                   
                                                                                      
       DB2 Symbolic Variables:                                                        
                                                                                      
          JOBNAME  . . .   MVS  jobname     STEPNAME . . .   MVS step name            
          UTILID . . . .   Utility ID       SSID . . . . .   Subsystem ID             
          ICTYPE . . . .   Image Copy Type  UTILNAME . . .   Utility Name             
          SEQ  . . . . .   Sequence Number  LOCREM . . . .   IC DDN usage             
          PRIBAC . . . .   IC DDN Usage                                               
          LIST . . . . .   List Name        DB . . . . . .   Database name            
          TS . . . . . .   Table space      IS . . . . . .   Index Space              
          SN . . . . . .   Space name       PART . . . . .   Part number (5-digit)    
                                            DSNUM  . . . .   Part/piece number        
          DATE . . . . .   YYYYDDD          TIME . . . . .   HHMMSS                   
          JDATE  . . . .   YYYYDDD          YEAR . . . . .   YYYY                     
          MONTH  . . . .   MM               DAY  . . . . .   DD                       
          JDAY . . . . .   DDD              HOUR . . . . .   HH portion of time       
          MINUTE . . . .   MM portion       SECOND . . . .   SS portion of time       
                                            UNIQ . . . . .   Unique identifier        
          USERID . . . .   Batch userid                                              
                                                                                      
       DB2 Admin Symbolic Variables:                                                 
                                                                                    
          PREFIX . . . .   Data set prefix  LEVEL  . . . .   Worklist name            
          TNAME  . . . .   Table ID     

      The current template data set name pattern is displayed in the DSN Model field. Take the following actions to add to this name pattern:

      • To specify characters, type them in the Non-Symbolic characters field. Press Enter to add the characters you entered to the DSN Model field.
      • To select a symbolic variable, type any character (such as a slash) to the right of the leader dots for that variable. Press Enter to add the variable to the DSN Model field. Either one or two periods are appended to the DSN model statement as needed. The first period marks the end of the variable name, not the end of the qualifier. If the preceding item is a variable, two periods are required in succession to begin a new name segment (qualifier). The first period marks the end of the variable, and the second period marks the beginning of the next qualifier.

        The variable names are appended to the data set name template in left-to-right and top-to-bottom order each time Enter is pressed. To append an earlier variable after a later variable, first select the later variable and press Enter; then append the earlier variable.

      • To specify any additional variables that are not listed, use the Non-Symbolic characters field or type them directly into the DSN Model field.
      Recommendation: Although it is permissible to enter variables in the DSN model field by simply typing in the variables, use the panel fields to avoid spelling errors.
      Restriction: Not all the symbolic variables that are listed are valid variables for the data set name pattern for the templates for Db2 Admin Tool work data sets for alter, restore, redefine, migrate and object comparison processing, and additional variables might apply. (Any variable displayed is valid for the data set name pattern for a utility data set template.)
    3. Verify that the data set name in the DSN Model field contains the appropriate number of periods. Also, for variables that will return numeric characters, ensure that an alphabetic character (A to Z) or national character (# @ $) precedes the variable if it begins a qualifier. Type directly in the DSN Model field to make any changes.
    4. When you are done specifying the data set naming patter, exit back (PF3) to the Utility Template (ADB25TE) panel.
    Example data set naming patterns:
    • &JOBNAME..&STEPNAME. displays two variables in succession. If the preceding item is a non-symbolic character and not a variable, only one period is used.
    • In the example &JOBNAME.DSNCOPY, no period follows DSNCOPY because it is the last qualifier and it is not a variable.
    • In the example &USERID..D&DAY..M&MONTH..&DB(3,4)., an alphabetic character precedes the variables DAY and MONTH because they return numeric characters. The use of substring notation on variables enables limiting the number of characters that are returned. Here, only four characters of the database name, starting at the third character, are returned.

    The example in the following figure shows a partially completed DSN model statement. The non-symbolic TEST is about to be appended, followed by the jobname substitution variable.

    Figure 5. Utility Template — Data Set Name example (ADB25TD) partial panel
    ADB25TD n ------------- DD1A Utility Template - Data Set Name ----------- 11:32
    Command===>                                                                    
                                                                                   
    Select symbolic variables or enter non-symbolic characters.  Processing for    
    this panel occurs in left to right, and top to bottom sequence.  Press ENTER   
    to process any current choices.                                                 
                                                                                   
    DSN Model . .  &DB..&TS..&UTILID..D&DATE..H&HOUR.&MINUTE.
                                                                                   
     Non-Symbolic characters  . . TEST                                           
                                                                                   
     DB2 Symbolic Variables:                                                       
                                                                                   
       JOBNAME  . . . S MVS  jobname     STEPNAME . . .   MVS step name            
       UTILID . . . .   Utility ID       SSID . . . . .   Subsystem ID             
    	.
    	. 
    	.
    
    Optional fields
    UNIT
    The device number or group name for the data set.
    Device type
    The device type for the data set.
    Change other common options
    Additional attributes for the data set. When you specify Yes and press Enter, the Template Common Options (ADB25TC) panel is displayed, as shown in the following figure. Specify the options that you want. For help with the fields on this panel, see the online help (PF1).
    Figure 6. Template Common Options (ADB25TC) panel
     DB2 Admin ----------------- DD1A Template Common Options --------------- 11:21
     Command ===>                                                                  
                                                                                   
                                                                                   
       MODELDCB . . .                                                                
       BUFNO  . . . .            (Number of BSAM buffers)                            
       DATACLAS . . .            (SMS Data class)                                    
       MGMTCLAS . . .            (SMS Management class)                              
       STORCLAS . . .            (SMS Storage class)                                 
       RETPD  . . . .        or   EXPDL . . .                                        
       VOLUMES( . . .                                                >  )            
       VOLCNT . . . .            (Volume Count)                                      
       GDGLIMIT . . .            (GDG Limit)                                         
       DISP(  . . . .     ,          ,          )   
    Change disk options
    Additional options for the data set that are applicable only to data sets that are on disk. When you specify Yes and press Enter, the Template Disk Options (ADB25TS) panel is displayed, as shown in the following figure. Specify the disk options that you want. For help with the fields on this panel, see the online help (PF1).
    Figure 7. Template Disk Options (ADB25TS) panel
     DB2 Admin ------------------ DD1A Template Disk Options ----------------- 11:22
     Command ===>                                                                   
                                                                                    
                                                                                    
       SPACE( . . . .         ,        ) (Primary, Secondary)                       
                  . .            (CYL, TRK, MB)                                    
       PCTPRIME . . .            (Percentage of space obtained as primary)          
       MAXPRIME . . .            (Maximum allowable primary space allocation)       
       NBRSECND . . .            (Number of secondary allocation divisions)
       DSNTYPE  . . .            (LARGE, LIBRARY, HFS, PDS, NULL) 
    
    Change tape options
    Additional options for the data set that are applicable only for data sets on tape. When you specify Yes and press Enter, the Template Tape Options (ADB25TT) panel is displayed, as shown in the following figure. Specify the tape options that you want. For help with the fields on this panel, see the online help (PF1).
    Figure 8. Template Tape Options (ADB25TT) panel
     DB2 Admin ------------------ DD1A Template Tape Options ----------------- 11:23
     Command ===>                                                                   
                                                                                    
                                                                                    
       UNCNT  . . . .            (Number of devices to allocate)                    
       STACK  . . . .            (Yes/No, Stack on same tape volumes)               
       JES3DD . . . .            (JES3 DDname for tape allocation)                  
       TRTCH  . . . .            (Track recording technique - NONE COMP or NOCOMP)  
  6. Press Enter.
    The template is added to the TEMPLATE control tables and is available for use.