IBM LISTDEF and TEMPLATE in RC/Migrator Model Service Copy utility

Document ID : KB000054674
Last Modified Date : 14/02/2018
Show Technical Document Details

Description:

How do I use the IBM LISTDEF and TEMPLATE functions in an RC/Migrator Utility Model Services COPY model?

Solution:

The COPY Member in the RCM Utility Model Services Library

This COPY Model processes just one tablespace. It is only a simple example to show how the variable substitution happens in the analysis and then a second substitution happens at execution time.

UTILITY  OBJ DESCRIPTIONC          SIZE
COPY     TS  IMAGE COPY            RPI
CMD SYMBOL   ERR REPLACEMENT VALUE
_   COPYDUNT     %DISK___________________________________________________
_   COPYSP1      %CALC(%REORGP*050/100+1)________________________________
_   COPYSP2      %CALC(%REORGP*030/100+1)________________________________
_   COPYSP3      TRK_____________________________________________________
_   DISK         SYSDA___________________________________________________
_   DSN          &USERID..&DB..&SN..&ICTYPE..P&PART..T&TIME._____________
--- THIS MODEL COPIES ONE TABLESPACE USING A TEMPLATE AND A LISTDEF
.CALL UTIL COPY PARM(%TOSSID)
.DATA
  LISTDEF TXLIST INCLUDE TABLESPACE %DBNAME..%TSNAME
  OPTIONS EVENT
  TEMPLATE COPYDSN
           DSN '%DSN'
           SPACE(%COPYSP1,%COPYSP2) %COPYSP3
           DISP(NEW,CATLG,CATLG)
           UNIT %COPYDUNT
   COPY LIST TXLIST CHANGELIMIT(5)
        COPYDDN COPYDSN
        PARALLEL(10)
        SHRLEVEL(REFERENCE)
.ENDDATA

The LISTDEF statement is using the %DBNAME and %TSNAME automatic symbolic variables during the analysis time. The "%DSN" user defined model variable contains the dataset name map which will be used by the IBM TEMPLATE command at execution time. This dataset name will be associated with the COPYDSN DD.

Important Note
In the TEMPLATE command, DSN section, do not use brackets() around the dataset name. Use only quotes. When using brackets RC/Migrator tries to make the dataset name valid at analysis time. When the "&" variables are found these are rejected as invalid unless RC/Migrator is working on a string between quotes.

The Analysis Output
When analyzed this is the analysis output produced.

.SYNC 195 'COPY TABLESPACE DBNAME.TSTESTP3'
--- THIS MODEL COPIES ONE TABLESPACE USING A TEMPLATE AND A LISTDEF
.CALL UTIL COPY PARM(D81A)
.DATA
   LISTDEF TXLIST INCLUDE TABLESPACE DBNAME.TSTESTP3
   OPTIONS EVENT
   TEMPLATE COPYDSN
            DSN '&USERID..&DB..&SN..&ICTYPE..P&PART..T&TIME.'
            SPACE(1,1) TRK
            DISP(NEW,CATLG,CATLG)
            UNIT SYSDA
   COPY LIST TXLIST CHANGELIMIT(5)
        COPYDDN COPYDSN
        PARALLEL(10)
        SHRLEVEL(REFERENCE)
.ENDDATA

Notice above that the LISTDEF statement has a database and tablespace name substituted at analysis time which came from your selected tablespaces in the strategy. In the TEMPLATE statement the %DSN user defined variable has been replaced by the dataset name map text which incorporates the IBM TEMPLATE variables. You can see the ones like &ICTYPE that start with a "&". These will be substituted by TEMPLATE at execution time.

The Execution with Batch Processor
When Executed the output below is produced.

.CALL UTIL COPY PARM(D81A)
.ALLOC UNIT(SYSDA) FI(SYSIN) NEW SPACE(2,4) TRACKS +
RECFM(F,B) LRECL(80) BLKSIZE(6320)
.ALLOC UNIT(SYSDA) FI(SYSPRINT) NEW SPACE(4,80) CYL +
RECFM(V,B,A) LRECL(125) BLKSIZE(6254)
.DATA
   LISTDEF TXLIST INCLUDE TABLESPACE DBNAME.TSTESTP3
   OPTIONS EVENT
   TEMPLATE COPYDSN
            DSN '&USERID..&DB..&SN..&ICTYPE..P&PART..T&TIME.'
            SPACE(1,1) TRK
            DISP(NEW,CATLG,CATLG)
            UNIT SYSDA
   COPY LIST TXLIST CHANGELIMIT(5)
        COPYDDN COPYDSN
        PARALLEL(10)
        SHRLEVEL(REFERENCE)
.ENDDATA
 
DSNU000I DSNUGUTC - OUTPUT START FOR UTILITY, UTILID = MYUSERID.MYUSERIDB
DSNU1044I DSNUGTIS - PROCESSING SYSIN AS EBCDIC
DSNU050I DSNUGUTC - LISTDEF TXLIST INCLUDE TABLESPACE DBNAME.TSTESTP3
DSNU1035I DSNUILDR - LISTDEF STATEMENT PROCESSED SUCCESSFULLY
DSNU050I DSNUGUTC - OPTIONS EVENT
DSNU1035I DSNUILDR - OPTIONS STATEMENT PROCESSED SUCCESSFULLY
DSNU050I DSNUGUTC - TEMPLATE COPYDSN DSN
'&USERID..&DB..&SN..&ICTYPE..P&PART..T&TIME.' SPACE(1, 1) TRK DIS
P(NEW, CATLG, CATLG) UNIT SYSDA
DSNU1035I DSNUJTDR - TEMPLATE STATEMENT PROCESSED SUCCESSFULLY
DSNU050I DSNUGUTC - COPY LIST TXLIST CHANGELIMIT(5) COPYDDN COPYDSN
PARALLEL(10) SHRLEVEL(REFERENCE)
DSNU427I DSNUBBID - OBJECTS WILL BE PROCESSED IN PARALLEL,
NUMBER OF OBJECTS = 1
DSNU1038I DSNUGDYN - DATASET ALLOCATED. TEMPLATE=COPYDSN
DDNAME=SYS00004
DSN=MYUSERID.DBNAME.TSTESTP3.C.P00000.T062258

Notice above that the dataset name allocated to DD COPYDSN has been built by the TEMPLATE command. DSN=MYUSERID.DBNAME.TSTESTP3.C.P00000.T062258

References
The DB2V10,  Utility Guide and Reference, LISTDEF and TEMPLATE command sections
The R18 RC/Migrator User Guide, Utility Model Services section