RC/Migrator : How do I create/add the DCLGEN Utility to a model to ONLY generate the DCLGEN in a migration?
search cancel

RC/Migrator : How do I create/add the DCLGEN Utility to a model to ONLY generate the DCLGEN in a migration?

book

Article ID: 54817

calendar_today

Updated On:

Products

RC Compare for DB2 for z/OS RC/Migrator for DB2 for z/OS

Issue/Introduction

How to create a model ID within the RC/Migrator product that will generate a DCLGEN for a table. When the DCLGEN utility is referenced in a Migration strategy, only the DCLGEN text should be displayed and not the DDL for the migration objects.

 

Environment

Release: R20
Component: RCM

Resolution

The DCLGEN utility can be added to an existing model ID. If desired, a new model ID with only the DCLGEN utility can be created. If changing an existing model, be aware that these changes may impact other users who are using the model. Templating an existing model would be an alternate method. Access to Model Services with the appropriate authority is required to add/change Model Services. Any changes to default models will not be reflected in later releases in the altered models and therefore, customization becomes the users responsibility.

To add the DCLGEN utility to an existing model ID, perform the following steps:

  1. Access the Model Services screen, using the 0 - Profile option then 6 - Utility Model Services

  2. Enter U (update) next to the model ID name you want to change, and press Enter.

  3. Enter I (insert) in the CMD field to insert a blank line.

  4. In the blank line, enter the following:

    • DCLGEN in the Utility field

    • T in the OB (Object) field

    • "Generated Declarations" in the Description field (no quotes)

    • Set SIZE to the desired setting.
  5. Press Enter. The line is inserted. 

  6. Enter an "E" in the CMD column next to the new DCLGEN line to edit the utility.
  7. Enter the commands for the utility. For example, enter the following:
    UTILITY   OBJ DESCRIPTION                SIZE
    DCLGEN    T   GENERATED DECLARATIONS     RPI

    CMD SYMBOL    ERR  REPLACEMENT VALUE
     _  DCLLIB         %USERID..HLQ1.DCLGEN1__________________________________

    #IF(%SQLPOSA) <<< the use of %SQLPOSA is used to trigger user defined models and places the generated code after all SQL and standard utilities unlike SQLPOSB and SQLPOSO.
    .CALL DSN PARM(%TOSSID)
    .DATA
    DCLGEN TABLE(%CREATOR..%OBJECT) -
    LIBRARY('%DCLLIB') -
    ACTION(ADD) -
    LANGUAGE(COB2) -
    STRUCTURE(%OBJECT)
    .ENDDATA
    #ENDIF
  8. When finished, press PF3 to end the edit session.
  9. Enter S in the CMD field beside the new utility name, and press Enter. The General Model Symbols screen appears, listing the user-defined symbolic %DCLLIB and the utility commands. This screen lets you enter the replacement values.

  10. Enter %USERID..DCLGEN.LIB in the Replacement Value field beside the symbol DCLLIB as you can see in the above example.

  11. Press PF3 (End) to save the replacement value and return to the General Model Utilities screen. The Last Update field will reflect the last action, which was entering the replacement value for the DCLLIB symbol.

  12. Press PF3 to return to the General Model Services screen. The new utility DCLGEN is saved as a part of the Model ID you updated. After the Utility is created and the DCLLIB variable updated with a value the SYM column will contain the value "Y" indicating that the utility definition contains user-defined symbols. If the SYM column has an "I" value, this indicates that the Model detects that the Utility has some sort of error and is invalid.

    These steps are outlined in the RC/Migrator manual, "Adding a DCLGEN Utility".

  13. Create the migration strategy generating the migration at the Table level.

  14. On the strategy Analysis Options screen - set all options to N and use the D (data) Exclusive option. This ensures that ONLY the DCLGEN text will be generated....unless other utilities are required.
    For table ACCUM_STRATEGY the code generated looks like this:
.CALL DSN PARM(ssid)
.DATA
DCLGEN TABLE(PTI.ACCUM_STRATEGY)                                       -
LIBRARY('hlq.hlq1.DCLGEN1')                                       -
ACTION(ADD)                                                            -
LANGUAGE(COB2)                                                         -
STRUCTURE(ACCUM_STRATEGY)
.ENDDATA
  1. Pre-allocate the hlq.DCLGEN.LIB as a sequential dataset. This is the dataset defined in Step 9.

  2. Execute the strategy and the DCLGEN is written to the dataset in step 14.

The DCLGEN code produced for this table looks like this:

******************************************************************
* DCLGEN TABLE(PTI.ACCUM_STRATEGY)                               *
*        LIBRARY(hlq.hlq1.DCLGEN1)                          *
*        LANGUAGE(COBOL)                                         *
*        STRUCTURE(ACCUM_STRATEGY)                               *
*        QUOTE                                                   *
* ... IS THE DCLGEN COMMAND THAT MADE THE FOLLOWING STATEMENTS   *
******************************************************************
     EXEC SQL DECLARE PTI.ACCUM_STRATEGY TABLE
     ( STRATEGY_CREATOR               CHAR(8) NOT NULL,
       STRATEGY_NAME                  CHAR(8) NOT NULL,
       SEQUENCE_FIELD                 SMALLINT NOT NULL,
       INTERNAL_TYPE                  SMALLINT NOT NULL,
       DATA                           VARCHAR(2048) NOT NULL
     ) END-EXEC.
******************************************************************
* COBOL DECLARATION FOR TABLE PTI.ACCUM_STRATEGY                 *
******************************************************************
 01  ACCUM_STRATEGY.
     10 STRATEGY-CREATOR     PIC X(8).
     10 STRATEGY-NAME        PIC X(8).
     10 SEQUENCE-FIELD       PIC S9(4) USAGE COMP.
     10 INTERNAL-TYPE        PIC S9(4) USAGE COMP.
     10 DATA.
        49 DATA-LEN          PIC S9(4) USAGE COMP.
        49 DATA-TEXT         PIC X(2048).
******************************************************************
* THE NUMBER OF COLUMNS DESCRIBED BY THIS DECLARATION IS 5       *
******************************************************************

Additional Information

Example Add a Utility (DCLGEN) to a Model ID

Symbolic Parameters