FOCUS AREAS

Migrating a Library with Validation Tools

Migration

Details: Validation Macros

This topic provides in-depth details about the macros that are invoked when you migrate a library with validation tools.

Validation Macros Overview

The migrate_template.sas tool requires that all the necessary macros be compiled or included in the program before execution. The migrate_macros.sas tool contains all the required macros and compiles the macros for you when the migrate_macros.sas tool is submitted.

The following are the SAS macros provided in the migrate_macros.sas tool:

%MIG_IN_LIB

Documents the contents of the source library by creating a new SAS data set in the ODS library that contains the name and memtype of each member in the library. (Later in the program it is called again to document the contents of the target library.)

%MIG_SOURCE

Uses the source library SAS data set created by the %MIG_IN_LIB macro to create memtype flag variables for each member, which indicate the presence of files of a particular memtype in the source library. These variables are used by the memtype validation macros.

%MIG_INDEXES

Only include this macro for libraries that contain data files with indexes or integrity constraints, because these two types of members are handled differently and could cause unexpected COMPARE differences.

%MIG_CHECK_LIBS

Compares the contents of the source library before migration with the contents of the target library after migration.

%MIG_CHECK_SOURCE

Compares the contents of the source library before migration with the contents of the source library after migration.

%CHECKDATA, %CHECKCATALOG, %CHECKVIEW, %CHECKAUDIT, %CHECKINDEX

These memtype validation macros use the %MIG_SOURCE variables to produce output that contains only the SAS data set attributes and engine or operating environment data that are different in the source library and the target library.


Wrapper Macros

Three wrapper macros call all the individual macros mentioned above. The %BEFORE macro runs before PROC MIGRATE and the %AFTER and %CHECKEM macros run after PROC MIGRATE. These wrapper macros simplify the library migration process by including them in the migrate_template.sas tool:

%BEFORE

Wraps all the macros needed before PROC MIGRATE is run. The migrate_template.sas tool calls the %BEFORE wrapper macro instead of calling each macro individually.

The %BEFORE runs the following three macros for you:

%mig_in_lib;
%mig_source;
%mig_indexes;
%AFTER

Wraps all the macros required to validate the PROC MIGRATE results. %AFTER is also referenced by the migrate_template.sas tool instead of calling each macro individually.

The %AFTER runs the following five macros for you:

%mig_in_lib(lib=lib1, after=y);
%mig_in_lib(lib=lib2);
%mig_indexes(lib=LIB2);  /*must be upper case*/
%mig_check_libs;
%mig_check_source;
%CHECKEM

Wraps all the memtype macros required to run all of the individual memtype validation macros with a single macro call. The %CHECKEM runs the following five macros for you:

%checkdata;
%checkview;
%checkaudit;
%checkindex;
%checkcatalog;

The following table shows the memtype macros that validate each memtype or file. All of the memtype macros are contained within the %CHECKEM wrapper macro:

Memtype and Corresponding Validation Macro
Memtype or File Validation Macro
catalog (catalog attributes only) %CHECKCATALOG
data set %CHECKDATA
data file with an index %CHECKDATA and %CHECKINDEX
data file with integrity constraint %CHECKDATA and %CHECKINDEX
data file with an audit trail %CHECKDATA and %CHECKAUDIT
generations %CHECKDATA
SQL view %CHECKVIEW