Previous Topic: Using the DISPLAY statementNext Topic: Using the Mapping Compiler and Mapping Utility


Using the PUNCH Statement

Used for Batch Migration

The PUNCH statement of the schema, subschema, and DDDL compilers and command facility is useful for batch migrations. If you perform the migration in batch mode, the PUNCH statement allows you to migrate larger volumes of information. It also allows you to migrate between dictionaries under the control of different DC/UCF systems.

Writes Information to File or Module

The PUNCH statement has the same options as the DISPLAY statement. However, it writes the requested information to one of two destinations: an external file or an IDD module.

Use Files or Modules to Accumulate Large Numbers of Components

The file or module provides an intermediate place to store the information you want to migrate. As a result, you can:

Technique 1

This technique is very similar to the technique for the DISPLAY statement described above. Because it occurs in batch, however, you can migrate larger volumes of information.

Steps

The steps in this technique follow:

  1. In the first execution of the compiler, sign on to the source dictionary in batch mode and punch the individual components to an external file.

    In the PUNCH statement, use the AS SYNTAX clause. In addition, specify VERB MOD if you are migrating existing components. Define the file as SYSPCH in the JCL.

    To avoid having to specify these clauses in every PUNCH statement, you can issue a SET OPTIONS statement before the PUNCH statements:

    set options display as syntax verb mod.
    
  2. When the job ends, edit the external file as follows:

Technique 2

With this technique, you create a dictionary module in the source dictionary to hold the components you want to migrate. You migrate the module to the target dictionary, extract the ADD or MODIFY statements for the individual components, and store or modify each of the components in the target dictionary.

Steps

The steps in this technique follow:

  1. In batch or online mode, sign on to the source dictionary and create a module occurrence to hold the components to be moved. For example:
    add module holdit.
    
  2. While signed on to the source dictionary, punch the components to be moved into the module using the TO MODULE and AS SYNTAX clauses:
    punch element emp-last-name
      to module holdit
      as syntax.
    

    The module source for HOLDIT now consists of the ADD ELEMENT EMP-LAST_NAME statement.

    You can perform this step in batch or online mode, and you can punch more than one component to the module. If you use the SET OPTIONS statement following signon, your input appears as follows:

    set options input 1 thru 80
                default is on
                punch to module holdit
                as syntax.
    punch element emp-last-name.
     .
     .
     .
    

    This statement automatically changes an ADD to MODIFY if the entity already exists in the dictionary and punches the entity as syntax.

  3. In batch mode, sign on to the source dictionary and punch the module to an external file.

    The input to the compiler consists of only two statements: a SIGNON statement for the source dictionary and a PUNCH statement for the module. In the PUNCH statement, use the AS SYNTAX and TO SYSPCH clauses. Also, be sure to define the file as SYSPCH in the JCL.

    At the end of this step, the external file contains only one statement: an ADD/MODIFY MODULE statement. Within the MODULE statement, however, the module source consists of the ADD or MODIFY statement for the individual components that you want to migrate.

  4. Edit the external file as follows:

    As a result of the editing, the external file contains four statements:

    For example:

      signon user dba password pass dictname target.
      set option input 1 thru 80.
    add module holdit
     .
     .
     .
    module source follows
    add element emp-last-name
      version is 1
      pic is x(20)
     .
     .
     .
    msend.
    include module holdit.
    
  5. Execute the compiler in batch mode, using the edited file as input.

    The compiler signs on to the target dictionary and adds or modifies the module. The INCLUDE statement brings the module source into the compiler's work file. The content adds or modifies the individual components to the target dictionary.

Final Tasks for Schemas and Load Modules

As with the DISPLAY statement, the PUNCH statement does not automatically validate the schemas or generate the load modules for subschemas and edit/code tables. To perform these function, use one of the methods described earlier in 26.6.1, "Using the DISPLAY statement".

Technique 3

This technique combines parts of the Technique 2 presented above and parts of the online DISPLAY technique described earlier in 26.6.1, "Using the DISPLAY statement". Because this technique entails an online migration, you need to moderate the volume of information you punch.

The steps in this technique follow:

  1. In online mode, sign on to the source dictionary and create a module occurrence to hold the components to be moved.
  2. While signed on to the source dictionary, punch the components to be moved to the module.

    As above, direct the output of the punch to the module by including the TO MODULE clause in each PUNCH statement or in a SET OPTIONS statement. Also, specify the AS SYNTAX clause and the VERB ADD or VERB MODIFY clause, as appropriate.

  3. Clear the compiler's work file.
  4. Display the module.

    This step brings the module (with all of its source) into the compiler's work file. In the DISPLAY statement, use the AS SYNTAX clause.

  5. Edit the work file as follows:

    This step prepares the work file for the task of compiling the module and then the components into the target dictionary. As a result of the editing, the work file contains three statements:

  6. Invoke the compiler

    The compiler signs on to the target dictionary and adds or modifies the module. The INCLUDE statement brings the module source into the compiler's work file and executes the content of the work file. The content adds or modifies the individual components to the target dictionary.

Final Steps for Schemas and Load Modules

As with the other techniques, this technique does not automatically validate schemas or generate load modules for subschemas and edit/code tables. To perform these functions, use one of the methods described earlier in 26.6.1, "Using the DISPLAY statement".