Remap numerous bytes to a given record layout. It is common for z/OS IMS and VSAM based applications to reuse previously defined Segments and Records in order to avoid creating new physical segments and files. That practice dates back to the dawn of computers when storage costs were astronomical by comparison to today. It was made possible by the fact that the database management systems did not contain catalogs describing the detailed content of Segments or Records down to the level of individual elementary data items such as a NAME or PHONE-NUMBER. Rather the DBMS merely knew where the physical segment or record could be found and how long it was. While an overly simplistic explanation it is the fundamental premise behind the need for the REMAP function.
Category
Record
REMAP(<source_datastore>, <remapped_description_alias>, <cdc_after_image> [,<cdc_before_image>)
or
REMAP(<source_datastore>, <remapped_description_alias> | variable | field, <cdc_after_image[,<cdc_before_image>])
Parameter | Description |
---|---|
source_datastore | The alias name of the source DATASTORE. |
remapped_description_alias | The alias name of the DESCRIPTION that the source data will be mapped into from the Source DATASTORE. |
cdc_after_image | The raw image of CDC record in the format associated with Source DATASTORE. It will be the after image for inserts and updates and the before image for deletes. |
cdc_before_image | The raw image of CDC record in the format associated with Source DATASTORE. It will be the before image of an update. |
Example 1
An Segment maintained by an IMS application maintains two versions of the same segment both of which will be replicated into a new RDBMS. Variations in the source data that exist from an acquisitions will be eliminated in the new data model.
First identify the field in the Source COBOL description that identifies which COBOL copybook should be used for a captured IMS Segment. The field will exist in both copybooks at the same displacement and for the same length but may have different field-names. Application SME have explained that there are two versions of this Segment, one for USA based employees and a second for those in the EU. The IMS DBD HREMPLDB identifies the segment using its original name, HREMP001 prior to expansion into the EU. They tell us that the HR-EMPLOYEE-BASE PIC X(2) field will contain either "US" or "EU". With that information and the two COBOL copybooks named HRUSEMPL (the original was renamed from HREMP001) and HREUEMPL the following logic will be used to select which DESCRIPTION to use and which of two Mapping PROCS will be used to populate the Relational Target.
DESCRIPTION COBOL ./IMSSEG/HREMPLDB/HRUSEMPL.cob AS HREMP001
FOR SEGMENT HREMP001
IN DATABASE HREMPLDB;
-- HREUEMPL redefines the HREMP001 segment
DESCRIPTION COBOL ./IMSSEG/HREMPLDB/HREUEMPL.cob AS HREUEMPL
FOR SEGMENT HREMP001
IN DATABASE HREMPLDB;
CASE IMSSEGNAME(CDCIN)
WHEN HREMP001
{
if HREMP001.HR-EMPLOYEE-BASE = 'US"
{ CALLPROC(M_HRUSEMPL) APPLY(TARGET,T_HRUSEMPL) }
else
{ CALLPROC(M_HREUEMPL) APPLY(TARGET,T_HREUEMPL) }
}
....
CREATE PROC M_HRUSEMPL AS SELECT
{
...
-- Since the CDC record is automatically read into the DESCRIPTION with the matching Segment Name as its alias the data can be mapped without further instructions.
T_EMPLOYEE.EMPLOYEE_NAME = HREMP001.HRUS-EMPLOYEE-NAME
...
CREATE PROC M_HREUEMPL AS SELECT
{
REMAP(CDCIN, HREUEMPL, GET_RAW_RECORD(CDCIN, AFTER), GET_RAW_RECORD(CDCIN, BEFORE))
...
T_EMPLOYEE.EMPLOYEE_NAME = HREUEMPL.HREU-EMPLOYEE-NAME
...
Example 2
A VSAM file maintained by a CICS program maintains two versions of the same record both of which will be replicated into a new RDBMS. Variations in the source data that exist from an acquisitions will be eliminated in the new data model.
First identify the field in the Source COBOL description that identifies which COBOL copybook should be used for a captured VSAM record. The field will exist in both copybooks at the same displacement and for the same length but may have different field-names. Application SME have explained that there are two versions of this record, one for USA based employees and a second for those in the EU. The original CICS application identified the Record in the CICS FCT (file control table) by the name EMPLOYEE prior to expansion into the EU. They tell us that the HR-EMPLOYEE-BASE PIC X(2) field will contain either "US" or "EU". With that information and the two COBOL copybooks named HRUSEMPL (the original was renamed from EMPLOYEE) and HREUEMPL the following logic will be used to select which DESCRIPTION to use and which of two Mapping PROCS will be used to populate the Relational Target.
DESCRIPTION COBOL ./COBOL/HRUSEMPL.cob AS EMPLOYEE;
-- HREUEMPL redefines the EMPLOYEE record
DESCRIPTION COBOL ./COBOL/HREUEMPL.cob AS HREUEMPL;
CASE RECNAME(CDCIN)
WHEN EMPLOYEE
{
if EMPLOYEE.HR-EMPLOYEE-BASE = 'US"
{ CALLPROC(M_HRUSEMPL) APPLY(TARGET,T_HRUSEMPL) }
else
{ CALLPROC(M_HREUEMPL) APPLY(TARGET,T_HREUEMPL) }
}
....
CREATE PROC M_HRUSEMPL AS SELECT
{
...
-- Since the CDC record is automatically read into the DESCRIPTION with the matching CICS FCT Record Name as its alias the data can be mapped without further instructions.
T_EMPLOYEE.EMPLOYEE_NAME = EMPLOYEE.HRUS-EMPLOYEE-NAME
...
CREATE PROC M_HREUEMPL AS SELECT
{
REMAP(CDCIN, HREUEMPL, GET_RAW_RECORD(CDCIN, AFTER), GET_RAW_RECORD(CDCIN, BEFORE))
...
T_EMPLOYEE.EMPLOYEE_NAME = HREUEMPL.HREU-EMPLOYEE-NAME