Rules for the TEMPLATE keyword for Definition specifications:

  1. When the TEMPLATE keyword is specified for a definition, the template name and the subfields of the template name can be used only in the following ways
  2. The INZ keyword is allowed for template data structures. This allows you to set an initialization value to be used with LIKEDS definitions of the template, through the INZ(*LIKEDS) keyword.
Figure 152. : Examples of TEMPLATE definitions

 * Define a template for the type of a NAME
D standardName    S            100A   VARYING TEMPLATE        
                                           
 * Define a template for the type of an EMPLOYEE
D employee_type   DS                  QUALIFIED TEMPLATE INZ  
D   name                              LIKE(standardName)         
D                                     INZ('** UNKNOWN **')    
D   idNum                       10I 0 INZ(0)
D   type                         1A   INZ('R')                
D   years                        5I 0 INZ(-1)

 * Define a variable like the employee type, initialized 
 * with the default value of the employee type
D employee        DS                  LIKEDS(employee_type)   
D                                     INZ(*LIKEDS)            

 * Define prototypes using the template definitions
 *
 * The "id" parameter is defined like a subfield of a
 * template data structure.
D getName         PR                  LIKE(standardName)
D   idNum           
D findEmp         PR              N    
D   emp                               LIKEDS(employee_type)
D   id                                LIKE(employee_type.idNum)
D                                     CONST




[ Top of Page | Previous Page | Next Page | Contents | Index ]