XML Masking Template UDCXML1

Data Express provides the UDCXML1 data masking routine as a template for processing XML data. You can use the template as-is, or customize and/or replicate it according to your needs.

Note: The information in this topic that applies to UDCXML1 also applies to UDCXML6 except for the output PDS naming convention because PDSs are not present in DSNTIAUL format. In addition, the information in this topic that applies to UDCLOB1 also applies to UDCLOB6.

The sections that follow explain how to customize the STARTING-OPERATIONS section in the UDCXML1 template to manage:

Character Set

Source XML can be stored in DB2 using any of several supported character sets such as EBCDIC, ASCII, various dialects of EBCDIC and ASCII, or even custom character sets.

To correctly manage this, the engine called by the data masking routine needs to know the character set in use so it can appropriately process the data. Depending on the specified character set, the data masking engine performs certain tasks such as the transforming of single-byte characters from one set to another, transforming EBCDIC to ASCII before processing, and recoding any transformed characters back to the original character set before writing the output.

Standard character set

By default, the character set specified to Data Express is "*NONE", meaning that no character transforming is required. This assumes that the data being parsed is in EBCDIC and uses the same code page as is specified in your Data Express mainframe installation:

       STARTING-OPERATIONS.                        
      *                                            
      * CHARACTER SET                              
      *                                            
      *    MOVE "ASCII"              TO WS-CHARSET.
      *    MOVE "EBCDIC"             TO WS-CHARSET.
           MOVE "*NONE"              TO WS-CHARSET.

In addition to ASCII and EBCDIC, you can customize this value to represent an alternative or a custom character set.

Alternative or customized character set
To specify a character set other than ASCII or EBCDIC, you must change the value passed to the WS-CHARSET variable. To do this, edit the character set conversion logic in the provided KDCXML3W copybook, which is called by the UDCXML1 routine. Follow these steps:
  1. Add 1 to the KDCXML3-NUM-TAB-USATE VALUE clause.
  2. After the existing TRASC02 group field, add a new similarly-coded group field named TRASC03.
    Note: If TRASC03 or any number of additional TRASC0n fields already exist due to previous editing, name the new group field by incrementing n to the next consecutive number; for example, if TRASC03 exists, name the new group field TRASC04.
  3. Code the new group field as follows:
    • An initial elementary field that is the name of the encoding.
    • A set of variables that associate the value of a character in the customized character set with the value of the corresponding character in the EBCDIC character set.

    For example:

                 10 TRASC03.
                    15 TAB-TRASC03 PIC X(16) VALUE 'NO-TRASX'.
                    15 EL-TRASC03-001 PIC X(2) VALUE X'0000'.
                    15 EL-TRASC03-002 PIC X(2) VALUE X'0101'.
                    15 EL-TRASC03-003 PIC X(2) VALUE X'0202'.
                    .
                    .
                    .
                    15 EL-TRASC03-256 PIC X(2) VALUE X'0000'.
  4. Following the new code group, locate and delete the following rows:
                 10 TAB-VALUE03 PIC X(16).
                 10 TAB-EL03 PIC X(2) OCCURS 256 TIMES.
    Note: If your group field name uses an incremented number other than 3, find and delete the two rows that correspond to the number used for your group field.
  5. Recompile UDCXML1.

Passing XML Data to Masking Routines

To pass data to a masking routine, you code several MOVE statements in the STARTING-OPERATIONS section. Before starting:

  • Assign a tag identifier to each data masking object in your XML code. See XML Tag Identifiers for details.
  • Determine the total number of data masking object instances contained in your XML code. A data masking object instance is single occurrence of a data masking object.
  • Associate the number 1 with the first data masking job instance, and continue numbering consecutively through the last instance. These numbers are for your reference.
  • Determine the maximum length of each data masking object.
  • Determine the name of each data masking routine you want to use. See Masking Routines for more information.

Data Express provides the WS-NUMTAG(n) field to hold the total number of data masking object instances to process, and provides the following three fields to identify the data and the masking routine for each instance. Each data masking object instance uses all three fields:

WS-TAG(n)
Where n is the number (from 1 to WS-NUMTAG) that you have associated with the data masking object instance. Into this field, you move the tag identifier for a data masking object instance.
WS-LEN1(n)
Where n is the number (from 1 to WS-NUMTAG) that you have associated with the data masking object instance. Into this field, move the length of the data masking object instance. You can set this to an exact field length for standard-sized data, such as an IBAN, or set it higher to accommodate dynamic field lengths. The limit is 255.
WS-ROUTINE(n)
Where n is the number (from 1 to WS-NUMTAG) that you have associated with the data masking object instance. Into this field, move the name of the masking routine to use.

The following example shows code used to move the data from eight XML data object instances to their appropriate masking routines:

      *---------------------------------------------------------------
      *
       STARTING-OPERATIONS.
          .
          .
          .
      *
      * MASKING ROUTINE
      *
           MOVE  8                   TO WS-NUMTAG.
           MOVE "Nm"                 TO WS-TAG      (1).
           MOVE 255                  TO WS-LEN1     (1).
           MOVE "ADLER"              TO WS-ROUTINE  (1).
           MOVE "AdrLine"            TO WS-TAG      (2).
           MOVE 255                  TO WS-LEN1     (2).
           MOVE "ADLER"              TO WS-ROUTINE  (2).
           MOVE
           "Mndt,Dbtr,Id,PrvtId,Othr,Id"
                                     TO WS-TAG      (3).
           MOVE 16                   TO WS-LEN1     (3).
           MOVE "UDCCDFC"            TO WS-ROUTINE  (3).
           MOVE SPACES               TO WS-TAG      (4).
           STRING "UndrlygAccptncDtls,OrgnlMndt,OrgnlMndt,"
                   DELIMITED BY SIZE
                  "Dbtr,Id,PrvtId,Othr,Id"
                   DELIMITED BY SIZE
                                   INTO WS-TAG      (4).
          MOVE 16                   TO WS-LEN1     (4).
          MOVE "UDCCDFC"            TO WS-ROUTINE  (4).
          MOVE "BirthDt"            TO WS-TAG      (5).
          MOVE 10                   TO WS-LEN1     (5).
          MOVE "UDCMDY0"            TO WS-ROUTINE  (5)
          MOVE "NOME"               TO WS-TAG      (6).
          MOVE 255                  TO WS-LEN1     (6).
          MOVE "UDCNAMC"            TO WS-ROUTINE  (6)
          MOVE "COGNOME"            TO WS-TAG      (7).
          MOVE 255                  TO WS-LEN1     (7).
          MOVE "UDCSURC"            TO WS-ROUTINE  (7).
          MOVE "TAXCODE"            TO WS-TAG      (8).
          MOVE 16                   TO WS-LEN1     (8).
          MOVE "UDCCDFC"            TO WS-ROUTINE  (8).

      STARTING-OPERATIONS-EX.

Output PDS Naming Convention

You can customize the following algorithm to set the output PDS. The name of the variable to use is WS-PDS-OUT:

      *---------------------------------------------------------------
      *
       STARTING-OPERATIONS.
          .
          .
          .
      *
      * OUTPUT PDS NAMING CONVENTION
      *
           MOVE SPACES TO WS-PDS-OUT.
           STRING "XXX.YYY." DELIMITED BY SIZE
                  WS-METODO DELIMITED BY SPACES
                  "." DELIMITED BY SIZE
                  WS-TABELLA DELIMITED BY SPACES
                  ".LIB" DELIMITED BY SIZE
                  INTO WS-PDS-OUT.